X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fir.pl;h=bf752b764ca07535e7f87d31149b6c4510288dd4;hb=049e49fea3e4a3c7c78d7aebf055936b3cab40c5;hp=bad6e4fff249eec92f7b7c6615e77960142f3fc1;hpb=24cc5f2baffdb1fd52acb76e8d73be3e694b1737;p=kivitendo-erp.git diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl index bad6e4fff..bf752b764 100644 --- a/bin/mozilla/ir.pl +++ b/bin/mozilla/ir.pl @@ -58,6 +58,10 @@ sub add { $main::auth->assert('vendor_invoice_edit'); + if (!$::instance_conf->get_allow_new_purchase_invoice) { + $::form->show_generic_error($::locale->text("You do not have the permissions to access this function.")); + } + return $main::lxdebug->leave_sub() if (load_draft_maybe()); $form->{title} = $locale->text('Record Vendor Invoice'); @@ -269,8 +273,8 @@ sub form_header { "departments" => "all_departments", "price_factors" => "ALL_PRICE_FACTORS"); - $TMPL_VAR{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all(query => [ or => [ id => $::form->{employee_id}, deleted => 0 ] ]); - $TMPL_VAR{ALL_CONTACTS} = SL::DB::Manager::Contact->get_all(query => [ + $TMPL_VAR{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted(query => [ or => [ id => $::form->{employee_id}, deleted => 0 ] ]); + $TMPL_VAR{ALL_CONTACTS} = SL::DB::Manager::Contact->get_all_sorted(query => [ or => [ cp_cv_id => $::form->{"$::form->{vc}_id"} * 1, and => [ @@ -331,6 +335,8 @@ sub form_header { ), @custom_hiddens, map { $_.'_rate', $_.'_description', $_.'_taxnumber' } split / /, $form->{taxaccounts}]; + $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.SalesPurchase ckeditor/ckeditor ckeditor/adapters/jquery kivi.io)); + $form->header(); print $form->parse_html_template("ir/form_header", \%TMPL_VAR); @@ -699,7 +705,8 @@ sub post { $form->error($locale->text('Cannot post transaction above the maximum future booking date!')) if ($form->date_max_future($invdate, \%myconfig)); - $form->error($locale->text('Cannot post invoice for a closed period!')) if $max_datepaid && $form->date_closed($max_datepaid, \%myconfig); + $form->error($locale->text('Cannot post invoice for a closed period!')) + if ($invdate <= $closedto); $form->isblank("exchangerate", $locale->text('Exchangerate missing!')) if ($form->{currency} ne $form->{defaultcurrency});