X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fap.pl;h=3bbe8dcb9a696d82b372804dc476dbb0bd9b5bc0;hb=357d134d265637fb37ed2cd47da2ce3ef44d015a;hp=8c55a3d9cd29b536bd169fae1e344ba8791ce2d1;hpb=8d771986641efbc83911b0ba007e6c240daea550;p=kivitendo-erp.git diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl index 8c55a3d9c..3bbe8dcb9 100644 --- a/bin/mozilla/ap.pl +++ b/bin/mozilla/ap.pl @@ -40,6 +40,7 @@ use SL::IR; use SL::IS; use SL::PE; use SL::ReportGenerator; +use SL::DB::Default; require "bin/mozilla/arap.pl"; require "bin/mozilla/common.pl"; @@ -152,30 +153,22 @@ sub create_links { # build the popup menus $form->{taxincluded} = ($form->{id}) ? $form->{taxincluded} : "checked"; - # notes - $form->{notes} = $form->{intnotes} unless $form->{notes}; - # currencies $form->{defaultcurrency} = $form->get_default_currency(\%myconfig); - map { $form->{selectcurrency} .= "$_\n" } $form->get_all_currencies(\%myconfig); + map { my $quoted = H($_); $form->{selectcurrency} .= "${quoted}\n" } $form->get_all_currencies(\%myconfig); # vendors if (@{ $form->{all_vendor} || [] }) { $form->{vendor} = qq|$form->{vendor}--$form->{vendor_id}|; - map { $form->{selectvendor} .= "$_->{name}--$_->{id}\n" } + map { my $quoted = H($_->{name} . "--" . $_->{id}); $form->{selectvendor} .= "${quoted}\n" } (@{ $form->{all_vendor} }); } # departments if (@{ $form->{all_departments} || [] }) { - $form->{selectdepartment} = "\n"; $form->{department} = "$form->{department}--$form->{department_id}"; - - map { - $form->{selectdepartment} .= - "$_->{description}--$_->{id}\n" - } (@{ $form->{all_departments} || [] }); + $form->{selectdepartment} = "\n" . join('', map { my $quoted = H("$_->{description}--$_->{id}"); "${quoted}\n"} @{ $form->{all_departments} || [] }); } $form->{employee} = "$form->{employee}--$form->{employee_id}"; @@ -232,13 +225,15 @@ sub form_header { # set option selected foreach my $item (qw(vendor currency department)) { + my $to_replace = H($form->{$item}); $form->{"select$item"} =~ s/ selected//; - $form->{"select$item"} =~ - s/option>\Q$form->{$item}\E/option selected>$form->{$item}/; + $form->{"select$item"} =~ s/>\Q${to_replace}\E/ selected>${to_replace}/; } my $readonly = ($form->{id}) ? "readonly" : ""; - $form->{radier} = ($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0; + $form->{radier} = ($::instance_conf->get_ap_changeable == 2) + ? ($form->current_date(\%myconfig) eq $form->{gldate}) + : ($::instance_conf->get_ap_changeable == 1); $readonly = ($form->{radier}) ? "" : $readonly; $form->{forex} = $form->check_exchangerate( \%myconfig, $form->{currency}, $form->{transdate}, 'sell'); @@ -284,13 +279,14 @@ sub form_header { } my $notes = qq|$form->{notes}|; + my $intnotes = qq|$form->{intnotes}|; my $department; $department = qq| | . $locale->text('Department') . qq| $form->{selectdepartment} - + | if $form->{selectdepartment}; @@ -461,7 +457,7 @@ sub form_header { | . $locale->text('Currency') . qq| $form->{selectcurrency} - + {defaultcurrency}> {fxgain_accno}> {fxloss_accno}> @@ -568,7 +564,7 @@ $jsscript NTI($cgi->popup_menu('-name' => "project_id_$i", '-values' => \@project_values, '-labels' => \%project_labels, - '-default' => $form->{"project_id_$i"} )); + '-default' => ($i==$form->{rowcount})? $form->{globalproject_id} : $form->{"project_id_$i"} )); print qq| @@ -624,6 +620,9 @@ $jsscript | . $locale->text('Notes') . qq| $notes + + | . $locale->text('Notes for vendor') . qq| + $intnotes @@ -693,11 +692,11 @@ $jsscript print qq|{"acc_trans_id_$i"}>\n|; print qq|{"gldate_$i"}>\n|; my $changeable = 1; - if ($::lx_office_conf{features}->{payments_changeable} == 0) { + if (SL::DB::Default->get->payments_changeable == 0) { # never $changeable = ($form->{"acc_trans_id_$i"})? 0 : 1; } - if ($::lx_office_conf{features}->{payments_changeable} == 2) { + if (SL::DB::Default->get->payments_changeable == 2) { # on the same day $changeable = (($form->{"gldate_$i"} eq '') || $form->current_date(\%myconfig) eq $form->{"gldate_$i"}); } @@ -852,10 +851,10 @@ sub form_footer { $::form->header; print $::form->parse_html_template('ap/form_footer', { - num_due => $num_due, - num_follow_ups => $num_follow_ups, - show_post_draft => ($transdate > $closedto) && !$::form->{id}, - show_storno => $storno, + num_due => $num_due, + num_follow_ups => $num_follow_ups, + show_post_draft => ($transdate > $closedto) && !$::form->{id}, + show_storno => $storno, }); $::lxdebug->leave_sub; @@ -926,7 +925,7 @@ sub update { $form->{exchangerate} = $form->{forex} if $form->{forex}; $form->{invdate} = $form->{transdate}; - my %saved_variables = map +( $_ => $form->{$_} ), qw(AP AP_amount_1 taxchart_1); + my %saved_variables = map +( $_ => $form->{$_} ), qw(AP AP_amount_1 taxchart_1 notes); my $vendor_changed = &check_name("vendor"); @@ -963,9 +962,6 @@ sub update { $form->{oldinvtotal} = $form->{invtotal}; $form->{oldtotalpaid} = $totalpaid; - # notes - $form->{notes} = $form->{intnotes} if $vendor_changed; - &display_form; $main::lxdebug->leave_sub(); @@ -1128,7 +1124,7 @@ sub post_as_new { $main::lxdebug->leave_sub(); } -sub use_as_template { +sub use_as_new { $main::lxdebug->enter_sub(); my $form = $main::form;