fix bulk_edit: don't remove supplier if none is selected, save category, removed confirm dialog (#393)

This commit is contained in:
FrancescoUK
2016-03-21 19:02:53 +00:00
parent b72432a39e
commit fda45dd363
2 changed files with 14 additions and 19 deletions

View File

@@ -473,15 +473,15 @@ class Items extends Secure_area implements iData_controller
$item_data = array();
foreach($_POST as $key=>$value)
{
{
//This field is nullable, so treat it differently
if ($key == 'supplier_id')
{
$item_data["$key"]=$value == '' ? null : $value;
if ($key == 'supplier_id' and $value != '')
{
$item_data["$key"] = $value;
}
elseif($value!='' and !(in_array($key, array('submit', 'item_ids', 'tax_names', 'tax_percents', 'category'))))
elseif($value != '' and !(in_array($key, array('item_ids', 'tax_names', 'tax_percents'))))
{
$item_data["$key"]=$value;
$item_data["$key"] = $value;
}
}

View File

@@ -157,26 +157,21 @@ $(document).ready(function()
$('#item_form').validate($.extend({
submitHandler:function(form)
{
if(confirm("<?php echo $this->lang->line('items_confirm_bulk_edit') ?>"))
//Get the selected ids and create hidden fields to send with ajax submit.
var selected_item_ids=get_selected_values();
for(k=0;k<selected_item_ids.length;k++)
{
//Get the selected ids and create hidden fields to send with ajax submit.
var selected_item_ids=get_selected_values();
for(k=0;k<selected_item_ids.length;k++)
{
$(form).append("<input type='hidden' name='item_ids[]' value='"+selected_item_ids[k]+"' />");
}
$(form).ajaxSubmit({
$(form).append("<input type='hidden' name='item_ids[]' value='"+selected_item_ids[k]+"' />");
}
$(form).ajaxSubmit({
success:function(response)
{
dialog_support.hide();
post_bulk_form_submit(response);
},
dataType:'json'
});
}
});
},
rules:
{