]> wagnertech.de Git - kivitendo-erp.git/commitdiff
Codeduplikation vermeiden.
authorMoritz Bunkus <m.bunkus@linet-services.de>
Mon, 5 Mar 2007 16:21:03 +0000 (16:21 +0000)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Mon, 5 Mar 2007 16:21:03 +0000 (16:21 +0000)
SL/IR.pm
SL/IS.pm
bin/mozilla/ir.pl
bin/mozilla/is.pl

index 553e7828fb3735543dbf7820a36e1b03f54acb2b..885fb9e911a5265ca2bf10736b50e72a42d68103 100644 (file)
--- 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;
index e5d61193d0b12ec6450e330f77b0ce9e3b0317e2..6b9018d95aaa68f39d0d5dbe326836b3d3acb2fe 100644 (file)
--- 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();
index f5fd32f58d5f55033cf48f7adc2fc9a348495813..04ca53ee46202a369c7ded891a1ef612a52ebc2e 100644 (file)
@@ -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!"));
   }
 
index f36c8f2d0409706f31fe37825c8db6226e536661..3f22e6d231b77edee129cbbd8a0d8f61fba94c4d 100644 (file)
@@ -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!"));
   }