X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fcommon.pl;h=d01d19f58d0bc96cbc9914df51eb7ef8f8c14c47;hb=f7b15d4334848fad1bcd0b569eff5139f9a6ba4d;hp=59c2f9481671e2090b4b05617a31b2a9f109eb21;hpb=fc41222c61dbee590005f04c50e8603581462543;p=kivitendo-erp.git diff --git a/bin/mozilla/common.pl b/bin/mozilla/common.pl index 59c2f9481..d01d19f58 100644 --- a/bin/mozilla/common.pl +++ b/bin/mozilla/common.pl @@ -11,10 +11,10 @@ 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; @@ -343,21 +343,6 @@ sub calculate_qty { # ------------------------------------------------------------------------- -sub set_longdescription { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my $locale = $main::locale; - - $form->{title} = $locale->text("Enter longdescription"); - $form->header(no_layout => 1); - print $form->parse_html_template("generic/set_longdescription"); - - $main::lxdebug->leave_sub(); -} - -# ------------------------------------------------------------------------- - sub H { return $main::locale->quote_special_chars('HTML', $_[0]); } @@ -400,11 +385,23 @@ 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%' ) "; + } elsif ( $form->{trans_id_type} eq 'id' ) { + $restriction = " AND ( snumbers NOT LIKE 'invnumber_%' AND snumbers NOT LIKE 'gltransaction%' AND (what_done NOT LIKE '%Buchungsnummer%' OR what_done IS null))"; + } else { + $restriction = ''; + }; + print $form->parse_html_template( "common/show_history", { - "DATEN" => $form->get_history($dbh,$form->{input_name},"",$form->{order}), + "DATEN" => $form->get_history($dbh,$form->{input_name},$restriction,$form->{order}), "SUCCESS" => ($form->get_history($dbh,$form->{input_name}) ne "0"), uc($sort) => 1, uc($sort)."BY" => $sortby, + callback => $callback, } ); $dbh->disconnect(); @@ -455,6 +452,7 @@ sub show_vc_details { $locale->text("No vendor has been selected yet.")); Common->get_vc_details(\%myconfig, $form, $form->{vc}, $form->{vc_id}); + $form->{discount_as_percent} = $form->format_amount(\%::myconfig, $form->parse_amount(\%::myconfig, $form->{discount}) * 100, 2); $form->{title} = $form->{vc} eq "customer" ? $locale->text("Customer details") : $locale->text("Vendor details"); @@ -496,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 { @@ -510,6 +510,10 @@ sub mark_as_paid_common { $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 = "";