From: Moritz Bunkus Date: Mon, 5 Mar 2007 16:21:03 +0000 (+0000) Subject: Codeduplikation vermeiden. X-Git-Tag: release-2.4.3^2~627 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=a1a3bfd84dbda57fe1c7a9d581a599067557ff7a;p=kivitendo-erp.git Codeduplikation vermeiden. --- diff --git a/SL/IR.pm b/SL/IR.pm index 553e7828f..885fb9e91 100644 --- a/SL/IR.pm +++ b/SL/IR.pm @@ -1425,23 +1425,4 @@ sub post_payment { 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; diff --git a/SL/IS.pm b/SL/IS.pm index e5d61193d..6b9018d95 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -2226,13 +2226,13 @@ sub get_pricegroups_for_parts { 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(); diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl index f5fd32f58..04ca53ee4 100644 --- a/bin/mozilla/ir.pl +++ b/bin/mozilla/ir.pl @@ -32,6 +32,7 @@ #====================================================================== use SL::IR; +use SL::IS; use SL::PE; require "$form->{path}/io.pl"; @@ -972,7 +973,7 @@ sub storno { $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!")); } diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index f36c8f2d0..3f22e6d23 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -1518,7 +1518,7 @@ sub storno { $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!")); }