mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-10-21 07:44:37 -04:00
Remove sync ajax calls in validation callback for forms (#413)
Remove jquery-bgiframe (not used anynmore) (#328) Fix bug in receiving form save if supplier was empty Conflicts: application/controllers/Items.php application/views/customers/form.php application/views/items/form.php application/views/partial/header.php application/views/receivings/form.php application/views/sales/form.php bower.json dist/opensourcepos.js dist/opensourcepos.min.js templates/spacelab/views/partial/header.php
This commit is contained in:
1 parent
e6472d525d
commit
258c95f02e
12 files changed
+72
-95
No files matched your search
@@ -102,7 +102,7 @@ class Customers extends Person_controller
|
||||
function check_account_number()
|
||||
{
|
||||
$exists = $this->Customer->account_number_exists($this->input->post('account_number'),$this->input->post('person_id'));
|
||||
echo json_encode(array('success'=>!$exists,'message'=>$this->lang->line('customers_account_number_duplicate')));
|
||||
echo !$exists ? 'true' : 'false';
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -492,7 +492,7 @@ class Items extends Secure_area implements iData_controller
|
||||
function check_item_number()
|
||||
{
|
||||
$exists = $this->Item->item_number_exists($this->input->post('item_number'),$this->input->post('item_id'));
|
||||
echo json_encode(array('success'=>!$exists,'message'=>$this->lang->line('items_item_number_duplicate')));
|
||||
echo !$exists ? 'true' : 'false';
|
||||
}
|
||||
|
||||
function _handle_image_upload()
|
||||
|
||||
@@ -367,7 +367,7 @@ class Receivings extends Secure_area
|
||||
|
||||
$receiving_data = array(
|
||||
'receiving_time' => $date_formatter->format('Y-m-d H:i:s'),
|
||||
'supplier_id' => $this->input->post('supplier_id'),
|
||||
'supplier_id' => empty($this->input->post('supplier_id')) ? NULL : $this->input->post('supplier_id'),
|
||||
'employee_id' => $this->input->post('employee_id'),
|
||||
'comment' => $this->input->post('comment'),
|
||||
'invoice_number' => $this->input->post('invoice_number')
|
||||
@@ -402,7 +402,7 @@ class Receivings extends Secure_area
|
||||
$receiving_id=$this->input->post('receiving_id');
|
||||
$invoice_number=$this->input->post('invoice_number');
|
||||
$exists=!empty($invoice_number) && $this->Receiving->invoice_number_exists($invoice_number,$receiving_id);
|
||||
echo json_encode(array('success'=>!$exists,'message'=>$this->lang->line('recvs_invoice_number_duplicate')));
|
||||
echo !$exists ? 'true' : 'false';
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -828,8 +828,7 @@ class Sales extends Secure_area
|
||||
$sale_id = $this->input->post('sale_id');
|
||||
$invoice_number = $this->input->post('invoice_number');
|
||||
$exists = !empty($invoice_number) && $this->Sale->invoice_number_exists($invoice_number,$sale_id);
|
||||
|
||||
echo json_encode(array('success'=>!$exists, 'message'=>$this->lang->line('sales_invoice_number_duplicate')));
|
||||
echo !$exists ? 'true' : 'false';
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -54,23 +54,6 @@ echo form_close();
|
||||
$(document).ready(function()
|
||||
{
|
||||
|
||||
$.validator.addMethod("account_number", function(value, element)
|
||||
{
|
||||
return JSON.parse($.ajax(
|
||||
{
|
||||
type: 'POST',
|
||||
url: '<?php echo site_url($controller_name . "/check_account_number")?>',
|
||||
data: {'person_id' : '<?php echo $person_info->person_id; ?>', 'account_number' : $(element).val() },
|
||||
success: function(response)
|
||||
{
|
||||
success=response.success;
|
||||
},
|
||||
async:false,
|
||||
dataType: 'json'
|
||||
}).responseText).success;
|
||||
|
||||
}, '<?php echo $this->lang->line("customers_account_number_duplicate"); ?>');
|
||||
|
||||
$('#customer_form').validate({
|
||||
submitHandler:function(form)
|
||||
{
|
||||
@@ -91,13 +74,29 @@ $(document).ready(function()
|
||||
first_name: "required",
|
||||
last_name: "required",
|
||||
email: "email",
|
||||
account_number: { account_number: true }
|
||||
account_number:
|
||||
{
|
||||
remote:
|
||||
{
|
||||
url: "<?php echo site_url($controller_name . '/check_account_number')?>",
|
||||
type: "post",
|
||||
data:
|
||||
{
|
||||
"person_id" : "<?php echo $person_info->person_id; ?>",
|
||||
"account_number" : function()
|
||||
{
|
||||
return $("#account_number").val();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
messages:
|
||||
{
|
||||
first_name: "<?php echo $this->lang->line('common_first_name_required'); ?>",
|
||||
last_name: "<?php echo $this->lang->line('common_last_name_required'); ?>",
|
||||
email: "<?php echo $this->lang->line('common_email_invalid_format'); ?>"
|
||||
email: "<?php echo $this->lang->line('common_email_invalid_format'); ?>",
|
||||
account_number: "<?php echo $this->lang->line('customers_account_number_duplicate'); ?>"
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -282,23 +282,6 @@ $(document).ready(function()
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
$.validator.addMethod("item_number", function(value, element)
|
||||
{
|
||||
return JSON.parse($.ajax(
|
||||
{
|
||||
type: 'POST',
|
||||
url: '<?php echo site_url($controller_name . "/check_item_number")?>',
|
||||
data: {'item_id' : '<?php echo $item_info->item_id; ?>', 'item_number' : $(element).val() },
|
||||
success: function(response)
|
||||
{
|
||||
success=response.success;
|
||||
},
|
||||
async:false,
|
||||
dataType: 'json'
|
||||
}).responseText).success;
|
||||
|
||||
}, '<?php echo $this->lang->line("items_item_number_duplicate"); ?>');
|
||||
|
||||
$('#item_form').validate({
|
||||
submitHandler:function(form)
|
||||
@@ -332,7 +315,22 @@ $(document).ready(function()
|
||||
{
|
||||
name:"required",
|
||||
category:"required",
|
||||
item_number: { item_number: true },
|
||||
item_number:
|
||||
{
|
||||
remote:
|
||||
{
|
||||
url: "<?php echo site_url($controller_name . '/check_item_number')?>",
|
||||
type: "POST",
|
||||
data:
|
||||
{
|
||||
"item_id": "<?php echo $item_info->item_id; ?>",
|
||||
"item_number": function ()
|
||||
{
|
||||
return $("#item_number").val();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
cost_price:
|
||||
{
|
||||
required:true,
|
||||
@@ -359,6 +357,7 @@ $(document).ready(function()
|
||||
messages:
|
||||
{
|
||||
name:"<?php echo $this->lang->line('items_name_required'); ?>",
|
||||
item_number:"<?php echo $this->lang->line('items_item_number_duplicate'); ?>",
|
||||
category:"<?php echo $this->lang->line('items_category_required'); ?>",
|
||||
cost_price:
|
||||
{
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
<script type="text/javascript" src="js/jquery-ui-timepicker-addon.js" language="javascript"></script>
|
||||
<script type="text/javascript" src="js/jquery.ajax_queue.js" language="javascript"></script>
|
||||
<script type="text/javascript" src="js/jquery.autocomplete.js" language="javascript"></script>
|
||||
<script type="text/javascript" src="js/jquery.bgiframe.min.js" language="javascript"></script>
|
||||
<script type="text/javascript" src="js/jquery.color.js" language="javascript"></script>
|
||||
<script type="text/javascript" src="js/jquery.form-3.51.js" language="javascript"></script>
|
||||
<script type="text/javascript" src="js/jquery.jkey-1.1.js" language="javascript"></script>
|
||||
@@ -35,7 +34,7 @@
|
||||
<!-- end js template tags -->
|
||||
<?php else : ?>
|
||||
<!-- start minjs template tags -->
|
||||
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=57439a28c7" language="javascript"></script>
|
||||
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=f929eb734c" language="javascript"></script>
|
||||
<!-- end minjs template tags -->
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
@@ -71,24 +71,6 @@
|
||||
<script type="text/javascript" language="javascript">
|
||||
$(document).ready(function()
|
||||
{
|
||||
$.validator.addMethod("invoice_number", function(value, element)
|
||||
{
|
||||
var id = $("input[name='receiving_id']").val();
|
||||
|
||||
return JSON.parse($.ajax(
|
||||
{
|
||||
type: 'POST',
|
||||
url: '<?php echo site_url($controller_name . "/check_invoice_number")?>',
|
||||
data: {'receiving_id' : id, 'invoice_number' : $(element).val() },
|
||||
success: function(response)
|
||||
{
|
||||
success=response.success;
|
||||
},
|
||||
async:false,
|
||||
dataType: 'json'
|
||||
}).responseText).success;
|
||||
}, '<?php echo $this->lang->line("recvs_invoice_number_duplicate"); ?>');
|
||||
|
||||
$('#datetime').datetimepicker({
|
||||
dateFormat: '<?php echo dateformat_jquery($this->config->item("dateformat"));?>',
|
||||
timeFormat: '<?php echo dateformat_jquery($this->config->item("timeformat"));?>'
|
||||
@@ -144,14 +126,28 @@ $(document).ready(function()
|
||||
rules:
|
||||
{
|
||||
invoice_number: {
|
||||
invoice_number: true
|
||||
|
||||
remote:
|
||||
{
|
||||
url: "<?php echo site_url($controller_name . '/check_invoice_number')?>",
|
||||
type: "POST",
|
||||
data:
|
||||
{
|
||||
"receiving_id" : <?php echo $receiving_info['receiving_id']; ?>,
|
||||
"invoice_number" : function()
|
||||
{
|
||||
return $("#invoice_number").val();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
messages:
|
||||
{
|
||||
|
||||
invoice_number: '<?php echo $this->lang->line("recvs_invoice_number_duplicate"); ?>'
|
||||
}
|
||||
});
|
||||
|
||||
$('#recvs_delete_form').submit(function()
|
||||
{
|
||||
var id = $("input[name='receiving_id']").val();
|
||||
|
||||
@@ -90,22 +90,6 @@ $(document).ready(function()
|
||||
});
|
||||
<?php endif; ?>
|
||||
|
||||
$.validator.addMethod("invoice_number", function(value, element)
|
||||
{
|
||||
return JSON.parse($.ajax(
|
||||
{
|
||||
type: 'POST',
|
||||
url: '<?php echo site_url($controller_name . "/check_invoice_number")?>',
|
||||
data: {'sale_id' : <?php echo $sale_info['sale_id']; ?>, 'invoice_number' : $(element).val() },
|
||||
success: function(response)
|
||||
{
|
||||
success=response.success;
|
||||
},
|
||||
async:false,
|
||||
dataType: 'json'
|
||||
}).responseText).success;
|
||||
}, '<?php echo $this->lang->line("sales_invoice_number_duplicate"); ?>');
|
||||
|
||||
$('#datetime').datetimepicker({
|
||||
dateFormat: '<?php echo dateformat_jquery($this->config->item("dateformat"));?>',
|
||||
timeFormat: '<?php echo dateformat_jquery($this->config->item("timeformat"));?>'
|
||||
@@ -166,12 +150,24 @@ $(document).ready(function()
|
||||
{
|
||||
invoice_number:
|
||||
{
|
||||
invoice_number: true
|
||||
remote:
|
||||
{
|
||||
url: "<?php echo site_url($controller_name . '/check_invoice_number')?>",
|
||||
type: "POST",
|
||||
data:
|
||||
{
|
||||
"sale_id" : <?php echo $sale_info['sale_id']; ?>,
|
||||
"invoice_number" : function()
|
||||
{
|
||||
return $("#invoice_number").val();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
messages:
|
||||
{
|
||||
|
||||
invoice_number: '<?php echo $this->lang->line("sales_invoice_number_duplicate"); ?>'
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"jKey": "https://github.com/OscarGodson/jKey",
|
||||
"jquery-bgiframe": "~3.0.1",
|
||||
"jquery-color": "~2.1.2",
|
||||
"jquery-form": "~3.46.0",
|
||||
"jquery-validate": "~1.13.1",
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long.
Vendored
-10
@@ -1,10 +0,0 @@
|
||||
/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net)
|
||||
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
||||
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
||||
*
|
||||
* $LastChangedDate: 2007-07-22 01:45:56 +0200 (Son, 22 Jul 2007) $
|
||||
* $Rev: 2447 $
|
||||
*
|
||||
* Version 2.1.1
|
||||
*/
|
||||
(function($){$.fn.bgIframe=$.fn.bgiframe=function(s){if($.browser.msie&&/6.0/.test(navigator.userAgent)){s=$.extend({top:'auto',left:'auto',width:'auto',height:'auto',opacity:true,src:'javascript:false;'},s||{});var prop=function(n){return n&&n.constructor==Number?n+'px':n;},html='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+'style="display:block;position:absolute;z-index:-1;'+(s.opacity!==false?'filter:Alpha(Opacity=\'0\');':'')+'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+'"/>';return this.each(function(){if($('> iframe.bgiframe',this).length==0)this.insertBefore(document.createElement(html),this.firstChild);});}return this;};})(jQuery);
|
||||
Reference in new issue
Block a user