Bugzilla – Attachment 60025 Details for
Bug 15503
Grab Item Information from Order Files
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 15503: Grab Item Information from Order Files
SIGNED-OFF-Bug-15503-Grab-Item-Information-from-Or.patch (text/plain), 32.75 KB, created by
Kyle M Hall (khall)
on 2017-02-08 17:02:38 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 15503: Grab Item Information from Order Files
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2017-02-08 17:02:38 UTC
Size:
32.75 KB
patch
obsolete
>From dd4a41ffda9f14b3d1292aba672fdca612fda1f2 Mon Sep 17 00:00:00 2001 >From: Matthias Meusburger <matthias.meusburger@biblibre.com> >Date: Tue, 28 Jun 2016 15:06:46 +0200 >Subject: [PATCH] [SIGNED-OFF] Bug 15503: Grab Item Information from Order > Files > >The goal of this development is to automatically generate items in Koha with >populated information based on a 9XX field and subfield, with the new syspref >MarcItemFieldsToOrder. > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> > >Signed-off-by: Benjamin Daeuber <bdaeuber@cityoffargo.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > acqui/addorderiso2709.pl | 358 +++++++++++++++++---- > .../Bug_15503_MarcItemFieldsToOrder.sql | 1 + > installer/data/mysql/sysprefs.sql | 1 + > .../prog/en/modules/acqui/addorderiso2709.tt | 92 +++++- > .../en/modules/admin/preferences/acquisitions.pref | 6 + > 5 files changed, 397 insertions(+), 61 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/Bug_15503_MarcItemFieldsToOrder.sql > >diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl >index b64ddad..c97b891 100755 >--- a/acqui/addorderiso2709.pl >+++ b/acqui/addorderiso2709.pl >@@ -25,6 +25,7 @@ use Modern::Perl; > use CGI qw ( -utf8 ); > use Carp; > use YAML qw/Load/; >+use List::MoreUtils qw/uniq/; > > use C4::Context; > use C4::Auth; >@@ -194,55 +195,143 @@ if ($op eq ""){ > } else { > SetImportRecordStatus( $biblio->{'import_record_id'}, 'imported' ); > } >- # 3rd add order >- my $patron = C4::Members::GetMember( borrowernumber => $loggedinuser ); >- # get quantity in the MARC record (1 if none) >- my $quantity = GetMarcQuantity($marcrecord, C4::Context->preference('marcflavour')) || 1; >- my %orderinfo = ( >- biblionumber => $biblionumber, >- basketno => $cgiparams->{'basketno'}, >- quantity => $c_quantity, >- branchcode => $patron->{branchcode}, >- budget_id => $c_budget_id, >- uncertainprice => 1, >- sort1 => $c_sort1, >- sort2 => $c_sort2, >- order_internalnote => $cgiparams->{'all_order_internalnote'}, >- order_vendornote => $cgiparams->{'all_order_vendornote'}, >- currency => $cgiparams->{'all_currency'}, >- ); >- # get the price if there is one. >- my $price= shift( @prices ) || GetMarcPrice($marcrecord, C4::Context->preference('marcflavour')); >- if ($price){ >- # in France, the cents separator is the , but sometimes, ppl use a . >- # in this case, the price will be x100 when unformatted ! Replace the . by a , to get a proper price calculation >- $price =~ s/\./,/ if C4::Context->preference("CurrencyFormat") eq "FR"; >- $price = Koha::Number::Price->new($price)->unformat; >- $orderinfo{tax_rate} = $bookseller->tax_rate; >- my $c = $c_discount ? $c_discount : $bookseller->discount / 100; >- if ( $bookseller->listincgst ) { >- if ( $c_discount ) { >- $orderinfo{ecost} = $price; >- $orderinfo{rrp} = $orderinfo{ecost} / ( 1 - $c ); >- } else { >- $orderinfo{ecost} = $price * ( 1 - $c ); >- $orderinfo{rrp} = $price; >+ >+ # Add items from MarcItemFieldsToOrder >+ my @homebranches = $input->multi_param('homebranch'); >+ my $count = scalar @homebranches; >+ my @holdingbranches = $input->multi_param('holdingbranch'); >+ my @itypes = $input->multi_param('itype'); >+ my @nonpublic_notes = $input->multi_param('nonpublic_note'); >+ my @public_notes = $input->multi_param('public_note'); >+ my @locs = $input->multi_param('loc'); >+ my @ccodes = $input->multi_param('ccodes'); >+ my @notforloans = $input->multi_param('notforloans'); >+ my @uris = $input->multi_param('uri'); >+ my @copynos = $input->multi_param('copyno'); >+ my @budget_codes = $input->multi_param('budget_code'); >+ my @itemprices = $input->multi_param('itemprice'); >+ my $itemcreation = 0; >+ for (my $i = 0; $i < $count; $i++) { >+ $itemcreation = 1; >+ my ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ >+ homebranch => $homebranches[$i], >+ holdingbranch => $holdingbranches[$i], >+ itemnotes_nonpublic => $nonpublic_notes[$i], >+ itemnotes => $public_notes[$i], >+ location => $locs[$i], >+ ccode => $ccodes[$i], >+ notforloan => $notforloans[$i], >+ uri => $uris[$i], >+ copynumber => $copynos[$i], >+ price => $itemprices[$i], >+ }, $biblionumber); >+ } >+ if ($itemcreation == 1) { >+ # Group orderlines from MarcItemFieldsToOrder >+ my $budget_hash; >+ for (my $i = 0; $i < $count; $i++) { >+ $budget_hash->{$budget_codes[$i]}->{quantity} += 1; >+ $budget_hash->{$budget_codes[$i]}->{price} = $itemprices[$i]; >+ } >+ >+ # Create orderlines from MarcItemFieldsToOrder >+ while(my ($budget_id, $infos) = each $budget_hash) { >+ if ($budget_id) { >+ my %orderinfo = ( >+ biblionumber => $biblionumber, >+ basketno => $cgiparams->{'basketno'}, >+ quantity => $infos->{quantity}, >+ budget_id => $budget_id, >+ currency => $cgiparams->{'all_currency'}, >+ ); >+ >+ my $price = $infos->{price}; >+ if ($price){ >+ # in France, the cents separator is the , but sometimes, ppl use a . >+ # in this case, the price will be x100 when unformatted ! Replace the . by a , to get a proper price calculation >+ $price =~ s/\./,/ if C4::Context->preference("CurrencyFormat") eq "FR"; >+ $price = Koha::Number::Price->new($price)->unformat; >+ $orderinfo{gstrate} = $bookseller->{gstrate}; >+ my $c = $c_discount ? $c_discount : $bookseller->{discount} / 100; >+ if ( $bookseller->{listincgst} ) { >+ if ( $c_discount ) { >+ $orderinfo{ecost} = $price; >+ $orderinfo{rrp} = $orderinfo{ecost} / ( 1 - $c ); >+ } else { >+ $orderinfo{ecost} = $price * ( 1 - $c ); >+ $orderinfo{rrp} = $price; >+ } >+ } else { >+ if ( $c_discount ) { >+ $orderinfo{ecost} = $price / ( 1 + $orderinfo{gstrate} ); >+ $orderinfo{rrp} = $orderinfo{ecost} / ( 1 - $c ); >+ } else { >+ $orderinfo{rrp} = $price / ( 1 + $orderinfo{gstrate} ); >+ $orderinfo{ecost} = $orderinfo{rrp} * ( 1 - $c ); >+ } >+ } >+ $orderinfo{listprice} = $orderinfo{rrp} / $active_currency->rate; >+ $orderinfo{unitprice} = $orderinfo{ecost}; >+ $orderinfo{total} = $orderinfo{ecost} * $infos->{quantity}; >+ } else { >+ $orderinfo{listprice} = 0; >+ } >+ >+ # remove uncertainprice flag if we have found a price in the MARC record >+ $orderinfo{uncertainprice} = 0 if $orderinfo{listprice}; >+ my $order = Koha::Acquisition::Order->new( \%orderinfo )->insert; > } >- } else { >- if ( $c_discount ) { >- $orderinfo{ecost} = $price / ( 1 + $orderinfo{tax_rate} ); >- $orderinfo{rrp} = $orderinfo{ecost} / ( 1 - $c ); >+ } >+ } else { >+ # 3rd add order >+ my $patron = C4::Members::GetMember( borrowernumber => $loggedinuser ); >+ # get quantity in the MARC record (1 if none) >+ my $quantity = GetMarcQuantity($marcrecord, C4::Context->preference('marcflavour')) || 1; >+ my %orderinfo = ( >+ biblionumber => $biblionumber, >+ basketno => $cgiparams->{'basketno'}, >+ quantity => $c_quantity, >+ branchcode => $patron->{branchcode}, >+ budget_id => $c_budget_id, >+ uncertainprice => 1, >+ sort1 => $c_sort1, >+ sort2 => $c_sort2, >+ order_internalnote => $cgiparams->{'all_order_internalnote'}, >+ order_vendornote => $cgiparams->{'all_order_vendornote'}, >+ currency => $cgiparams->{'all_currency'}, >+ ); >+ # get the price if there is one. >+ my $price= shift( @prices ) || GetMarcPrice($marcrecord, C4::Context->preference('marcflavour')); >+ if ($price){ >+ # in France, the cents separator is the , but sometimes, ppl use a . >+ # in this case, the price will be x100 when unformatted ! Replace the . by a , to get a proper price calculation >+ $price =~ s/\./,/ if C4::Context->preference("CurrencyFormat") eq "FR"; >+ $price = Koha::Number::Price->new($price)->unformat; >+ $orderinfo{gstrate} = $bookseller->{gstrate}; >+ my $c = $c_discount ? $c_discount : $bookseller->{discount} / 100; >+ if ( $bookseller->{listincgst} ) { >+ if ( $c_discount ) { >+ $orderinfo{ecost} = $price; >+ $orderinfo{rrp} = $orderinfo{ecost} / ( 1 - $c ); >+ } else { >+ $orderinfo{ecost} = $price * ( 1 - $c ); >+ $orderinfo{rrp} = $price; >+ } > } else { >- $orderinfo{rrp} = $price / ( 1 + $orderinfo{tax_rate} ); >- $orderinfo{ecost} = $orderinfo{rrp} * ( 1 - $c ); >+ if ( $c_discount ) { >+ $orderinfo{ecost} = $price / ( 1 + $orderinfo{gstrate} ); >+ $orderinfo{rrp} = $orderinfo{ecost} / ( 1 - $c ); >+ } else { >+ $orderinfo{rrp} = $price / ( 1 + $orderinfo{gstrate} ); >+ $orderinfo{ecost} = $orderinfo{rrp} * ( 1 - $c ); >+ } > } >+ $orderinfo{listprice} = $orderinfo{rrp} / $active_currency->rate; >+ $orderinfo{unitprice} = $orderinfo{ecost}; >+ $orderinfo{total} = $orderinfo{ecost} * $c_quantity; >+ } else { >+ $orderinfo{listprice} = 0; > } >- $orderinfo{listprice} = $orderinfo{rrp} / $active_currency->rate; >- $orderinfo{unitprice} = $orderinfo{ecost}; >- $orderinfo{total} = $orderinfo{ecost} * $c_quantity; >- } else { >- $orderinfo{listprice} = 0; >- } > > # remove uncertainprice flag if we have found a price in the MARC record > $orderinfo{uncertainprice} = 0 if $orderinfo{listprice}; >@@ -282,9 +371,10 @@ if ($op eq ""){ > for (my $qtyloop=1;$qtyloop <= $c_quantity;$qtyloop++) { > my ( $biblionumber, $bibitemnum, $itemnumber ) = AddItemFromMarc( $record, $biblionumber ); > $order->add_item( $itemnumber ); >+ } >+ } else { >+ SetImportRecordStatus( $biblio->{'import_record_id'}, 'imported' ); > } >- } else { >- SetImportRecordStatus( $biblio->{'import_record_id'}, 'imported' ); > } > $imported++; > } >@@ -315,6 +405,7 @@ foreach my $r ( @{$budgets_hierarchy} ) { > push @{$budget_loop}, > { b_id => $r->{budget_id}, > b_txt => $r->{budget_name}, >+ b_code => $r->{budget_code}, > b_sort1_authcat => $r->{'sort1_authcat'}, > b_sort2_authcat => $r->{'sort2_authcat'}, > b_active => $r->{budget_period_active}, >@@ -366,6 +457,22 @@ sub import_biblios_list { > return () unless $batch and $batch->{import_status} =~ /^staged$|^reverted$/; > my $biblios = GetImportRecordsRange($import_batch_id,'','',$batch->{import_status}); > my @list = (); >+ my $item_id = 1; >+ my $item_error = 0; >+ >+ my $ccodes = GetKohaAuthorisedValues("items.ccode"); >+ my $locations = GetKohaAuthorisedValues("items.location"); >+ # location list >+ my @locations; >+ foreach (sort keys %$locations) { >+ push @locations, { code => $_, description => "$_ - " . $locations->{$_} }; >+ } >+ my @ccodes; >+ foreach (sort {$ccodes->{$a} cmp $ccodes->{$b}} keys %$ccodes) { >+ push @ccodes, { code => $_, description => $ccodes->{$_} }; >+ } >+ >+ > > foreach my $biblio (@$biblios) { > my $citation = $biblio->{'title'}; >@@ -389,7 +496,8 @@ sub import_biblios_list { > ); > my ( $marcblob, $encoding ) = GetImportRecordMarc( $biblio->{'import_record_id'} ); > my $marcrecord = MARC::Record->new_from_usmarc($marcblob) || die "couldn't translate marc information"; >- my $infos = get_infos_syspref($marcrecord, ['price', 'quantity', 'budget_code', 'discount', 'sort1', 'sort2']); >+ >+ my $infos = get_infos_syspref('MarcFieldsToOrder', $marcrecord, ['price', 'quantity', 'budget_code', 'discount', 'sort1', 'sort2']); > my $price = $infos->{price}; > my $quantity = $infos->{quantity}; > my $budget_code = $infos->{budget_code}; >@@ -403,19 +511,74 @@ sub import_biblios_list { > $budget_id = $biblio_budget->{budget_id}; > } > } >- $cellrecord{price} = $price || ''; >- $cellrecord{quantity} = $quantity || ''; >- $cellrecord{budget_id} = $budget_id || ''; >- $cellrecord{discount} = $discount || ''; >- $cellrecord{sort1} = $sort1 || ''; >- $cellrecord{sort2} = $sort2 || ''; > >+ # Items >+ my @itemlist = (); >+ my $all_items_quantity = 0; >+ my $alliteminfos = get_infos_syspref_on_item('MarcItemFieldsToOrder', $marcrecord, ['homebranch', 'holdingbranch', 'itype', 'nonpublic_note', 'public_note', 'loc', 'ccode', 'notforloan', 'uri', 'copyno', 'price', 'quantity', 'budget_code']); >+ if ($alliteminfos != -1) { >+ foreach my $iteminfos (@$alliteminfos) { >+ my $item_homebranch = $iteminfos->{homebranch}; >+ my $item_holdingbranch = $iteminfos->{holdingbranch}; >+ my $item_itype = $iteminfos->{itype}; >+ my $item_nonpublic_note = $iteminfos->{nonpublic_note}; >+ my $item_public_note = $iteminfos->{public_note}; >+ my $item_loc = $iteminfos->{loc}; >+ my $item_ccode = $iteminfos->{ccode}; >+ my $item_notforloan = $iteminfos->{notforloan}; >+ my $item_uri = $iteminfos->{uri}; >+ my $item_copyno = $iteminfos->{copyno}; >+ my $item_quantity = $iteminfos->{quantity} || 1; >+ my $item_budget_code = $iteminfos->{budget_code}; >+ my $item_price = $iteminfos->{price}; >+ >+ for (my $i = 0; $i < $item_quantity; $i++) { >+ >+ my %itemrecord = ( >+ 'item_id' => $item_id++, >+ 'homebranch' => $item_homebranch, >+ 'holdingbranch' => $item_holdingbranch, >+ 'itype' => $item_itype, >+ 'nonpublic_note' => $item_nonpublic_note, >+ 'public_note' => $item_public_note, >+ 'loc' => $item_loc, >+ 'ccode' => $item_ccode, >+ 'notforloan' => $item_notforloan, >+ 'uri' => $item_uri, >+ 'copyno' => $item_copyno, >+ 'quantity' => $item_quantity, >+ 'budget_code' => $item_budget_code || $budget_code, >+ 'itemprice' => $item_price || $price, >+ ); >+ $all_items_quantity++; >+ push @itemlist, \%itemrecord; >+ >+ } >+ } >+ >+ $cellrecord{'iteminfos'} = \@itemlist; >+ } else { >+ $item_error = 1; >+ } > push @list, \%cellrecord; >+ >+ if ($alliteminfos == -1 || scalar(@$alliteminfos) == 0) { >+ $cellrecord{price} = $price || ''; >+ $cellrecord{quantity} = $quantity || ''; >+ $cellrecord{budget_id} = $budget_id || ''; >+ $cellrecord{discount} = $discount || ''; >+ $cellrecord{sort1} = $sort1 || ''; >+ $cellrecord{sort2} = $sort2 || ''; >+ } else { >+ $cellrecord{quantity} = $all_items_quantity; >+ } >+ > } > my $num_records = $batch->{'num_records'}; > my $overlay_action = GetImportBatchOverlayAction($import_batch_id); > my $nomatch_action = GetImportBatchNoMatchAction($import_batch_id); > my $item_action = GetImportBatchItemAction($import_batch_id); >+ my @itypes = Koha::ItemTypes->search; > $template->param(biblio_list => \@list, > num_results => $num_records, > import_batch_id => $import_batch_id, >@@ -424,7 +587,12 @@ sub import_biblios_list { > "nomatch_action_${nomatch_action}" => 1, > nomatch_action => $nomatch_action, > "item_action_${item_action}" => 1, >- item_action => $item_action >+ item_action => $item_action, >+ item_error => $item_error, >+ branchloop => GetBranchesLoop(), >+ locationloop => \@locations, >+ itypeloop => \@itypes, >+ ccodeloop => \@ccodes, > ); > batch_info($template, $batch); > } >@@ -471,14 +639,14 @@ sub add_matcher_list { > } > > sub get_infos_syspref { >- my ($record, $field_list) = @_; >- my $syspref = C4::Context->preference('MarcFieldsToOrder'); >+ my ($syspref_name, $record, $field_list) = @_; >+ my $syspref = C4::Context->preference($syspref_name); > $syspref = "$syspref\n\n"; # YAML is anal on ending \n. Surplus does not hurt > my $yaml = eval { > YAML::Load($syspref); > }; > if ( $@ ) { >- warn "Unable to parse MarcFieldsToOrder syspref : $@"; >+ warn "Unable to parse $syspref syspref : $@"; > return (); > } > my $r; >@@ -496,3 +664,77 @@ sub get_infos_syspref { > } > return $r; > } >+ >+sub equal_number_of_fields { >+ my ($tags_list, $record) = @_; >+ my $refcount = 0; >+ my $count = 0; >+ for my $tag (@$tags_list) { >+ return -1 if $count != $refcount; >+ $count = 0; >+ for my $field ($record->field($tag)) { >+ $count++; >+ } >+ $refcount = $count if ($refcount == 0); >+ } >+ return -1 if $count != $refcount; >+ return $count; >+} >+ >+sub get_infos_syspref_on_item { >+ my ($syspref_name, $record, $field_list) = @_; >+ my $syspref = C4::Context->preference($syspref_name); >+ $syspref = "$syspref\n\n"; # YAML is anal on ending \n. Surplus does not hurt >+ my $yaml = eval { >+ YAML::Load($syspref); >+ }; >+ if ( $@ ) { >+ warn "Unable to parse $syspref syspref : $@"; >+ return (); >+ } >+ my @result; >+ my @tags_list; >+ >+ # Check tags in syspref definition >+ for my $field_name ( @$field_list ) { >+ next unless exists $yaml->{$field_name}; >+ my @fields = split /\|/, $yaml->{$field_name}; >+ for my $field ( @fields ) { >+ my ( $f, $sf ) = split /\$/, $field; >+ next unless $f and $sf; >+ push @tags_list, $f; >+ } >+ } >+ @tags_list = List::MoreUtils::uniq(@tags_list); >+ >+ my $tags_count = equal_number_of_fields(\@tags_list, $record); >+ # Return if the number of theses fields in the record is not the same. >+ return -1 if $tags_count == -1; >+ >+ # Gather the fields >+ my $fields_hash; >+ foreach my $tag (@tags_list) { >+ my @tmp_fields; >+ foreach my $field ($record->field($tag)) { >+ push @tmp_fields, $field; >+ } >+ $fields_hash->{$tag} = \@tmp_fields; >+ } >+ >+ for (my $i = 0; $i < $tags_count; $i++) { >+ my $r; >+ for my $field_name ( @$field_list ) { >+ next unless exists $yaml->{$field_name}; >+ my @fields = split /\|/, $yaml->{$field_name}; >+ for my $field ( @fields ) { >+ my ( $f, $sf ) = split /\$/, $field; >+ next unless $f and $sf; >+ my $v = $fields_hash->{$f}[$i]->subfield( $sf ); >+ $r->{$field_name} = $v if (defined $v); >+ last if $yaml->{$field}; >+ } >+ } >+ push @result, $r; >+ } >+ return \@result; >+} >diff --git a/installer/data/mysql/atomicupdate/Bug_15503_MarcItemFieldsToOrder.sql b/installer/data/mysql/atomicupdate/Bug_15503_MarcItemFieldsToOrder.sql >new file mode 100644 >index 0000000..1da8360 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/Bug_15503_MarcItemFieldsToOrder.sql >@@ -0,0 +1 @@ >+INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('MarcItemFieldsToOrder','','Set the mapping values for new item records created from a MARC record in a staged file. In a YAML format.', NULL, 'textarea'); >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 8329720..3d7a8a5 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -242,6 +242,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('ManInvInNoissuesCharge','1',NULL,'MANUAL_INV charges block checkouts (added to noissuescharge).','YesNo'), > ('MARCAuthorityControlField008','|| aca||aabn | a|a d',NULL,'Define the contents of MARC21 authority control field 008 position 06-39','Textarea'), > ('MarcFieldsToOrder','',NULL,'Set the mapping values for a new order line created from a MARC record in a staged file. In a YAML format.','textarea'), >+('MarcItemFieldsToOrder','',NULL,'Set the mapping values for new item records created from a MARC record in a staged file. In a YAML format.','textarea'), > ('MARCOrgCode','OSt','','Define MARC Organization Code for MARC21 records - http://www.loc.gov/marc/organizations/orgshome.html','free'), > ('MaxFine',NULL,'','Maximum fine a patron can have for all late returns at one moment. Single item caps are specified in the circulation rules matrix.','Integer'), > ('MaxItemsToDisplayForBatchDel','1000',NULL,'Display up to a given number of items in a single item deletionbatch.','Integer'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt >index aab8a4a..bc333a3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt >@@ -90,17 +90,17 @@ > > $("select[name='all_budget_id']").change(); > >- $("#records_to_import fieldset.rows ol").hide(); >+ $("#records_to_import fieldset.rows div").hide(); > $('input:checkbox[name="import_record_id"]').change(function(){ > var container = $(this).parents("fieldset"); > if ( $(this).is(':checked') ) { > $(container).addClass("selected"); > $(container).removeClass("unselected"); >- $(container).find("ol").toggle(true); >+ $(container).find("div").toggle(true); > } else { > $(container).addClass("unselected"); > $(container).removeClass("selected"); >- $(container).find("ol").toggle(false); >+ $(container).find("div").toggle(false); > } > } ); > >@@ -134,6 +134,17 @@ > if ( error > 0 ) { > alert(error + " " + _("quantity values are not filled in or are not numbers")); > return false; >+ >+ } >+ var error = 0; >+ $("select[name='budget_code']").each(function() { >+ if (!$(this).val()) { >+ error++; >+ } >+ }); >+ if ( error > 0 ) { >+ alert(_("Some budgets are not defined in item records")); >+ return false; > } > > return disableUnchecked($(this)); >@@ -238,6 +249,7 @@ > ( <a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% biblio.import_record_id %]" class="previewData">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&importid=[% biblio.import_record_id %]" class="previewData">Card</a> | <a href="/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=[% booksellerid %]&basketno=[% basketno %]&breedingid=[% biblio.import_record_id %]&import_batch_id=[% biblio.import_batch_id %]&biblionumber=[% biblio.match_biblionumber %]">Add order</a> ) > </span> > </legend> >+ <div style="float:left"> > <ol> > <li class="status"> > <span class="match"> >@@ -300,6 +312,80 @@ > <input id="sort2_record_[% biblio.import_record_id %]" type="text" id="sort2" size="20" name="sort2" value="[% biblio.sort2 %]" /> > </li> > </ol> >+ </div> >+ <div style="float:right"> >+ [% IF item_error %]Item records could not be processed because the number of item fields was uneven.[% END %] >+ [% FOREACH item IN biblio.iteminfos %] >+ <fieldset> >+ <legend>Item Record [% item.item_id %]</legend> >+ <ol> >+ <li> >+ <label for="homebranch_item_[% item.item_id %]">homebranch</label><select id="homebranch_item_[% item.item_id %]" name="homebranch"> >+ [% FOREACH branchloo IN branchloop %] >+ [% IF ( branchloo.value ) == ( item.homebranch ) %] >+ <option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option> >+ [% ELSE %] >+ <option value="[% branchloo.value %]">[% branchloo.branchname %]</option> >+ [% END %] >+ [% END %] >+ </select> >+ </li> >+ >+ <li><label for="holdingbranch_item_[% item.item_id %]">holdingbranch</label><select id="holdingbranch_item_[% item.item_id %]" name="holdingbranch"> >+ [% FOREACH branchloo IN branchloop %] >+ [% IF ( branchloo.value ) == ( item.holdingbranch ) %] >+ <option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option> >+ [% ELSE %] >+ <option value="[% branchloo.value %]">[% branchloo.branchname %]</option> >+ [% END %] >+ [% END %] >+ </select> >+ </li> >+ <li><label for="itype_item_[% item.item_id %]">itype</label><select id="itype_item_[% item.item_id %]" name="itype"> >+ [% FOREACH itypeloo IN itypeloop %] >+ [% IF ( itypeloo.value ) == ( item.itype ) %] >+ <option value="[% itypeloo.itemtype %]" selected="selected">[% itypeloo.description |html %]</option> >+ [% ELSE %] >+ <option value="[% itypeloo.itemtype %]">[% itypeloo.description |html %]</option> >+ [% END %] >+ [% END %] >+ </select> >+ </li> >+ >+ <li><label for="nonpublic_note_item_[% item.item_id %]">nonpublic_note</label><input type="text" id="nonpublic_note_item_[% item.item_id %]" name="nonpublic_note" value="[% item.nonpublic_note %]"></li> >+ <li><label for="public_note_item_[% item.item_id %]">public_note</label><input type="text" id="public_note_item_[% item.item_id %]" name="public_note" value="[% item.public_note %]"></li> >+ <li><label for="loc_item_[% item.item_id %]">loc</label><select id="loc_item_[% item.item_id %]" name="loc"> >+ <option value=""> </option> >+ [% FOREACH locationloo IN locationloop %] >+ [% IF ( locationloo.code ) == (item.loc) %]<option value="[% locationloo.code %]" selected="selected">[% locationloo.description %]</option>[% ELSE %]<option value="[% locationloo.code %]">[% locationloo.description %]</option>[% END %] >+ [% END %] >+ </select> >+ </li> >+ >+ <li><label for="ccode_item_[% item.item_id %]">ccode</label><select id="ccode_item_[% item.item_id %]" name="ccode"> >+ [% FOREACH ccodeloo IN ccodeloop %] >+ [% IF ( ccodeloo.code ) == (item.ccode) %]<option value="[% ccodeloo.code %]" selected="selected">[% ccodeloo.description %]</option>[% ELSE %]<option value="[% ccodeloo.code %]">[% ccodeloo.description %]</option>[% END %] >+ [% END %] >+ </select> >+ </li> >+ >+ <li><label for="notforloan_item_[% item.item_id %]">notforloan</label><input type="text" id="notforloan_item_[% item.item_id %]" name="notforloan" value="[% item.notforloan %]"></li> >+ <li><label for="uri_item_[% item.item_id %]">uri</label><input type="text" id="uri_item_[% item.item_id %]" name="uri" value="[% item.uri %]"></li> >+ <li><label for="copyno_item_[% item.item_id %]">copyno</label><input type="text" id="copyno_item_[% item.item_id %]" name="copyno" value="[% item.copyno %]"></li> >+ <li><label for="budget_code_item_[% item.item_id %]">budget_code</label><select id="budget_code_item_[% item.item_id %]" name="budget_code"> >+ <option value="">Select a fund</option> >+ [% FOREACH budget_loo IN budget_loop %] >+ [% IF ( budget_loo.b_code ) == ( item.budget_code ) %]<option value="[% budget_loo.b_id %]" selected="selected">[% budget_loo.b_txt %]</option> >+ [% ELSE %]<option value="[% budget_loo.b_id %]">[% budget_loo.b_txt %]</option> >+ [% END %] >+ [% END %] >+ </select> >+ </li> >+ <li><label for="price_item_[% item.item_id %]">price</label><input type="text" id="price_item_[% item.item_id %]" name="itemprice" value="[% item.itemprice %]"></li> >+ </ol> >+ </fieldset> >+ [% END %] >+ </div> > </fieldset> > <div id="dataPreview" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true"> > <div class="modal-dialog"> >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 0c45ed5..d3cf4a7 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 >@@ -63,6 +63,12 @@ Acquisitions: > - "You can use the following fields: price, quantity, budget_code, discount, sort1, sort2" > - "<br/>For example:<br/>price: 947$a|947$c<br/>quantity: 969$h<br/>budget_code: 922$a" > - >+ - Set the mapping values for new item records created from a MARC record in a staged file. >+ - pref: MarcItemFieldsToOrder >+ type: textarea >+ - "You can use the following fields: homebranch, holdingbranch, itype, nonpublic_note, public_note, loc, ccode, notforloan, uri, copyno and price. Special fields: quantity and budget_code" >+ - "<br/>For example:<br/>holdingbranch: 975$b<br/>itype: 975$9|975$z" >+ - > - pref: ClaimsBccCopy > default: no > choices: >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 15503
:
53493
|
54480
|
54660
|
55057
|
55616
|
55617
|
55926
|
55927
|
55928
|
56851
|
56852
|
57123
|
57124
|
57125
|
57715
|
58103
|
58132
|
58164
|
58165
|
58166
|
58376
|
58377
|
59093
|
59097
|
59415
|
59416
|
59417
|
59418
|
59419
|
59420
|
59421
|
59515
|
60025
|
60026
|
60027
|
60028
|
60029
|
60030
|
60031
|
60032
|
60203
|
60204
|
60205
|
60206
|
60207
|
60208
|
60209
|
60210
|
60211