Lines 40-55
unless ($status eq "ok") {
Link Here
|
40 |
# do initial validation |
40 |
# do initial validation |
41 |
my $path_info = $query->path_info(); |
41 |
my $path_info = $query->path_info(); |
42 |
|
42 |
|
|
|
43 |
my $duplicate = undef; |
43 |
my $biblionumber = undef; |
44 |
my $biblionumber = undef; |
44 |
if ($path_info =~ m!^/(\d+)$!) { |
45 |
if ($path_info =~ m!^/(d?)(\d+)$!) { |
45 |
$biblionumber = $1; |
46 |
$duplicate = $1; |
|
|
47 |
$biblionumber = $2; |
46 |
} else { |
48 |
} else { |
47 |
print $query->header(-type => 'text/xml', -status => '400 Bad Request'); |
49 |
print $query->header(-type => 'text/xml', -status => '400 Bad Request'); |
48 |
} |
50 |
} |
49 |
|
51 |
|
50 |
# are we retrieving, updating or deleting a bib? |
52 |
# are we retrieving, updating or deleting a bib? |
51 |
if ($query->request_method eq "GET") { |
53 |
if ($query->request_method eq "GET") { |
52 |
fetch_bib($query, $biblionumber); |
54 |
fetch_bib($query, $biblionumber, $duplicate); |
53 |
} elsif ($query->request_method eq "POST") { |
55 |
} elsif ($query->request_method eq "POST") { |
54 |
update_bib($query, $biblionumber); |
56 |
update_bib($query, $biblionumber); |
55 |
} elsif ($query->request_method eq "DELETE") { |
57 |
} elsif ($query->request_method eq "DELETE") { |
Lines 65-74
exit 0;
Link Here
|
65 |
sub fetch_bib { |
67 |
sub fetch_bib { |
66 |
my $query = shift; |
68 |
my $query = shift; |
67 |
my $biblionumber = shift; |
69 |
my $biblionumber = shift; |
|
|
70 |
my $duplicate = shift; |
68 |
my $record = GetMarcBiblio({ |
71 |
my $record = GetMarcBiblio({ |
69 |
biblionumber => $biblionumber, |
72 |
biblionumber => $biblionumber, |
70 |
embed_items => scalar $query->param('items') }); |
73 |
embed_items => scalar $query->param('items') }); |
71 |
if (defined $record) { |
74 |
if (defined $record) { |
|
|
75 |
if( $duplicate && C4::Context->preference('autoControlNumber') eq 'biblionumber' ){ |
76 |
my @control_nums = $record->field('001'); |
77 |
$record->delete_fields(@control_nums); |
78 |
} |
72 |
print $query->header(-type => 'text/xml',-charset => 'utf-8',); |
79 |
print $query->header(-type => 'text/xml',-charset => 'utf-8',); |
73 |
print $record->as_xml_record(); |
80 |
print $record->as_xml_record(); |
74 |
} else { |
81 |
} else { |
75 |
- |
|
|