Bug 11529: Remove duplicate column name from select query
[koha-ffzg.git] / circ / reserveratios.pl
index 5d87cd1..66eebd3 100755 (executable)
@@ -18,8 +18,7 @@
 # You should have received a copy of the GNU General Public License
 # along with Koha; if not, see <http://www.gnu.org/licenses>.
 
-use strict;
-use warnings;
+use Modern::Perl;
 
 use CGI qw ( -utf8 );
 use Date::Calc qw/Today Add_Delta_YM/;
@@ -28,7 +27,6 @@ use C4::Context;
 use C4::Output;
 use C4::Auth;
 use C4::Debug;
-use C4::Biblio qw/GetMarcBiblio GetRecordValue GetFrameworkCode/;
 use C4::Acquisition qw/GetOrdersByBiblionumber/;
 use Koha::DateUtils;
 use Koha::Acquisition::Baskets;
@@ -56,7 +54,7 @@ if ($booksellerid && $basketno) {
      $template->param( booksellerid => $booksellerid, basketno => $basketno );
 }
 
-my $effective_create_items;
+my $effective_create_items = q{};
 if ( $basketno ){
     my $basket = Koha::Acquisition::Baskets->find( $basketno );
     if ($basket){
@@ -126,6 +124,10 @@ my $strsth =
 
         reserves.found,
         biblio.title,
+        biblio.subtitle,
+        biblio.medium,
+        biblio.part_number,
+        biblio.part_name,
         biblio.author,
         count(DISTINCT reserves.borrowernumber) as reservecount, 
         count(DISTINCT items.itemnumber) $include_aqorders_qty as itemcount
@@ -155,8 +157,6 @@ while ( my $data = $sth->fetchrow_hashref ) {
     my $thisratio = $data->{reservecount} / $data->{itemcount};
     my $ratiocalc = ($thisratio / $ratio);
     ($thisratio / $ratio) >= 1 or next;  # TODO: tighter targeting -- get ratio limit into SQL using HAVING clause
-    my $record = GetMarcBiblio({ biblionumber => $data->{biblionumber} });
-    $data->{subtitle} = GetRecordValue('subtitle', $record, GetFrameworkCode($data->{biblionumber}));
     push(
         @reservedata,
         {
@@ -164,7 +164,7 @@ while ( my $data = $sth->fetchrow_hashref ) {
             priority           => $data->{priority},
             name               => $data->{borrower},
             title              => $data->{title},
-            subtitle           => $data->{subtitle},
+            subtitle           => C4::Biblio::SplitKohaField($data->{'subtitle'}),
             author             => $data->{author},
             itemnum            => $data->{itemnumber},
             biblionumber       => $data->{biblionumber},