return $rc;
}
-sub has_storno {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $form) = @_;
-
- $main::lxdebug->leave_sub() and return 0 unless ($form->{id});
-
- my $dbh = $form->dbconnect($myconfig);
-
- my $query = qq|SELECT storno FROM ap WHERE id = ?|;
- my ($result) = selectrow_query($form, $dbh, $query, $form->{id});
-
- $dbh->disconnect();
-
- $main::lxdebug->leave_sub();
-
- return $result;
-}
-
1;
sub has_storno {
$main::lxdebug->enter_sub();
- my ($self, $myconfig, $form) = @_;
+ my ($self, $myconfig, $form, $table) = @_;
$main::lxdebug->leave_sub() and return 0 unless ($form->{id});
my $dbh = $form->dbconnect($myconfig);
- my $query = qq|SELECT storno FROM ar WHERE id = ?|;
+ my $query = qq|SELECT storno FROM $table WHERE id = ?|;
my ($result) = selectrow_query($form, $dbh, $query, $form->{id});
$dbh->disconnect();
#======================================================================
use SL::IR;
+use SL::IS;
use SL::PE;
require "$form->{path}/io.pl";
$form->error($locale->text('Cannot storno storno invoice!'));
}
- if (IR->has_storno(\%myconfig, $form)) {
+ if (IS->has_storno(\%myconfig, $form, "ap")) {
$form->error($locale->text("Invoice has already been storno'd!"));
}
$form->error($locale->text('Cannot storno storno invoice!'));
}
- if (IS->has_storno(\%myconfig, $form)) {
+ if (IS->has_storno(\%myconfig, $form, "ar")) {
$form->error($locale->text("Invoice has already been storno'd!"));
}