# Copyright 2009 BibLibre
+# Parts Copyright Catalyst IT 2011
#
# This file is part of Koha.
#
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA 02111-1307 USA
+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use strict;
+#use warnings; FIXME - Bug 2505
use CGI;
use C4::Output;
use C4::Auth;
use C4::Items;
use C4::Biblio;
use C4::Serials;
-use YAML;
+use C4::Reserves qw/MergeHolds/;
my $input = new CGI;
my @biblionumber = $input->param('biblionumber');
#------------------------
if ($merge) {
- my @params = $input->param();
my $dbh = C4::Context->dbh;
my $sth;
# Creating a new record from the html code
- my $record = TransformHtmlToMarc( \@params , $input );
+ my $record = TransformHtmlToMarc( $input );
my $tobiblio = $input->param('biblio1');
my $frombiblio = $input->param('biblio2');
+
+ # Rewriting the leader
+ $record->leader(GetMarcBiblio($tobiblio)->leader());
+
my $frameworkcode = &GetFrameworkCode($tobiblio);
my @notmoveditems;
# Moving items from the other record to the reference record
my $itemnumbers = get_itemnumbers_of($frombiblio);
- use Data::Dumper;
foreach my $itloop ($itemnumbers->{$frombiblio}) {
foreach my $itemnumber (@$itloop) {
my $res = MoveItemFromBiblio($itemnumber, $frombiblio, $tobiblio);
# Deleting the other record
if (scalar(@errors) == 0) {
+ # Move holds
+ MergeHolds($dbh,$tobiblio,$frombiblio);
my $error = DelBiblio($frombiblio);
push @errors, $error if ($error);
}
my @errors_loop = map{{error => $_}}@errors;
# Parameters
- $template->param({
+ $template->param(
errors => \@errors_loop,
result => 1,
biblio1 => $input->param('biblio1')
- });
+ );
#-------------------------
# Ask the user to choose which record will be the kept
if (not $mergereference) {
- $template->param({
+ $template->param(
choosereference => 1,
biblio1 => $biblionumber[0],
biblio2 => $biblionumber[1],
title1 => $data1->{'title'},
title2 => $data2->{'title'}
- });
+ );
} else {
if (scalar(@biblionumber) != 2) {
my @errors_loop = map{{error => $_}}@errors;
# Parameters
- $template->param({
+ $template->param(
errors => \@errors_loop,
biblio1 => $mergereference,
biblio2 => $notreference,
record1 => @record1,
record2 => @record2,
framework => $framework
- });
+ );
}
}
output_html_with_http_headers $input, $cookie, $template->output;
exit;
+=head1 FUNCTIONS
+
+=cut
# ------------------------
# Functions
}
-=item CreateKey
+=head2 CreateKey
- Create a random value to set it into the input name
+Create a random value to set it into the input name
=cut
}
+