]> wagnertech.de Git - kivitendo-erp.git/commitdiff
Alle Rechnungen: »als bezahlt markieren« auf neue Funktionen in SL::DB::(Purchase...
authorMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 18 Jan 2017 09:57:54 +0000 (10:57 +0100)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 18 Jan 2017 09:57:54 +0000 (10:57 +0100)
bin/mozilla/ap.pl
bin/mozilla/ar.pl
bin/mozilla/common.pl
bin/mozilla/ir.pl
bin/mozilla/is.pl
locale/de/all
templates/webpages/ap/form_footer.html
templates/webpages/ar/form_footer.html
templates/webpages/ir/form_footer.html
templates/webpages/is/form_footer.html

index 765c2c06de75a1bc344f3932c56ca49e1200e66a..dc02d137bbe825d1f652aca1aa6a95f2a57c555f 100644 (file)
@@ -470,16 +470,11 @@ sub form_footer {
 }
 
 sub mark_as_paid {
 }
 
 sub mark_as_paid {
-  $main::lxdebug->enter_sub();
-
-  my $form     = $main::form;
-  my %myconfig = %main::myconfig;
-
-  $main::auth->assert('ap_transactions');
+  $::auth->assert('ap_transactions');
 
 
-  &mark_as_paid_common(\%myconfig,"ap");
+  SL::DB::PurchaseInvoice->new(id => $::form->{id})->load->mark_as_paid;
 
 
-  $main::lxdebug->leave_sub();
+  $::form->redirect($::locale->text("Marked as paid"));
 }
 
 sub show_draft {
 }
 
 sub show_draft {
index 9416ac70350f3a50a097c48cda79014b6a8c5744..dc7074c615c51de3ebe4558dae70d2ac0f3ca83a 100644 (file)
@@ -443,16 +443,11 @@ sub form_footer {
 }
 
 sub mark_as_paid {
 }
 
 sub mark_as_paid {
-  $main::lxdebug->enter_sub();
+  $::auth->assert('ar_transactions');
 
 
-  $main::auth->assert('ar_transactions');
+  SL::DB::Invoice->new(id => $::form->{id})->load->mark_as_paid;
 
 
-  my $form     = $main::form;
-  my %myconfig = %main::myconfig;
-
-  &mark_as_paid_common(\%myconfig,"ar");
-
-  $main::lxdebug->leave_sub();
+  $::form->redirect($::locale->text("Marked as paid"));
 }
 
 sub show_draft {
 }
 
 sub show_draft {
index 52366a0e3e79bab343961d0ee92eb07a177393be..8e77f6309039916e616533adc65bf96d8b80b0ef 100644 (file)
@@ -333,49 +333,6 @@ sub retrieve_partunits {
 
 # -------------------------------------------------------------------------
 
 
 # -------------------------------------------------------------------------
 
-sub mark_as_paid_common {
-  $main::lxdebug->enter_sub();
-
-  my ($myconfig, $db_name) = @_;
-
-  my $form     = $main::form;
-  my $locale   = $main::locale;
-
-  if($form->{mark_as_paid}) {
-    SL::DB->client->with_transaction(sub {
-      my $dbh ||= SL::DB->client->dbh;
-      my $query = qq|UPDATE $db_name SET paid = amount, datepaid = current_date WHERE id = ?|;
-      do_query($form, $dbh, $query, $form->{id});
-      1;
-    }) or do { $::form->error(SL::DB->client->error) };
-    $form->redirect($locale->text("Marked as paid"));
-
-  } else {
-    my $referer = $ENV{HTTP_REFERER};
-    my $script;
-    my $callback;
-    if ($referer =~ /action/) {
-      $referer =~ /^(.*)\?action\=[^\&]*(\&.*)$/;
-      $script = $1;
-      $callback = $2;
-    } elsif ($referer =~ /RESTORE_FORM_FROM_SESSION_ID/){
-      $referer =~ /^(.*)\?RESTORE_FORM_FROM_SESSION_ID\=(.*)$/;
-      $script = $1;
-      $callback = "";
-    } else {
-      $script = $referer;
-      $callback = "";
-    }
-    $referer = $script . "?action=mark_as_paid&mark_as_paid=1&id=$form->{id}" . $callback;
-    $form->header();
-    print qq|<p><b>|.$locale->text('Mark as paid?').qq|</b></p>|;
-    print qq|<input type="button" value="|.$locale->text('yes').qq|" onclick="document.location.href='|.$referer.qq|'">&nbsp;|;
-    print qq|<input type="button" value="|.$locale->text('no').qq|" onclick="javascript:history.back();">|;
-  }
-
-  $main::lxdebug->leave_sub();
-}
-
 sub cov_selection_internal {
   $main::lxdebug->enter_sub();
 
 sub cov_selection_internal {
   $main::lxdebug->enter_sub();
 
index 19b4f74a165f763b0cddff3983a2b2acfd9e5e35..d4a42a78d45029b098e259b507834798d1a08564 100644 (file)
@@ -468,16 +468,11 @@ sub form_footer {
 }
 
 sub mark_as_paid {
 }
 
 sub mark_as_paid {
-  $main::lxdebug->enter_sub();
-
-  my $form     = $main::form;
-  my %myconfig = %main::myconfig;
-
-  $main::auth->assert('vendor_invoice_edit');
+  $::auth->assert('vendor_invoice_edit');
 
 
-  &mark_as_paid_common(\%myconfig,"ap");
+  SL::DB::PurchaseInvoice->new(id => $::form->{id})->load->mark_as_paid;
 
 
-  $main::lxdebug->leave_sub();
+  $::form->redirect($::locale->text("Marked as paid"));
 }
 
 sub show_draft {
 }
 
 sub show_draft {
index 4007f8d3b302464d860834c043bc050d5a67f537..5db9b9cf1dbaacab10ea4086052fa7ccca9a0fc3 100644 (file)
@@ -45,6 +45,7 @@ use English qw(-no_match_vars);
 
 use SL::DB::Default;
 use SL::DB::Customer;
 
 use SL::DB::Default;
 use SL::DB::Customer;
+use SL::DB::Invoice;
 use SL::DB::PaymentTerm;
 
 require "bin/mozilla/io.pl";
 use SL::DB::PaymentTerm;
 
 require "bin/mozilla/io.pl";
@@ -535,16 +536,11 @@ sub form_footer {
 }
 
 sub mark_as_paid {
 }
 
 sub mark_as_paid {
-  $main::lxdebug->enter_sub();
-
-  my $form     = $main::form;
-  my %myconfig = %main::myconfig;
-
-  $main::auth->assert('invoice_edit');
+  $::auth->assert('invoice_edit');
 
 
-  &mark_as_paid_common(\%myconfig,"ar");
+  SL::DB::Invoice->new(id => $::form->{id})->load->mark_as_paid;
 
 
-  $main::lxdebug->leave_sub();
+  $::form->redirect($::locale->text("Marked as paid"));
 }
 
 sub show_draft {
 }
 
 sub show_draft {
index 688086ae4d2d0a6f276c6f3ff79305c2ce95917a..f74e59bd746937770ddb6f30752f18f6daded72b 100755 (executable)
@@ -1711,7 +1711,6 @@ $self->{texts} = {
   'Margetotal'                  => 'Ertrag',
   'Margins'                     => 'Seitenr&auml;nder',
   'Mark as closed'              => 'Abschließen',
   'Margetotal'                  => 'Ertrag',
   'Margins'                     => 'Seitenr&auml;nder',
   'Mark as closed'              => 'Abschließen',
-  'Mark as paid?'               => 'Als bezahlt markieren?',
   'Mark as shop article if column missing' => 'Als Shopartikel setzen, falls Spalte nicht vorhanden',
   'Mark closed'                 => 'Als geschlossen markieren',
   'Marked as paid'              => 'Als bezahlt markiert',
   'Mark as shop article if column missing' => 'Als Shopartikel setzen, falls Spalte nicht vorhanden',
   'Mark closed'                 => 'Als geschlossen markieren',
   'Marked as paid'              => 'Als bezahlt markiert',
@@ -3230,6 +3229,7 @@ $self->{texts} = {
   'This will be treated as a discount in percent points.' => 'Diese Option schlägt den Wert in Prozentpunkten als Rabatt vor.',
   'This will happen before the price is offered, and the reduction will not be printed in documents.' => 'Das passiert, bevor der Preis vorgeschlagen wird, und der Abschlag wird nicht in Belegen ausgewiesen.',
   'This will reduce the appropriate Master Data price by this in percent points.' => 'Diese Option reduziert den zugehörigen Stammdatenpreis um den angegebenen Wert in Prozentpunkten.',
   'This will be treated as a discount in percent points.' => 'Diese Option schlägt den Wert in Prozentpunkten als Rabatt vor.',
   'This will happen before the price is offered, and the reduction will not be printed in documents.' => 'Das passiert, bevor der Preis vorgeschlagen wird, und der Abschlag wird nicht in Belegen ausgewiesen.',
   'This will reduce the appropriate Master Data price by this in percent points.' => 'Diese Option reduziert den zugehörigen Stammdatenpreis um den angegebenen Wert in Prozentpunkten.',
+  'This will remove the invoice from showing as unpaid even if the unpaid amount does not match the amount. Proceed?' => 'Dies wird die Rechnung nicht mehr als offen anzeigen, auch wenn der unbezahlte Betrag nicht dem Rechnungsbetrag entspricht. Fortfahren?',
   'This will set an exact price.' => 'Diese Option setzt einen festen Preis.',
   'Three Options:'              => 'Drei Optionen:',
   'Time'                        => 'Zeit',
   'This will set an exact price.' => 'Diese Option setzt einen festen Preis.',
   'Three Options:'              => 'Drei Optionen:',
   'Time'                        => 'Zeit',
index c3611a207251925007ea0fc92271a28524a7bf76..0d948d2a500ecc7cd6a8dc23693cf84abd150bce 100644 (file)
@@ -38,7 +38,7 @@
 [%- IF id %]
   <input type=button class=submit onclick="set_history_window([% id %], 'glid');" name="history" id="history" value="[% 'history' | $T8 %]">
   [% IF INSTANCE_CONF.get_ap_show_mark_as_paid %]
 [%- IF id %]
   <input type=button class=submit onclick="set_history_window([% id %], 'glid');" name="history" id="history" value="[% 'history' | $T8 %]">
   [% IF INSTANCE_CONF.get_ap_show_mark_as_paid %]
-    <input type="submit" name="action" value="[% 'mark as paid' | $T8 %]">
+    [% L.submit_tag("action", LxERP.t8('mark as paid'), confirm=LxERP.t8('This will remove the invoice from showing as unpaid even if the unpaid amount does not match the amount. Proceed?')) %]
   [% END %]
 [%- END %]
 
   [% END %]
 [%- END %]
 
index 5ce251c398568a7b121b4b882f2101ca05204fb9..484985cae67c512b998ba9a010aaa302dbfc05ab 100644 (file)
@@ -40,7 +40,7 @@
   [% END %]
 
   [% IF ( show_mark_as_paid_button ) %]
   [% END %]
 
   [% IF ( show_mark_as_paid_button ) %]
-    <input type="submit" class="submit" name="action" value="[% 'mark as paid' | $T8 %]">
+    [% L.submit_tag("action", LxERP.t8('mark as paid'), confirm=LxERP.t8('This will remove the invoice from showing as unpaid even if the unpaid amount does not match the amount. Proceed?')) %]
   [% END %]
 
 </form>
   [% END %]
 
 </form>
index 67a49a5a28ea9437a489f5f8c4d431d72f8e08c5..f07a2b81019a65311fb9ded3fb348d1b81327de8 100644 (file)
       <input type="button" class="submit" onclick="set_history_window([% id | html %], 'glid');" name="history" id="history" value="[% 'history' | $T8 %]">
 
       [% IF INSTANCE_CONF.get_ir_show_mark_as_paid %]
       <input type="button" class="submit" onclick="set_history_window([% id | html %], 'glid');" name="history" id="history" value="[% 'history' | $T8 %]">
 
       [% IF INSTANCE_CONF.get_ir_show_mark_as_paid %]
-          <input type="submit" class="submit" name="action" value="[% 'mark as paid' | $T8 %]">
+        [% L.submit_tag("action", LxERP.t8('mark as paid'), confirm=LxERP.t8('This will remove the invoice from showing as unpaid even if the unpaid amount does not match the amount. Proceed?')) %]
       [% END %]
   [% END %]
 
       [% END %]
   [% END %]
 
index caadf3e858e7df4f614f88be56c0ee2fca409bd5..912218a4829bc38dcdd186ac0ade425fa1efcfb1 100644 (file)
       [%#- button for saving history %]
       <input type="button" class="submit" onclick="set_history_window([% id | html %], 'glid');" name="history" id="history" value="[% 'history' | $T8 %]">
       [% IF INSTANCE_CONF.get_is_show_mark_as_paid %]
       [%#- button for saving history %]
       <input type="button" class="submit" onclick="set_history_window([% id | html %], 'glid');" name="history" id="history" value="[% 'history' | $T8 %]">
       [% IF INSTANCE_CONF.get_is_show_mark_as_paid %]
-          <input type="submit" class="submit" name="action_mark_as_paid" value="[% 'mark as paid' | $T8 %]">
+        [% L.submit_tag("action_mark_as_paid", LxERP.t8('mark as paid'), confirm=LxERP.t8('This will remove the invoice from showing as unpaid even if the unpaid amount does not match the amount. Proceed?')) %]
       [% END %]
   [% END %]
 
       [% END %]
   [% END %]