From 2c5f3ee759e97c32e7493f955457a68da124c3a7 Mon Sep 17 00:00:00 2001 From: jekkos Date: Mon, 7 Sep 2015 22:15:41 +0200 Subject: [PATCH] Add grunt-cache-breaker plugin (#137) Fix tax inclusive pricing for daily sales overview (#136) Fix table sorting when using search in daily sales overview (#131) --- Gruntfile.js | 17 ++++++++++++++++- application/controllers/sales.php | 5 ++++- application/models/receiving.php | 2 +- application/models/sale.php | 4 ++-- application/views/partial/header.php | 2 +- package.json | 5 +++-- 6 files changed, 27 insertions(+), 8 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 4fc76c950..e85a83789 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -74,6 +74,20 @@ module.exports = function(grunt) { watch: { files: ['<%= jshint.files %>'], tasks: ['jshint'] + }, + cachebreaker: { + dev: { + options: { + match: ['opensourcepos.min.js'], + src: { + path: 'dist/opensourcepos.min.js' + }, + replacement: 'md5' + }, + files: { + src: ['application/views/partial/header.php'] + } + } } }); @@ -83,7 +97,8 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-script-link-tags'); grunt.loadNpmTasks('grunt-mocha-webdriver'); + grunt.loadNpmTasks('grunt-cache-breaker'); - grunt.registerTask('default', ['tags:js', 'concat', 'uglify', 'tags:minjs']); + grunt.registerTask('default', ['tags:js', 'concat', 'uglify', 'tags:minjs', 'cachebreaker']); }; diff --git a/application/controllers/sales.php b/application/controllers/sales.php index 86d65d59b..f3cc6a24e 100644 --- a/application/controllers/sales.php +++ b/application/controllers/sales.php @@ -7,7 +7,6 @@ class Sales extends Secure_area parent::__construct('sales'); $this->load->library('sale_lib'); $this->load->library('barcode_lib'); - $this->Sale->create_sales_items_temp_table(); } function index() @@ -17,6 +16,8 @@ class Sales extends Secure_area function manage($only_invoices = FALSE, $only_cash = FALSE, $limit_from = 0) { + $this->Sale->create_sales_items_temp_table(); + $data['controller_name'] = strtolower($this->uri->segment(1)); $data['only_invoices'] = array($this->lang->line('sales_no_filter'), $this->lang->line('sales_invoice')); $data['search_section_state'] = $this->input->post('search_section_state'); @@ -66,6 +67,8 @@ class Sales extends Secure_area function search() { + $this->Sale->create_sales_items_temp_table(); + $only_invoices = $this->input->post('only_invoices', TRUE); $only_cash = $this->input->post('only_cash', TRUE); $lines_per_page = $this->Appconfig->get('lines_per_page'); diff --git a/application/models/receiving.php b/application/models/receiving.php index 00585041d..01d24ad08 100644 --- a/application/models/receiving.php +++ b/application/models/receiving.php @@ -211,7 +211,7 @@ class Receiving extends CI_Model } //We create a temp table that allows us to do easy report/receiving queries - public function create_receivings_items_temp_table() + function create_receivings_items_temp_table() { $this->db->query("CREATE TEMPORARY TABLE IF NOT EXISTS ".$this->db->dbprefix('receivings_items_temp')." (SELECT date(receiving_time) as receiving_date, ".$this->db->dbprefix('receivings_items').".receiving_id, comment, item_location, invoice_number, payment_type, employee_id, diff --git a/application/models/sale.php b/application/models/sale.php index 50c565e47..98a5b15b1 100644 --- a/application/models/sale.php +++ b/application/models/sale.php @@ -425,7 +425,7 @@ class Sale extends CI_Model } //We create a temp table that allows us to do easy report/sales queries - public function create_sales_items_temp_table() + function create_sales_items_temp_table() { if ($this->config->item('tax_included')) { @@ -475,7 +475,7 @@ class Sale extends CI_Model $this->db->query('UPDATE '.$this->db->dbprefix('sales_items_temp'). ' SET total=subtotal WHERE total IS NULL'); } - public function get_giftcard_value( $giftcardNumber ) + function get_giftcard_value( $giftcardNumber ) { if ( !$this->Giftcard->exists( $this->Giftcard->get_giftcard_id($giftcardNumber))) return 0; diff --git a/application/views/partial/header.php b/application/views/partial/header.php index b8a247716..b2fe1da5e 100644 --- a/application/views/partial/header.php +++ b/application/views/partial/header.php @@ -32,7 +32,7 @@ - +