Bugzilla – Attachment 61129 Details for
Bug 18277
Koha::Biblio - Remove GetBiblionumberFromItemnumber
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18277: Remove GetBiblionumberFromItemnumber - create_analytical_rel.pl
Bug-18277-Remove-GetBiblionumberFromItemnumber---c.patch (text/plain), 3.44 KB, created by
Jonathan Druart
on 2017-03-15 19:53:46 UTC
(
hide
)
Description:
Bug 18277: Remove GetBiblionumberFromItemnumber - create_analytical_rel.pl
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-03-15 19:53:46 UTC
Size:
3.44 KB
patch
obsolete
>From 454e01796f16785531a9ed3da89a0fe05a2ce5d1 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 15 Mar 2017 12:39:01 -0300 >Subject: [PATCH] Bug 18277: Remove GetBiblionumberFromItemnumber - > create_analytical_rel.pl > >I have no idea how to test this patch, see bug 5528, or simply read the >code. >--- > misc/migration_tools/create_analytical_rel.pl | 57 ++++++++++++--------------- > 1 file changed, 26 insertions(+), 31 deletions(-) > >diff --git a/misc/migration_tools/create_analytical_rel.pl b/misc/migration_tools/create_analytical_rel.pl >index 7c970b5..3069a34 100755 >--- a/misc/migration_tools/create_analytical_rel.pl >+++ b/misc/migration_tools/create_analytical_rel.pl >@@ -12,6 +12,7 @@ BEGIN { > use C4::Context; > use C4::Biblio; > use C4::Items; >+use Koha::Items; > use Getopt::Long; > > $| = 1; >@@ -34,7 +35,6 @@ if (not $result or $want_help or not $do_update) { > > my $num_bibs_processed = 0; > my $num_bibs_modified = 0; >-my $num_nobib_foritemnumber = 0; > my $num_noitem_forbarcode = 0; > my $num_nobarcode_inhostfield =0; > my $num_hostfields_unabletomodify =0; >@@ -91,36 +91,31 @@ sub process_bib { > my $analyticfield = '773'; > foreach my $hostfield ( $bib->field($analyticfield) ) { > if(my $barcode = $hostfield->subfield('o')){ >- my $itemnumber = GetItemnumberFromBarcode($barcode); >- if ($itemnumber ne undef){ >- my $bibnumber = GetBiblionumberFromItemnumber($itemnumber); >- if ($bibnumber ne undef){ >- my $modif; >- if ($hostfield->subfield('0') ne $bibnumber){ >- $hostfield->update('0', $bibnumber); >- $modif = 1; >- } >- if ($hostfield->subfield('9') ne $itemnumber){ >- $hostfield->update('9', $itemnumber); >- $modif=1; >- } >- if ($modif){ >- $num_bibs_modified++; >- my $modresult = ModBiblio($bib, $biblionumber, ''); >- warn "Modifying biblio $biblionumber"; >- if (!$modresult){ >- warn "Unable to modify biblio $biblionumber with update host field"; >- $num_hostfields_unabletomodify++; >- } >- } >- } else { >- warn "No biblio record found corressponding to itemnumber $itemnumber"; >- $num_nobib_foritemnumber++; >- } >- } else { >- warn "No item record found for barcode $barcode"; >- $num_noitem_forbarcode++; >- } >+ my $item = Koha::Items->find({ barcode => $barcode }); >+ if ($item) { >+ my $modif; >+ if ( $hostfield->subfield('0') ne $biblionumber ) { >+ $hostfield->update( '0', $biblionumber ); >+ $modif = 1; >+ } >+ if ( $hostfield->subfield('9') ne $item->itemnumber ) { >+ $hostfield->update( '9', $item->itemnumber ); >+ $modif = 1; >+ } >+ if ($modif) { >+ $num_bibs_modified++; >+ my $modresult = ModBiblio( $bib, $biblionumber, '' ); >+ warn "Modifying biblio $biblionumber"; >+ if ( !$modresult ) { >+ warn "Unable to modify biblio $biblionumber with update host field"; >+ $num_hostfields_unabletomodify++; >+ } >+ } >+ } >+ else { >+ warn "No item record found for barcode $barcode"; >+ $num_noitem_forbarcode++; >+ } > } else{ > warn "No barcode in host field for biblionumber $biblionumber"; > $num_nobarcode_inhostfield++; >-- >2.9.3
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 18277
:
61127
|
61128
|
61129
|
61130
|
63301
|
63302
|
63303
|
63304
|
64819
|
64820
|
64821
|
64822
|
64892
|
64893
|
64894
|
64895
|
64896