Bugzilla – Attachment 5410 Details for
Bug 5473
952 fields should be filled in by Acquisitions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
0001-bug_5473-add-952-fields-MARC21-when-receiving-an-ord.patch (text/plain), 3.03 KB, created by
Srdjan Jankovic
on 2011-09-13 00:29:44 UTC
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Srdjan Jankovic
Created:
2011-09-13 00:29:44 UTC
Size:
3.03 KB
patch
obsolete
>From d0fd4208e44858cf266c61ccc59a7287647c89cd Mon Sep 17 00:00:00 2001 >From: Srdjan Jankovic <srdjan@catalyst.net.nz> >Date: Tue, 13 Sep 2011 12:26:03 +1200 >Subject: [PATCH] bug_5473: add 952 fields MARC21 when receiving an order > >--- > C4/Biblio.pm | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ > acqui/finishreceive.pl | 11 ++++++++++ > 2 files changed, 61 insertions(+), 0 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 96baaef..b0cb247 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -99,6 +99,7 @@ BEGIN { > &ModBiblio > &ModBiblioframework > &ModZebra >+ &AddMarcFields > ); > > # To delete something >@@ -3681,6 +3682,55 @@ sub get_biblio_authorised_values { > return $authorised_values; > } > >+=head2 AddMarcFields >+ >+Adds fields/subfields to existing marcxml >+ >+parameters: >+ biblionumber >+ fields >+ >+returns: nothing >+ >+ $fields: { tag1 => val1, tag2 => val2, ... } >+ $valX : $val for tags < 10, >+ [ subfld1 => subval1, subfld2 => subval2, ... ] for the rest >+ >+Notes: no indicator support >+ >+=cut >+ >+sub AddMarcFields { >+ my ( $biblionumber, $fields ) = @_; >+ >+ my $rec = GetMarcBiblio($biblionumber) or die "Invalid biblionumber $biblionumber"; >+ >+ while ( my ($tag, $val) = each %$fields ) { >+ if ( my ($field) = $rec->field($tag) ) { >+ if (ref $val) { >+ $field->update(@$val); >+ } else { >+ $field->update($val); >+ } >+ } >+ else { >+ my $newfield; >+ if (ref $val) { >+ $newfield = MARC::Field->new( $tag, '', '', @$val ); >+ } else { >+ $newfield = MARC::Field->new( $tag, $val ); >+ } >+ $rec->insert_fields_ordered($newfield); >+ } >+ } >+ >+ my $dbh = C4::Context->dbh; >+ my $encoding = C4::Context->preference("marcflavour"); >+ $dbh->do("UPDATE biblioitems SET marcxml=? WHERE biblionumber=?", undef, >+ $rec->as_xml_record($encoding), >+ $biblionumber ); >+} >+ > 1; > > __END__ >diff --git a/acqui/finishreceive.pl b/acqui/finishreceive.pl >index 71b13d6..9391b5c 100755 >--- a/acqui/finishreceive.pl >+++ b/acqui/finishreceive.pl >@@ -114,4 +114,15 @@ if ($quantityrec > $origquantityrec ) { > $datereceived = ModReceiveOrder($biblionumber,$ordernumber, $quantityrec ,$user,$unitprice,$invoiceno,$freight,$replacement,undef,$datereceived); > } > } >+ >+if (C4::Context->preference("marcflavour") eq "MARC21") { >+ AddMarcFields( $biblionumber, { 952 => [ e => $supplierid, >+ d => $datereceived, >+ g => $unitprice, >+ v => $replacement, >+ w => $datereceived, # XXX >+ ], >+ } ); >+} >+ > print $input->redirect("/cgi-bin/koha/acqui/parcel.pl?invoice=$invoiceno&supplierid=$supplierid&freight=$freight&gst=$gst&datereceived=$datereceived$error_url_str"); >-- >1.6.5 >
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 5473
:
5335
|
5348
|
5369
|
5410
|
6646
|
6855
|
6877
|
6888