Bugzilla – Attachment 10738 Details for
Bug 7729
svc API should allow modification of items
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7729 : svc/new_bib: support ?items=1 to add POSTed items to the new biblio too
Bug-7729--svcnewbib-support-items1-to-add-POSTed-i.patch (text/plain), 1.96 KB, created by
Chris Cormack
on 2012-07-10 08:09:22 UTC
(
hide
)
Description:
Bug 7729 : svc/new_bib: support ?items=1 to add POSTed items to the new biblio too
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2012-07-10 08:09:22 UTC
Size:
1.96 KB
patch
obsolete
>From 9a7b100fd16b20518388ad2ff0512a97e8182aeb Mon Sep 17 00:00:00 2001 >From: MJ Ray <mjr@phonecoop.coop> >Date: Fri, 13 Apr 2012 17:15:21 +0100 >Subject: [PATCH] Bug 7729 : svc/new_bib: support ?items=1 to add POSTed items > to the new biblio too > >Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> >--- > svc/new_bib | 20 +++++++++++++++++--- > 1 file changed, 17 insertions(+), 3 deletions(-) > >diff --git a/svc/new_bib b/svc/new_bib >index dba1fc7..435d837 100755 >--- a/svc/new_bib >+++ b/svc/new_bib >@@ -24,6 +24,7 @@ use warnings; > use CGI; > use C4::Auth qw/check_api_auth/; > use C4::Biblio; >+use C4::Items; > use XML::Simple; > use C4::Charset; > >@@ -65,13 +66,26 @@ sub add_bib { > ($record, $guessed_charset, $charset_errors) = MarcToUTF8Record($record, $marcflavour); > } > >+ my $fullrecord = $record->clone(); >+ > # delete any item tags >- my ( $itemtag, $itemsubfield ) = GetMarcFromKohaField("items.itemnumber", ''); >- foreach my $field ($record->field($itemtag)) { >+ my ( $itemtag, $itemsubfield ) = >+ GetMarcFromKohaField( "items.itemnumber", '' ); >+ foreach my $field ( $record->field($itemtag) ) { > $record->delete_field($field); > } >- my ($biblionumber, $biblioitemnumber) = AddBiblio($record, ''); >+ my ( $biblionumber, $biblioitemnumber ) = AddBiblio( $record, '' ); > my $new_record = GetMarcBiblio($biblionumber); >+ if ( $query->url_param('items') ) { >+ foreach my $field ( $fullrecord->field($itemtag) ) { >+ my $one_item_record = $new_record->clone(); >+ $one_item_record->add_fields($field); >+ AddItemFromMarc( $one_item_record, $biblionumber ); >+ } >+ } >+ >+ $new_record = >+ GetMarcBiblio( $biblionumber, $query->url_param('items') ); > $result->{'status'} = "ok"; > $result->{'biblionumber'} = $biblionumber; > my $xml = $new_record->as_xml_record(); >-- >1.7.10
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 7729
:
8540
|
8544
|
9182
| 10738