|
Lines 26-31
use C4::Auth qw( check_api_auth );
Link Here
|
| 26 |
use C4::Biblio qw( GetFrameworkCode ); |
26 |
use C4::Biblio qw( GetFrameworkCode ); |
| 27 |
use C4::Items; |
27 |
use C4::Items; |
| 28 |
use XML::Simple; |
28 |
use XML::Simple; |
|
|
29 |
use Koha::Biblios; |
| 29 |
|
30 |
|
| 30 |
my $query = CGI->new; |
31 |
my $query = CGI->new; |
| 31 |
binmode STDOUT, ':encoding(UTF-8)'; |
32 |
binmode STDOUT, ':encoding(UTF-8)'; |
|
Lines 65-73
exit 0;
Link Here
|
| 65 |
sub fetch_bib { |
66 |
sub fetch_bib { |
| 66 |
my $query = shift; |
67 |
my $query = shift; |
| 67 |
my $biblionumber = shift; |
68 |
my $biblionumber = shift; |
| 68 |
my $record = C4::Biblio::GetMarcBiblio({ |
69 |
my $biblio = Koha::Biblios->find( $biblionumber ); |
| 69 |
biblionumber => $biblionumber, |
70 |
my $record = $biblio->metadata->record({ embed_items => scalar $query->param('items') }); |
| 70 |
embed_items => scalar $query->param('items') }); |
|
|
| 71 |
if (defined $record) { |
71 |
if (defined $record) { |
| 72 |
print $query->header(-type => 'text/xml',-charset => 'utf-8',); |
72 |
print $query->header(-type => 'text/xml',-charset => 'utf-8',); |
| 73 |
print $record->as_xml_record(); |
73 |
print $record->as_xml_record(); |
|
Lines 79-85
sub fetch_bib {
Link Here
|
| 79 |
sub update_bib { |
79 |
sub update_bib { |
| 80 |
my $query = shift; |
80 |
my $query = shift; |
| 81 |
my $biblionumber = shift; |
81 |
my $biblionumber = shift; |
| 82 |
my $old_record = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber }); |
82 |
my $biblio = Koha::Biblios->find( $biblionumber ); |
|
|
83 |
my $old_record = $biblio->metadata->record; |
| 83 |
my $frameworkcode = $query->url_param('frameworkcode') // GetFrameworkCode($biblionumber); |
84 |
my $frameworkcode = $query->url_param('frameworkcode') // GetFrameworkCode($biblionumber); |
| 84 |
unless (defined $old_record) { |
85 |
unless (defined $old_record) { |
| 85 |
print $query->header(-type => 'text/xml', -status => '404 Not Found'); |
86 |
print $query->header(-type => 'text/xml', -status => '404 Not Found'); |
|
Lines 115-123
sub update_bib {
Link Here
|
| 115 |
} |
116 |
} |
| 116 |
|
117 |
|
| 117 |
C4::Biblio::ModBiblio( $record, $biblionumber, $frameworkcode ); |
118 |
C4::Biblio::ModBiblio( $record, $biblionumber, $frameworkcode ); |
| 118 |
my $new_record = C4::Biblio::GetMarcBiblio({ |
119 |
my $biblio = Koha::Biblios->find( $biblionumber ); |
| 119 |
biblionumber => $biblionumber, |
120 |
my $new_record = $biblio->metadata->record({ embed_items => scalar $query->url_param('items') }); |
| 120 |
embed_items => scalar $query->url_param('items') }); |
|
|
| 121 |
|
121 |
|
| 122 |
$result->{'status'} = "ok"; |
122 |
$result->{'status'} = "ok"; |
| 123 |
$result->{'biblionumber'} = $biblionumber; |
123 |
$result->{'biblionumber'} = $biblionumber; |