From: Moritz Bunkus Date: Wed, 17 Jul 2019 13:59:34 +0000 (+0200) Subject: Einkaufsrechnungen: Projektauswahl gefixt X-Git-Tag: release-3.5.4~30 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=70220684f6d864081e6ef7302839d2cf96ef3b27;p=kivitendo-erp.git Einkaufsrechnungen: Projektauswahl gefixt --- diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl index f41e8087a..234bbc515 100644 --- a/bin/mozilla/ir.pl +++ b/bin/mozilla/ir.pl @@ -38,8 +38,10 @@ use SL::IS; use SL::DB::BankTransactionAccTrans; use SL::DB::Default; use SL::DB::Department; +use SL::DB::Project; use SL::DB::PurchaseInvoice; use SL::DB::Vendor; +use List::MoreUtils qw(uniq); use List::Util qw(max sum); use List::UtilsBy qw(sort_by); @@ -393,8 +395,10 @@ sub form_header { $form->{defaultcurrency} = $form->get_default_currency(\%myconfig); - my @old_project_ids = ($form->{"globalproject_id"}); - map { push @old_project_ids, $form->{"project_id_$_"} if $form->{"project_id_$_"}; } 1..$form->{"rowcount"}; + my @old_project_ids = uniq grep { $_ } map { $_ * 1 } ($form->{"globalproject_id"}, map { $form->{"project_id_$_"} } 1..$form->{"rowcount"}); + my @conditions = @old_project_ids ? (id => \@old_project_ids) : (); + $TMPL_VAR{ALL_PROJECTS} = SL::DB::Manager::Project->get_all_sorted(query => [ or => [ active => 1, @conditions ]]); + $form->{ALL_PROJECTS} = $TMPL_VAR{ALL_PROJECTS}; # make projects available for second row drop-down in io.pl $form->get_lists("taxzones" => ($form->{id} ? "ALL_TAXZONES" : "ALL_ACTIVE_TAXZONES"), "currencies" => "ALL_CURRENCIES", diff --git a/templates/webpages/ir/form_header.html b/templates/webpages/ir/form_header.html index 3b6843f8e..4389cd1b8 100644 --- a/templates/webpages/ir/form_header.html +++ b/templates/webpages/ir/form_header.html @@ -168,7 +168,7 @@ [% 'Project Number' | $T8 %] - [% P.project.picker('globalproject_id', globalproject_id) %] + [%- L.select_tag('globalproject_id', ALL_PROJECTS, title_key = 'projectnumber', default = globalproject_id, with_empty = '1', onChange = "document.getElementById('update_button').click();") %]