X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Foe.pl;h=3ac2fc248f1ef51f26e37d423639af3178114719;hb=94f5cb152afa9210162295b6727801c296af0631;hp=b9edf4c96f84e4a50e1bce086939e1305208b33d;hpb=19132371fe1237caafc1a2ef589a881de2780d99;p=kivitendo-erp.git diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index b9edf4c96..3ac2fc248 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -42,6 +42,7 @@ use SL::FU; use SL::OE; use SL::IR; use SL::IS; +use SL::Helper::UserPreferences::DisplayPreferences; use SL::MoreCommon qw(ary_diff restore_form save_form); use SL::ReportGenerator; use SL::YAML; @@ -50,7 +51,6 @@ use List::Util qw(min max reduce sum); use Data::Dumper; use SL::Controller::Order; - use SL::DB::Customer; use SL::DB::TaxZone; use SL::DB::PaymentTerm; @@ -84,10 +84,18 @@ my $oe_access_map = { 'sales_quotation' => 'sales_quotation_edit', }; +my $oe_view_access_map = { + 'sales_order' => 'sales_order_edit | sales_order_view', + 'purchase_order' => 'purchase_order_edit | purchase_order_view', + 'request_quotation' => 'request_quotation_edit | request_quotation_view', + 'sales_quotation' => 'sales_quotation_edit | sales_quotation_view', +}; + sub check_oe_access { + my (%params) = @_; my $form = $main::form; - my $right = $oe_access_map->{$form->{type}}; + my $right = ($params{with_view}) ? $oe_view_access_map->{$form->{type}} : $oe_access_map->{$form->{type}}; $right ||= 'DOES_NOT_EXIST'; $main::auth->assert($right); @@ -614,8 +622,9 @@ sub form_header { } $::request->{layout}->add_javascripts_inline("\$(function(){$dispatch_to_popup});"); - $TMPL_VAR->{dateformat} = $myconfig{dateformat}; - $TMPL_VAR->{numberformat} = $myconfig{numberformat}; + $TMPL_VAR->{dateformat} = $myconfig{dateformat}; + $TMPL_VAR->{numberformat} = $myconfig{numberformat}; + $TMPL_VAR->{longdescription_dialog_size_percentage} = SL::Helper::UserPreferences::DisplayPreferences->new()->get_longdescription_dialog_size_percentage(); if ($form->{type} eq 'sales_order') { if (!$form->{periodic_invoices_config}) { @@ -926,7 +935,7 @@ sub search { my %myconfig = %main::myconfig; my $locale = $main::locale; - check_oe_access(); + check_oe_access(with_view => 1); if ($form->{type} eq 'purchase_order') { $form->{vc} = 'vendor'; @@ -1017,7 +1026,7 @@ sub orders { my $cgi = $::request->{cgi}; my %params = @_; - check_oe_access(); + check_oe_access(with_view => 1); my $ordnumber = ($form->{type} =~ /_order$/) ? "ordnumber" : "quonumber"; @@ -1654,7 +1663,7 @@ sub invoice { $::dispatcher->end_request; } - _oe_remove_delivered_or_billed_rows(id => $form->{id}, type => 'billed'); + _oe_remove_delivered_or_billed_rows(id => $form->{id}, type => 'billed') if $form->{new_invoice_type} ne 'final_invoice'; $form->{cp_id} *= 1; @@ -1699,8 +1708,8 @@ sub invoice { if ( $form->{type} eq 'sales_order' || $form->{type} eq 'sales_quotation') { - $form->{title} = ($form->{new_invoice_type} eq 'invoice_for_advance_payment') - ? $locale->text('Add Invoice for Advance Payment') + $form->{title} = ($form->{new_invoice_type} eq 'invoice_for_advance_payment') ? $locale->text('Add Invoice for Advance Payment') + : ($form->{new_invoice_type} eq 'final_invoice') ? $locale->text('Add Final Invoice') : $locale->text('Add Sales Invoice'); $form->{script} = 'is.pl'; $script = "is";