diff --git a/application/views/items/form.php b/application/views/items/form.php
index ee6688a2b..b73884315 100644
--- a/application/views/items/form.php
+++ b/application/views/items/form.php
@@ -47,9 +47,9 @@
lang->line('items_allow_alt_description'), 'allow_alt_description', array('class'=>'control-label col-xs-3')); ?>
@@ -289,13 +286,11 @@
//validation and submit handling
$(document).ready(function()
{
- $("#continue").click(function()
- {
+ $("#continue").click(function() {
stay_open = true;
});
- $("#submit").click(function()
- {
+ $("#submit").click(function() {
stay_open = false;
});
@@ -310,37 +305,31 @@
}
?>
- $.validator.addMethod("item_number", function(value, element)
- {
- return JSON.parse($.ajax(
- {
- type: 'POST',
- url: '',
- data: {'item_id' : 'item_id; ?>', 'item_number' : $(element).val() },
- success: function(response)
- {
- success=response.success;
- },
- async:false,
- dataType: 'json'
- }).responseText).success;
-
+ $.validator.addMethod("item_number", function(value, element) {
+ return JSON.parse($.ajax({
+ type: 'POST',
+ url: '',
+ data: {'item_id' : 'item_id; ?>', 'item_number' : $(element).val() },
+ success: function(response) {
+ success = response.success;
+ },
+ async: false,
+ dataType: 'json'
+ }).responseText).success;
}, 'lang->line("items_item_number_duplicate"); ?>');
$('#item_form').validate($.extend({
- submitHandler:function(form, event)
- {
+ submitHandler: function(form, event) {
$(form).ajaxSubmit({
- success:function(response)
- {
+ success: function(response) {
var stay_open = dialog_support.clicked_id() != 'submit';
- if (stay_open)
+ if (stay_open)
{
// set action of item_form to url without item id, so a new one can be created
$("#item_form").attr("action", "");
// use a whitelist of fields to minimize unintended side effects
- $(':text, :password, :file, #description, #item_form').not('.quantity, #reorder_level, #tax_name_1,' +
- '#tax_percent_name_1, #reference_number, #name, #cost_price, #unit_price, #taxed_cost_price, #taxed_unit_price').val('');
+ $(':text, :password, :file, #description, #item_form').not('.quantity, #reorder_level, #tax_name_1,' +
+ '#tax_percent_name_1, #reference_number, #name, #cost_price, #unit_price, #taxed_cost_price, #taxed_unit_price').val('');
// de-select any checkboxes, radios and drop-down menus
$(':input', '#item_form').not('#item_category_id').removeAttr('checked').removeAttr('selected');
}
@@ -348,16 +337,19 @@
{
dialog_support.hide();
}
- post_item_form_submit(response, stay_open);
+ post_item_form_submit(response, stay_open);
},
- dataType:'json'
+ dataType: 'json'
});
},
rules:
{
name:"required",
category:"required",
- item_number: { item_number: true },
+ item_number:
+ {
+ item_number: true
+ },
cost_price:
{
required:true,
@@ -378,7 +370,6 @@
required:true,
number:true
}
-
},
messages:
{