X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=inline;f=bin%2Fmozilla%2Fcommon.pl;h=d006c5436e12ef8e36540b56744cebeb9c709315;hb=b6133a726fa261cb97f2c105ea4a93161609d6ca;hp=7f557fb435a2d5563730d33a251e98da5e763c96;hpb=0c27df9b59417fcef923f18f6c33d6190dd94fa9;p=kivitendo-erp.git diff --git a/bin/mozilla/common.pl b/bin/mozilla/common.pl index 7f557fb43..d006c5436 100644 --- a/bin/mozilla/common.pl +++ b/bin/mozilla/common.pl @@ -10,37 +10,8 @@ ###################################################################### use SL::Form; -use YAML; - use SL::Common; - -sub save_form { - $lxdebug->enter_sub(); - - my $old_form = YAML::Dump($form); - $old_form =~ s|!|!!|g; - $old_form =~ s|\n|!n|g; - $old_form =~ s|\r|!r|g; - - $lxdebug->leave_sub(); - - return $old_form; -} - -sub restore_form { - $lxdebug->enter_sub(); - - my ($old_form, $no_delete) = @_; - - map({ delete($form->{$_}); } keys(%{$form})) unless ($no_delete); - $old_form =~ s|!r|\r|g; - $old_form =~ s|!n|\n|g; - $old_form =~ s|!!|!|g; - my $new_form = YAML::Load($old_form); - map({ $form->{$_} = $new_form->{$_}; } keys(%{$new_form})); - - $lxdebug->leave_sub(); -} +use SL::MoreCommon; sub build_std_url { $lxdebug->enter_sub(); @@ -197,7 +168,7 @@ sub part_selection_internal { my $callback = "$form->{script}?action=part_selection_internal&"; map({ $callback .= "$_=" . $form->escape($form->{$_}) . "&" } - (qw(login path password partnumber description input_partnumber input_description input_partsid), grep({ /^[fl]_/ } keys %$form))); + (qw(login password partnumber description input_partnumber input_description input_partsid), grep({ /^[fl]_/ } keys %$form))); my @header_sort = qw(partnumber description); my %header_title = ( "partnumber" => $locale->text("Part Number"), @@ -238,7 +209,7 @@ sub project_selection_internal { my $callback = "$form->{script}?action=project_selection_internal&"; map({ $callback .= "$_=" . $form->escape($form->{$_}) . "&" } - (qw(login path password projectnumber description input_projectnumber input_description input_project_id), grep({ /^[fl]_/ } keys %$form))); + (qw(login password projectnumber description input_projectnumber input_description input_project_id), grep({ /^[fl]_/ } keys %$form))); my @header_sort = qw(projectnumber description); my %header_title = ( "projectnumber" => $locale->text("Project Number"), @@ -279,7 +250,7 @@ sub employee_selection_internal { my $callback = "$form->{script}?action=employee_selection_internal&"; map({ $callback .= "$_=" . $form->escape($form->{$_}) . "&" } - (qw(login path password name input_name input_id), grep({ /^[fl]_/ } keys %$form))); + (qw(login password name input_name input_id), grep({ /^[fl]_/ } keys %$form))); my @header_sort = qw(name); my %header_title = ( "name" => $locale->text("Name"), @@ -319,7 +290,7 @@ sub delivery_customer_selection { my $callback = "$form->{script}?action=delivery_customer_selection&"; map({ $callback .= "$_=" . $form->escape($form->{$_}) . "&" } - (qw(login path password name input_name input_id), grep({ /^[fl]_/ } keys %$form))); + (qw(login password name input_name input_id), grep({ /^[fl]_/ } keys %$form))); my @header_sort = qw(name customernumber address); my %header_title = ( "name" => $locale->text("Name"), @@ -361,7 +332,7 @@ sub vendor_selection { my $callback = "$form->{script}?action=vendor_selection&"; map({ $callback .= "$_=" . $form->escape($form->{$_}) . "&" } - (qw(login path password name input_name input_id), grep({ /^[fl]_/ } keys %$form))); + (qw(login password name input_name input_id), grep({ /^[fl]_/ } keys %$form))); my @header_sort = qw(name customernumber address); my %header_title = ( "name" => $locale->text("Name"), @@ -437,7 +408,7 @@ sub set_longdescription { my $callback = "$form->{script}?action=set_longdescription&"; map({ $callback .= "$_=" . $form->escape($form->{$_}) . "&" } - (qw(login path password name input_name input_id), grep({ /^[fl]_/ } keys %$form))); + (qw(login password name input_name input_id), grep({ /^[fl]_/ } keys %$form))); $form->{"title"} = $locale->text("Enter longdescription"); $form->header(); @@ -538,12 +509,16 @@ sub reformat_numbers { sub show_history { $lxdebug->enter_sub(); my $dbh = $form->dbconnect(\%myconfig); - + my ($sort, $sortby) = split(/\-\-/, $form->{order}); + $sort =~ s/.*\.(.*)/$1/; + $form->{title} = $locale->text("History"); $form->header(); print $form->parse_html_template( "common/show_history", { - "DATEN" => $form->get_history($dbh,$form->{input_name}), - "SUCCESS" => ($form->get_history($dbh,$form->{input_name}) ne "0") + "DATEN" => $form->get_history($dbh,$form->{input_name},"",$form->{order}), + "SUCCESS" => ($form->get_history($dbh,$form->{input_name}) ne "0"), + uc($sort) => 1, + uc($sort)."BY" => $sortby } ); $dbh->disconnect(); @@ -590,4 +565,30 @@ sub show_vc_details { $lxdebug->leave_sub(); } +sub mark_as_paid_common { + $lxdebug->enter_sub(); + use SL::DBUtils; + my ($myconfig, $db_name) = @_; + + if($form->{mark_as_paid}) { + my $dbh ||= $form->get_standard_dbh($myconfig); + my $query = qq|UPDATE $db_name SET paid = amount WHERE id = ?|; + do_query($form, $dbh, $query, $form->{id}); + $dbh->commit(); + $form->redirect($locale->text("Marked as paid")); +} + else { + my $referer = $ENV{HTTP_REFERER}; + $referer =~ s/^(.*)action\=.*\&(.*)$/$1action\=mark_as_paid\&mark_as_paid\=1\&login\=$form->{login}\&password\=$form->{password}\&id\=$form->{id}\&$2/; + $form->header(); + print qq|
|; + print qq||.$locale->text('Mark as paid?').qq|
|; + print qq| |; + print qq||; + print qq|