X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=tools%2FbatchMod.pl;h=921c4d66b03839c97bae22e578e83ea70ff56efe;hb=718473bdd2f156544e7f254fa7adce2890c51e2a;hp=7c03812640be8a5f50f55c0c169f91ab3a32142d;hpb=a9010530a331d9ee047e0d42a9f8206a206027a3;p=koha_fer diff --git a/tools/batchMod.pl b/tools/batchMod.pl index 7c03812640..921c4d66b0 100755 --- a/tools/batchMod.pl +++ b/tools/batchMod.pl @@ -169,7 +169,7 @@ if ($op eq "show"){ my @contentlist; if ($filefh){ while (my $content=<$filefh>){ - chomp $content; + $content =~ s/[\r\n]*$//; push @contentlist, $content if $content; } @@ -203,6 +203,9 @@ if ($op eq "show"){ } } + + # Flag to tell the template there are valid results, hidden or not + if(scalar(@itemnumbers) > 0){ $template->param("itemresults" => 1); } # Only display the items if there are no more than 1000 if (scalar(@itemnumbers) <= 1000) { $items_display_hashref=BuildItemsData(@itemnumbers); @@ -453,8 +456,11 @@ sub BuildItemsData{ # grab title, author, and ISBN to identify bib that the item # belongs to in the display - my $biblio=GetBiblioData($$itemdata{biblionumber}); - $this_row{bibinfo} = join("\n", @$biblio{qw(title author ISBN)}); + my $biblio=GetBiblioData($$itemdata{biblionumber}); + $this_row{title} = $biblio->{title}; + $this_row{author} = $biblio->{author}; + $this_row{isbn} = $biblio->{isbn}; + $this_row{biblionumber} = $biblio->{biblionumber}; if (%this_row) { push(@big_array, \%this_row); @@ -473,7 +479,11 @@ sub BuildItemsData{ $row_data{itemnumber} = $row->{itemnumber}; #reporting this_row values $row_data{'nomod'} = $row->{'nomod'}; - $row_data{bibinfo} = $row->{bibinfo}; + $row_data{bibinfo} = $row->{bibinfo}; + $row_data{author} = $row->{author}; + $row_data{title} = $row->{title}; + $row_data{isbn} = $row->{isbn}; + $row_data{biblionumber} = $row->{biblionumber}; push(@item_value_loop,\%row_data); } my @header_loop=map { { header_value=> $witness{$_}} } @witnesscodessorted; @@ -494,7 +504,7 @@ sub UpdateMarcWith { my @fields_to=$marcto->field($itemtag); foreach my $subfield ($fieldfrom->subfields()){ foreach my $field_to_update (@fields_to){ - $field_to_update->update($$subfield[0]=>$$subfield[1]) if ($$subfield[1]); + $field_to_update->update($$subfield[0]=>$$subfield[1]) if ($$subfield[1] != '' or $$subfield[1] == '0'); } } #warn "TO edited:",$marcto->as_formatted;