From 3add3e3992775bd675e105f4aeb1f2ee6be5380a Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 15 Nov 2012 13:12:43 +0100 Subject: [PATCH] 9088 Default values for fund and item type on neworderempty form Content-Type: text/plain; charset="utf-8" Adds a syspref AcqNewOrderEmptyDefaults containing default codes for item type and fund code. The neworderempty form checks these values for a new empty record. --- acqui/neworderempty.pl | 6 +++++- .../en/modules/admin/preferences/acquisitions.pref | 3 +++ 2 files changed, 8 insertions(+), 1 deletions(-) diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl index 807a82b..fe304b3 100755 --- a/acqui/neworderempty.pl +++ b/acqui/neworderempty.pl @@ -122,6 +122,7 @@ our ( $template, $loggedinuser, $cookie, $userflags ) = get_template_and_user( ); our $marcflavour = C4::Context->preference('marcflavour'); +my $defaultvalues= C4::Context->preference('AcqNewOrderEmptyDefaults')||''; if(!$basketno) { my $order = GetOrder($ordernumber); @@ -261,7 +262,7 @@ foreach my $r (@{$budgets}) { b_id => $r->{budget_id}, b_txt => $r->{budget_name}, b_active => $r->{budget_period_active}, - b_sel => ( $r->{budget_id} == $budget_id ) ? 1 : 0, + b_sel => ( $r->{budget_id} == $budget_id || (!$budget_id && $defaultvalues=~/fund=$r->{budget_code}/i )) ? 1 : 0, }; } @@ -320,6 +321,9 @@ if (C4::Context->preference('AcqCreateItem') eq 'ordering' && !$ordernumber) { # Get the item types list, but only if item_level_itype is YES. Otherwise, it will be in the item, no need to display it in the biblio my @itemtypes; @itemtypes = C4::ItemType->all unless C4::Context->preference('item-level_itypes'); +foreach(@itemtypes) { + $_->{selected}=1 if !$biblionumber && $defaultvalues=~/itemtype=$_->{itemtype}/i; +} # Find the items.barcode subfield for barcode validations my (undef, $barcode_subfield) = GetMarcFromKohaField('items.barcode', ''); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref index 1ec49ff..2323b85 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref @@ -35,6 +35,9 @@ Acquisitions: - Default tax rates are - pref: gist - (enter in numeric form, 0.12 for 12%. First is the default. If you want more than 1 value, please separate with |) + - + - pref: AcqNewOrderEmptyDefaults + - " (Optionally define default values for item type and/or fund by entering an item code or fund code prefixed by itemtype= or fund=. Example: fund=FND,itemtype=BKS. The defaults you specify here will be used on the neworderempty form.)" Printing: - -- 1.7.7.6