Bugzilla – Attachment 148300 Details for
Bug 32437
When adding to a basket form a staged file and matching the imported records are ignored when set to overwrite
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32437: Cleanup script
Bug-32437-Cleanup-script.patch (text/plain), 5.21 KB, created by
Marcel de Rooy
on 2023-03-17 08:28:43 UTC
(
hide
)
Description:
Bug 32437: Cleanup script
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2023-03-17 08:28:43 UTC
Size:
5.21 KB
patch
obsolete
>From 6e1b87b9e38257bee830eee44a6aa4baf56bb33a Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 9 Dec 2022 16:18:40 +0000 >Subject: [PATCH] Bug 32437: Cleanup script >Content-Type: text/plain; charset=utf-8 > >This patch: >- fixes some indentation >- flips unless-else to if-else for readability >- expands some comments for clarity >- removes unused biblioitemnum variable > >Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > acqui/addorderiso2709.pl | 60 +++++++++++++++++++--------------------- > 1 file changed, 29 insertions(+), 31 deletions(-) > >diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl >index b18e68806b..eefcabcf4a 100755 >--- a/acqui/addorderiso2709.pl >+++ b/acqui/addorderiso2709.pl >@@ -169,7 +169,9 @@ if ($op eq ""){ > my $c_price = shift( @prices ) || GetMarcPrice($marcrecord, C4::Context->preference('marcflavour')); > > # Insert the biblio, or find it through matcher >- unless ( $biblionumber ) { >+ if ( $biblionumber ) { # If matched during staging we can continue >+ $import_record->status('imported')->store; >+ } else { # Otherwise we check for duplicates, and skip if they exist > if ($matcher_id) { > if ( $matcher_id eq '_TITLE_AUTHOR_' ) { > $duplifound = 1 if FindDuplicate($marcrecord); >@@ -183,10 +185,8 @@ if ($op eq ""){ > $duplinbatch = $import_batch_id and next if $duplifound; > } > >- # add the biblio >- my $bibitemnum; >- >- # remove ISBN - >+ # remove hyphens (-) from ISBN >+ # FIXME: This should probably be optional > my ( $isbnfield, $isbnsubfield ) = GetMarcFromKohaField( 'biblioitems.isbn' ); > if ( $marcrecord->field($isbnfield) ) { > foreach my $field ( $marcrecord->field($isbnfield) ) { >@@ -197,9 +197,9 @@ if ($op eq ""){ > } > } > } >- ( $biblionumber, $bibitemnum ) = AddBiblio( $marcrecord, $cgiparams->{'frameworkcode'} || '' ); >- $import_record->status('imported')->store; >- } else { >+ >+ # add the biblio >+ ( $biblionumber, undef ) = AddBiblio( $marcrecord, $cgiparams->{'frameworkcode'} || '' ); > $import_record->status('imported')->store; > } > >@@ -334,30 +334,28 @@ if ($op eq ""){ > $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 ); >- $order->populate_with_prices_for_ordering(); >- $order->populate_with_prices_for_receiving(); >- $order->store; >- >- # 4th, add items if applicable >- # parse the item sent by the form, and create an item just for the import_record_id we are dealing with >- # this is not optimised, but it's working ! >- if ( $basket->effective_create_items eq 'ordering' && !$basket->is_standing ) { >- my @tags = $input->multi_param('tag'); >- my @subfields = $input->multi_param('subfield'); >- my @field_values = $input->multi_param('field_value'); >- my @serials = $input->multi_param('serial'); >- my $xml = TransformHtmlToXml( \@tags, \@subfields, \@field_values ); >- my $record = MARC::Record::new_from_xml( $xml, 'UTF-8' ); >- for (my $qtyloop=1;$qtyloop <= $c_quantity;$qtyloop++) { >- my ( $biblionumber, $bibitemnum, $itemnumber ) = AddItemFromMarc( $record, $biblionumber ); >- $order->add_item( $itemnumber ); >+ # 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 ); >+ $order->populate_with_prices_for_ordering(); >+ $order->populate_with_prices_for_receiving(); >+ $order->store; >+ >+ # 4th, add items if applicable >+ # parse the item sent by the form, and create an item just for the import_record_id we are dealing with >+ # this is not optimised, but it's working ! >+ if ( $basket->effective_create_items eq 'ordering' && !$basket->is_standing ) { >+ my @tags = $input->multi_param('tag'); >+ my @subfields = $input->multi_param('subfield'); >+ my @field_values = $input->multi_param('field_value'); >+ my @serials = $input->multi_param('serial'); >+ my $xml = TransformHtmlToXml( \@tags, \@subfields, \@field_values ); >+ my $record = MARC::Record::new_from_xml( $xml, 'UTF-8' ); >+ for (my $qtyloop=1;$qtyloop <= $c_quantity;$qtyloop++) { >+ my ( $biblionumber, undef, $itemnumber ) = AddItemFromMarc( $record, $biblionumber ); >+ $order->add_item( $itemnumber ); > } >- } else { >- $import_record->status( 'imported' )->store; > } > } > $imported++; >-- >2.30.2
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 32437
:
144538
|
144539
|
144540
|
144541
|
144573
|
144574
|
144575
|
144576
|
145223
|
145224
|
145225
|
145226
|
147677
|
147678
|
147679
|
147680
|
147681
|
148270
|
148271
|
148272
|
148273
|
148274
|
148275
|
148276
|
148277
| 148300 |
148301
|
148302
|
148303
|
148304
|
148305
|
148306