Bug 5529 Absence or Presence of lists not being reliably returned
[koha.git] / cataloguing / merge.pl
index be84df5..eaf0c97 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);
@@ -176,6 +179,9 @@ if ($merge) {
 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