}
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 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 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|'"> |;
- 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 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 {
use SL::DB::Default;
use SL::DB::Customer;
+use SL::DB::Invoice;
use SL::DB::PaymentTerm;
require "bin/mozilla/io.pl";
}
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 {
'Margetotal' => 'Ertrag',
'Margins' => 'Seitenrä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',
'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',
[%- 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 %]
[% 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>
<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 %]
[%#- 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 %]