Bug 19719: Add new column for collection in the patron checkouts data tables
[koha.git] / svc / checkouts
index d8d6156..d1fb8d3 100755 (executable)
@@ -17,8 +17,7 @@
 # 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;
+use Modern::Perl;
 
 use CGI;
 use JSON qw(to_json);
@@ -42,7 +41,7 @@ my $session   = get_session($sessionID);
 my $userid   = $session->param('id');
 
 unless (haspermission($userid, { circulate => 'circulate_remaining_permissions' })
-    || haspermission($userid, { borrowers => '*' })) {
+    || haspermission($userid, { borrowers => 'edit_borrowers' })) {
     exit 0;
 }
 
@@ -91,6 +90,8 @@ my $sql = '
         items.itype,
         biblioitems.itemtype,
 
+        items.ccode,
+
         borrowernumber,
         surname,
         firstname,
@@ -171,7 +172,8 @@ while ( my $c = $sth->fetchrow_hashref() ) {
         author               => $c->{author},
         barcode              => $c->{barcode},
         itemtype             => $item_level_itypes ? $c->{itype} : $c->{itemtype},
-        itemtype_description => $itemtype->translated_description,
+        itemtype_description => $itemtype ? $itemtype->translated_description : q{},
+        ccode                => $c->{ccode},
         location             => $location,
         homebranch           => $c->{homebranch},
         itemnotes            => $c->{itemnotes},
@@ -209,8 +211,10 @@ while ( my $c = $sth->fetchrow_hashref() ) {
                 as_due_date => 1
             }
         ),
-        subtitle =>
-          GetRecordValue( 'subtitle', GetMarcBiblio( $c->{biblionumber} ), GetFrameworkCode( $c->{biblionumber} ) ),
+        subtitle => GetRecordValue(
+            'subtitle',
+            GetMarcBiblio({ biblionumber => $c->{biblionumber} }),
+            GetFrameworkCode( $c->{biblionumber} ) ),
         lost    => $lost,
         damaged => $damaged,
         borrower => {