Revision 59adfa36
Von Moritz Bunkus vor fast 8 Jahren hinzugefügt
bin/mozilla/common.pl | ||
---|---|---|
333 | 333 |
|
334 | 334 |
# ------------------------------------------------------------------------- |
335 | 335 |
|
336 |
sub mark_as_paid_common { |
|
337 |
$main::lxdebug->enter_sub(); |
|
338 |
|
|
339 |
my ($myconfig, $db_name) = @_; |
|
340 |
|
|
341 |
my $form = $main::form; |
|
342 |
my $locale = $main::locale; |
|
343 |
|
|
344 |
if($form->{mark_as_paid}) { |
|
345 |
SL::DB->client->with_transaction(sub { |
|
346 |
my $dbh ||= SL::DB->client->dbh; |
|
347 |
my $query = qq|UPDATE $db_name SET paid = amount, datepaid = current_date WHERE id = ?|; |
|
348 |
do_query($form, $dbh, $query, $form->{id}); |
|
349 |
1; |
|
350 |
}) or do { $::form->error(SL::DB->client->error) }; |
|
351 |
$form->redirect($locale->text("Marked as paid")); |
|
352 |
|
|
353 |
} else { |
|
354 |
my $referer = $ENV{HTTP_REFERER}; |
|
355 |
my $script; |
|
356 |
my $callback; |
|
357 |
if ($referer =~ /action/) { |
|
358 |
$referer =~ /^(.*)\?action\=[^\&]*(\&.*)$/; |
|
359 |
$script = $1; |
|
360 |
$callback = $2; |
|
361 |
} elsif ($referer =~ /RESTORE_FORM_FROM_SESSION_ID/){ |
|
362 |
$referer =~ /^(.*)\?RESTORE_FORM_FROM_SESSION_ID\=(.*)$/; |
|
363 |
$script = $1; |
|
364 |
$callback = ""; |
|
365 |
} else { |
|
366 |
$script = $referer; |
|
367 |
$callback = ""; |
|
368 |
} |
|
369 |
$referer = $script . "?action=mark_as_paid&mark_as_paid=1&id=$form->{id}" . $callback; |
|
370 |
$form->header(); |
|
371 |
print qq|<p><b>|.$locale->text('Mark as paid?').qq|</b></p>|; |
|
372 |
print qq|<input type="button" value="|.$locale->text('yes').qq|" onclick="document.location.href='|.$referer.qq|'"> |; |
|
373 |
print qq|<input type="button" value="|.$locale->text('no').qq|" onclick="javascript:history.back();">|; |
|
374 |
} |
|
375 |
|
|
376 |
$main::lxdebug->leave_sub(); |
|
377 |
} |
|
378 |
|
|
379 | 336 |
sub cov_selection_internal { |
380 | 337 |
$main::lxdebug->enter_sub(); |
381 | 338 |
|
Auch abrufbar als: Unified diff
Alle Rechnungen: »als bezahlt markieren« auf neue Funktionen in SL::DB::(Purchase)Invoice umgestellt