From 7b674b2e3fd3f62fd32638716c8324525221caa8 Mon Sep 17 00:00:00 2001 From: jekkos Date: Mon, 4 Jul 2016 21:42:02 +0200 Subject: [PATCH] Fix submit in items, customers and sales (#716) Add again new button functionality in items (#712) Bugfixes for csrf tokens (#599) --- application/controllers/Reports.php | 2 +- application/helpers/table_helper.php | 4 +- application/views/customers/form.php | 5 ++- application/views/items/form.php | 12 +++--- application/views/partial/header.php | 42 ++------------------- application/views/partial/header_js.php | 40 ++++++++++++++++++++ application/views/receivings/form.php | 8 ---- application/views/receivings/receiving.php | 1 + application/views/sales/form.php | 5 ++- application/views/sales/register.php | 5 ++- bower.json | 3 +- css/register.css | 5 +++ dist/opensourcepos.js | 4 +- dist/opensourcepos.min.css | 2 +- dist/opensourcepos.min.js | 2 +- js/manage_tables.js | 4 +- templates/spacelab/views/partial/header.php | 41 ++------------------ 17 files changed, 83 insertions(+), 102 deletions(-) create mode 100644 application/views/partial/header_js.php diff --git a/application/controllers/Reports.php b/application/controllers/Reports.php index c23a1b6ae..06e4ac67e 100644 --- a/application/controllers/Reports.php +++ b/application/controllers/Reports.php @@ -887,7 +887,7 @@ class Reports extends Secure_Controller 'reference' => $report_data['reference'], 'comment' => $report_data['comment'], 'edit' => anchor("receivings/edit/". $report_data['receiving_id'], '', - array('class'=>"modal-dlg print_hide", 'data-btn-delete' => $this->lang->line('common_delete'), 'data-btn-submit' => $this->lang->line('common_submit'), 'title' => $this->lang->line('receivings_update')) + array('class'=>"modal-dlg print_hide", 'data-btn-submit' => $this->lang->line('common_submit'), 'data-btn-delete' => $this->lang->line('common_delete'), 'title' => $this->lang->line('receivings_update')) ) )); diff --git a/application/helpers/table_helper.php b/application/helpers/table_helper.php index 84ab9e5cd..4aee062ee 100644 --- a/application/helpers/table_helper.php +++ b/application/helpers/table_helper.php @@ -283,10 +283,10 @@ function get_item_data_row($item, $controller) array('class' => 'modal-dlg', 'data-btn-submit' => $CI->lang->line('common_submit'), 'title' => $CI->lang->line($controller_name.'_count')) ), 'stock' => anchor($controller_name."/count_details/$item->item_id", '', - array('class' => 'modal-dlg', 'title' => $CI->lang->line($controller_name.'_details_count')) + array('class' => 'modal-dlg', 'title' => $CI->lang->line($controller_name.'_details_count')) ), 'edit' => anchor($controller_name."/view/$item->item_id", '', - array('class' => 'modal-dlg', 'data-btn-submit' => $CI->lang->line('common_submit'), 'title' => $CI->lang->line($controller_name.'_update')) + array('class' => 'modal-dlg', 'data-btn-submit' => $CI->lang->line('common_submit'), 'data-btn-new' => $CI->lang->line('common_new'), 'title' => $CI->lang->line($controller_name.'_update')) )); } diff --git a/application/views/customers/form.php b/application/views/customers/form.php index 2a6732cba..47d14dc5f 100644 --- a/application/views/customers/form.php +++ b/application/views/customers/form.php @@ -83,6 +83,7 @@ $(document).ready(function() submitHandler:function(form) { $(form).ajaxSubmit({ + beforeSerialize: setup_csrf_token(), success:function(response) { dialog_support.hide(); @@ -102,14 +103,14 @@ $(document).ready(function() { url: "", type: "post", - data: + data: $.extend(csrf_form_base(), { "person_id" : "person_id; ?>", "account_number" : function() { return $("#account_number").val(); } - } + }) } } }, diff --git a/application/views/items/form.php b/application/views/items/form.php index 78fcd0e39..a114ef328 100644 --- a/application/views/items/form.php +++ b/application/views/items/form.php @@ -283,8 +283,9 @@ //validation and submit handling $(document).ready(function() { - $("#continue").click(function() { + $("#new").click(function() { stay_open = true; + $("#item_form").submit(); }); $("#submit").click(function() { @@ -303,7 +304,7 @@ type: "POST", url: "", dataType: "json", - data: $.extend(request, {field_no: }), + data: $.extend(request, $extend(csrf_form_base(), {field_no: })), success: function(data) { response($.map(data, function(item) { return { @@ -330,6 +331,7 @@ $('#item_form').validate($.extend({ submitHandler: function(form, event) { $(form).ajaxSubmit({ + beforeSerialize: setup_csrf_token, success: function(response) { var stay_open = dialog_support.clicked_id() != 'submit'; if (stay_open) @@ -363,14 +365,14 @@ { url: "", type: "post", - data: + data: $.extend(csrf_form_base(), { "item_id" : "item_id; ?>", "item_number" : function() { return $("#item_number").val(); - } - } + }, + }) } }, cost_price: diff --git a/application/views/partial/header.php b/application/views/partial/header.php index 83d9ef62c..de025fad5 100644 --- a/application/views/partial/header.php +++ b/application/views/partial/header.php @@ -55,6 +55,7 @@ + @@ -68,50 +69,15 @@ - + - + load->view('partial/lang_lines'); ?> - - + load->view('partial/header_js'); ?>