From 5ceaf343f897027dff7edcde6315824b8dc64db7 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 5 Mar 2007 14:49:19 +0000 Subject: [PATCH] =?utf8?q?Definitiv=20verhindern,=20dass=20Einkaufsrechnun?= =?utf8?q?gen=20doppelt=20storniert=20werden=20k=C3=B6nnen.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/IR.pm | 19 +++++++++++++++++++ bin/mozilla/ir.pl | 4 ++++ locale/de/ir | 1 + 3 files changed, 24 insertions(+) diff --git a/SL/IR.pm b/SL/IR.pm index 3bad7ce05..dc582efb5 100644 --- a/SL/IR.pm +++ b/SL/IR.pm @@ -1423,4 +1423,23 @@ 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/bin/mozilla/ir.pl b/bin/mozilla/ir.pl index 63325ca02..e088def44 100644 --- a/bin/mozilla/ir.pl +++ b/bin/mozilla/ir.pl @@ -972,6 +972,10 @@ sub storno { $form->error($locale->text('Cannot storno storno invoice!')); } + if (IR->has_storno(\%myconfig, $form)) { + $form->error($locale->text("Invoice has already been storno'd!")); + } + $form->{storno_id} = $form->{id}; $form->{storno} = 1; $form->{id} = ""; diff --git a/locale/de/ir b/locale/de/ir index 02181d1c6..e9e8ca800 100644 --- a/locale/de/ir +++ b/locale/de/ir @@ -81,6 +81,7 @@ $self->{texts} = { 'Invoice Number' => 'Rechnungsnummer', 'Invoice Number missing!' => 'Rechnungsnummer fehlt!', 'Invoice deleted!' => 'Rechnung gelöscht!', + 'Invoice has already been storno\'d!' => 'Diese Rechnung wurde bereits storniert.', 'Item not on file!' => 'Dieser Artikel ist nicht in der Datenbank!', 'Jan' => 'Jan', 'January' => 'Januar', -- 2.20.1