X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Foe.pl;h=164eab3ef3c1e169fb1ead8c7f09d310039c9c71;hb=14d71a6d1215e4fc67136c060fd21cd6c59602af;hp=93e9f2a2f8e1072aa2d92249477746b26bf6406b;hpb=a87694dc525b4eabff11029f1e5401621e2bd3bc;p=kivitendo-erp.git diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index 93e9f2a2f..164eab3ef 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -240,9 +240,7 @@ sub order_links { # get customer/vendor $form->all_vc(\%myconfig, $form->{vc}, ($form->{vc} eq 'customer') ? "AR" : "AP"); - # retrieve order/quotation and webdav config - $form->{webdav} = $::instance_conf->get_webdav; - + # retrieve order/quotation my $editing = $form->{id}; OE->retrieve(\%myconfig, \%$form); @@ -376,6 +374,7 @@ sub form_header { ]); $TMPL_VAR{ALL_PROJECTS} = SL::DB::Manager::Project->get_all_sorted(query => \@conditions); + $form->{ALL_PROJECTS} = $TMPL_VAR{ALL_PROJECTS}; # make projects available for second row drop-down in io.pl # label subs my $employee_list_query_gen = sub { $::form->{$_[0]} ? [ or => [ id => $::form->{$_[0]}, deleted => 0 ] ] : [ deleted => 0 ] }; @@ -534,9 +533,6 @@ sub form_footer { |; } } - -# $form->{invsubtotal} = $form->format_amount(\%myconfig, $form->{invsubtotal}, 2, 0); # template does this - } else { foreach my $item (split / /, $form->{taxaccounts}) { if ($form->{"${item}_base"}) { @@ -558,6 +554,10 @@ sub form_footer { } } + $form->{rounding} = $form->round_amount( + $form->round_amount($form->{invtotal}, 2, 1) - $form->round_amount($form->{invtotal}, 2) + ); + $form->{invtotal} = $form->round_amount( $form->{invtotal}, 2, 1); $form->{oldinvtotal} = $form->{invtotal}; $TMPL_VAR{ALL_DELIVERY_TERMS} = SL::DB::Manager::DeliveryTerm->get_all_sorted(); @@ -566,7 +566,6 @@ sub form_footer { $tpca_reminder = check_transport_cost_reminder_article_number() if $::instance_conf->get_transport_cost_reminder_article_number_id; print $form->parse_html_template("oe/form_footer", { %TMPL_VAR, - webdav => $::instance_conf->get_webdav, tpca_reminder => $tpca_reminder, print_options => print_options(inline => 1), label_edit => $locale->text("Edit the $form->{type}"), @@ -788,7 +787,6 @@ sub search { $form->header(); print $form->parse_html_template('oe/search', { - %myconfig, is_order => scalar($form->{type} =~ /_order/), }); @@ -853,6 +851,7 @@ sub orders { "country", "shippingpoint", "taxzone", "insertdate", "order_probability", "expected_billing_date", "expected_netamount", + "payment_terms", ); # only show checkboxes if gotten here via sales_order form. @@ -944,10 +943,11 @@ sub orders { 'order_probability' => { 'text' => $locale->text('Order probability'), }, 'expected_billing_date' => { 'text' => $locale->text('Exp. bill. date'), }, 'expected_netamount' => { 'text' => $locale->text('Exp. netamount'), }, + 'payment_terms' => { 'text' => $locale->text('Payment Terms'), }, %column_defs_cvars, ); - foreach my $name (qw(id transdate reqdate quonumber ordnumber cusordnumber name employee salesman shipvia transaction_description shippingpoint taxzone insertdate)) { + foreach my $name (qw(id transdate reqdate quonumber ordnumber cusordnumber name employee salesman shipvia transaction_description shippingpoint taxzone insertdate payment_terms)) { my $sortdir = $form->{sort} eq $name ? 1 - $form->{sortdir} : $form->{sortdir}; $column_defs{$name}->{link} = $href . "&sort=$name&sortdir=$sortdir"; } @@ -1144,6 +1144,7 @@ sub save_and_close { my $locale = $main::locale; check_oe_access(); + $form->mtime_ischanged('oe'); $form->{defaultcurrency} = $form->get_default_currency(\%myconfig); @@ -1250,6 +1251,7 @@ sub save { check_oe_access(); + $form->mtime_ischanged('oe'); $form->{defaultcurrency} = $form->get_default_currency(\%myconfig); @@ -1401,6 +1403,8 @@ sub invoice { check_oe_access(); check_oe_conversion_to_sales_invoice_allowed(); + $form->mtime_ischanged('oe'); + $main::auth->assert($form->{type} eq 'purchase_order' || $form->{type} eq 'request_quotation' ? 'vendor_invoice_edit' : 'invoice_edit'); $form->{old_salesman_id} = $form->{salesman_id}; @@ -1443,7 +1447,7 @@ sub invoice { $form->{cp_id} *= 1; for my $i (1 .. $form->{rowcount}) { - for (qw(ship qty sellprice listprice basefactor)) { + for (qw(ship qty sellprice basefactor)) { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if $form->{"${_}_${i}"}; } $form->{"converted_from_orderitems_id_$i"} = delete $form->{"orderitems_id_$i"}; @@ -1500,7 +1504,7 @@ sub invoice { $form->{type} = "invoice"; # locale messages - $main::locale = new Locale "$myconfig{countrycode}", "$script"; + $main::locale = Locale->new("$myconfig{countrycode}", "$script"); $locale = $main::locale; require "bin/mozilla/$form->{script}"; @@ -1660,14 +1664,9 @@ sub save_as_new { if ( $form->{reqdate} && $form->{id} ) { my $saved_order = OE->retrieve_simple(id => $form->{id}); if ( $saved_order && $saved_order->{reqdate} eq $form->{reqdate} && $saved_order->{transdate} eq $form->{transdate} ) { - my $extra_days = $form->{type} eq 'sales_quotation' ? $::instance_conf->get_reqdate_interval : 1; - my $next_workday = DateTime->today_local->add(days => $extra_days); - my $day_of_week = $next_workday->day_of_week; - - $next_workday->add(days => (8 - $day_of_week)) if $day_of_week >= 6; - + my $extra_days = $form->{type} eq 'sales_quotation' ? $::instance_conf->get_reqdate_interval : 1; + $form->{reqdate} = DateTime->today_local->next_workday(extra_days => $extra_days)->to_kivitendo; $form->{transdate} = DateTime->today_local->to_kivitendo; - $form->{reqdate} = $next_workday->to_kivitendo; } } @@ -1748,6 +1747,8 @@ sub purchase_order { my $locale = $main::locale; check_oe_access(); + $form->mtime_ischanged('oe'); + $main::auth->assert('purchase_order_edit'); $form->{sales_order_to_purchase_order} = 0; @@ -1786,6 +1787,7 @@ sub sales_order { check_oe_access(); $main::auth->assert('sales_order_edit'); + $form->mtime_ischanged('oe'); if ($form->{type} eq "purchase_order") { delete($form->{ordnumber}); @@ -1845,7 +1847,7 @@ sub poso { }; for my $i (1 .. $form->{rowcount}) { - map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if ($form->{"${_}_${i}"}) } qw(ship qty sellprice listprice basefactor discount lastcost); + map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if ($form->{"${_}_${i}"}) } qw(ship qty sellprice basefactor discount lastcost); } my %saved_vars = map { $_ => $form->{$_} } grep { $form->{$_} } qw(currency); @@ -1875,6 +1877,8 @@ sub delivery_order { my $form = $main::form; my %myconfig = %main::myconfig; + $form->mtime_ischanged('oe'); + if ($form->{type} =~ /^sales/) { $main::auth->assert('sales_delivery_order_edit'); @@ -1907,7 +1911,7 @@ sub delivery_order { delete @{$form}{qw(id subject message cc bcc printed emailed queued creditlimit creditremaining discount tradediscount oldinvtotal closed delivered)}; for my $i (1 .. $form->{rowcount}) { - map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if ($form->{"${_}_${i}"}) } qw(ship qty sellprice listprice lastcost basefactor discount); + map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if ($form->{"${_}_${i}"}) } qw(ship qty sellprice lastcost basefactor discount); $form->{"converted_from_orderitems_id_$i"} = delete $form->{"orderitems_id_$i"}; } @@ -1934,6 +1938,7 @@ sub e_mail { check_oe_access(); + $form->mtime_ischanged('oe','mail'); $form->{print_and_save} = 1; my $saved_form = save_form(); @@ -2060,6 +2065,7 @@ sub save_periodic_invoices_config { my $config = { active => $::form->{active} ? 1 : 0, terminated => $::form->{terminated} ? 1 : 0, + direct_debit => $::form->{direct_debit} ? 1 : 0, periodicity => (any { $_ eq $::form->{periodicity} } @SL::DB::PeriodicInvoicesConfig::PERIODICITIES) ? $::form->{periodicity} : 'm', order_value_periodicity => (any { $_ eq $::form->{order_value_periodicity} } ('p', @SL::DB::PeriodicInvoicesConfig::ORDER_VALUE_PERIODICITIES)) ? $::form->{order_value_periodicity} : 'p', start_date_as_date => $::form->{start_date_as_date},