Bug 6308 - Show number of comments - new patch
[koha_fer] / cataloguing / merge.pl
index be84df5..cc2d01d 100755 (executable)
 # 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;
 
 my $input = new CGI;
 my @biblionumber = $input->param('biblionumber');
@@ -56,6 +56,10 @@ if ($merge) {
     my $record       = TransformHtmlToMarc( \@params , $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;
 
@@ -64,7 +68,6 @@ if ($merge) {
 
     # 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);
@@ -106,11 +109,11 @@ if ($merge) {
     my @errors_loop  = map{{error => $_}}@errors;
 
     # Parameters
-    $template->param({
+    $template->param(
        errors  => \@errors_loop,
        result => 1,
        biblio1 => $input->param('biblio1')
-    });
+    );
 
 
 #-------------------------
@@ -126,13 +129,13 @@ if ($merge) {
 
     # 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) {
@@ -162,7 +165,7 @@ if ($merge) {
        my @errors_loop  = map{{error => $_}}@errors;
 
        # Parameters
-       $template->param({
+       $template->param(
            errors  => \@errors_loop,
            biblio1 => $mergereference,
            biblio2 => $notreference,
@@ -170,12 +173,15 @@ if ($merge) {
            record1 => @record1,
            record2 => @record2,
            framework => $framework
-           });
+           );
     }
 }
 output_html_with_http_headers $input, $cookie, $template->output;
 exit;
 
+=head1 FUNCTIONS
+
+=cut
 
 # ------------------------
 # Functions
@@ -235,9 +241,9 @@ sub _createMarcHash {
 
 }
 
-=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