Ungenutzte Funktion parts_subtotal in ic.pl entfernt
[kivitendo-erp.git] / bin / mozilla / common.pl
index 9756f92..d01d19f 100644 (file)
 
 use SL::Common;
 use SL::DB::Helper::Mappings;
-use SL::DBUtils;
+use SL::DB;
+use SL::DBUtils qw(do_query);
 use SL::Form;
-use SL::MoreCommon;
-use SL::Helper::Flash;
+use SL::MoreCommon qw(restore_form save_form);
 
 use strict;
 
@@ -386,6 +386,7 @@ sub show_history {
   $form->{title} = $locale->text("History");
   $form->header(no_layout => 1);
 
+  my $callback = build_std_url(qw(action longdescription trans_id_type input_name));
   my $restriction;
   if ( $form->{trans_id_type} eq 'glid' ) {
     $restriction = "AND ( snumbers LIKE 'invnumber%' OR what_done LIKE '%Buchungsnummer%' OR snumbers LIKE 'gltransaction%' ) ";
@@ -400,6 +401,7 @@ sub show_history {
     "SUCCESS"      => ($form->get_history($dbh,$form->{input_name}) ne "0"),
     uc($sort)      => 1,
     uc($sort)."BY" => $sortby,
+    callback       => $callback,
   } );
 
   $dbh->disconnect();
@@ -492,10 +494,12 @@ sub mark_as_paid_common {
   my $locale   = $main::locale;
 
   if($form->{mark_as_paid}) {
-    my $dbh ||= $form->get_standard_dbh($myconfig);
-    my $query = qq|UPDATE $db_name SET paid = amount, datepaid = current_date WHERE id = ?|;
-    do_query($form, $dbh, $query, $form->{id});
-    $dbh->commit();
+    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 {