1 package SL::Controller::SalesPurchase;
4 use parent qw(SL::Controller::Base);
6 use SL::DB::PurchaseInvoice;
10 sub action_check_duplicate_invnumber {
13 croak("no invnumber") unless $::form->{invnumber};
14 croak("no vendor") unless $::form->{vendor_id};
16 my $exists_ap = SL::DB::Manager::PurchaseInvoice->find_by(
17 invnumber => $::form->{invnumber},
18 vendor_id => $::form->{vendor_id},
21 $_[0]->render(\ !!$exists_ap, { type => 'text' });
32 SL::Controller::SalesPurchase - Controller for JS driven actions
36 Generic Controller Class for validation function
42 =item C<action_check_duplicate_invnumber>
44 Needs C<form.invnumber> and C<form.vendor_id>
46 Returns true if a credit record with this invnumber for this vendor
53 data: { action: 'SalesPurchase/check_duplicate_invnumber',
54 vendor_id : $('#vendor_id').val(),
55 invnumber : $('#invnumber').val()
60 success: function(val) {
61 exists_invnumber = val;