Bug 17600: Standardize our EXPORT_OK
[srvgit] / circ / transferstoreceive.pl
index 88f9aa6..d0545b2 100755 (executable)
 # 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 C4::Context;
-use C4::Output;
-use C4::Auth;
-use C4::Biblio;
-use C4::Circulation;
+use C4::Output qw( output_html_with_http_headers );
+use C4::Auth qw( get_template_and_user );
+use C4::Circulation qw( GetTransfers GetTransfersFromTo );
 use C4::Members;
-use Date::Calc qw(
-  Today
-  Add_Delta_Days
-  Date_to_Days
-);
+use Date::Calc qw( Add_Delta_Days Date_to_Days Today );
 
-use C4::Koha;
 use C4::Reserves;
 use Koha::Items;
 use Koha::ItemTypes;
 use Koha::Libraries;
-use Koha::DateUtils;
+use Koha::DateUtils qw( dt_from_string output_pref );
 use Koha::BiblioFrameworks;
 use Koha::Patrons;
 
-my $input = new CGI;
+my $input = CGI->new;
 my $itemnumber = $input->param('itemnumber');
 
 my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user(
@@ -50,9 +43,7 @@ my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user(
         template_name   => "circ/transferstoreceive.tt",
         query           => $input,
         type            => "intranet",
-        authnotrequired => 0,
         flagsrequired   => { circulate => "circulate_remaining_permissions" },
-        debug           => 1,
     }
 );
 
@@ -100,6 +91,10 @@ while ( my $library = $libraries->next ) {
             %getransf = (
                 %getransf,
                 title          => $biblio->title,
+                subtitle       => $biblio->subtitle,
+                medium         => $biblio->medium,
+                part_number    => $biblio->part_number,
+                part_name      => $biblio->part_name,
                 author         => $biblio->author,
                 biblionumber   => $biblio->biblionumber,
                 itemnumber     => $item->itemnumber,
@@ -109,19 +104,10 @@ while ( my $library = $libraries->next ) {
                 itemcallnumber => $item->itemcallnumber,
             );
 
-            my $record = GetMarcBiblio($biblio->biblionumber);
-            $getransf{'subtitle'} = GetRecordValue('subtitle', $record, $biblio->frameworkcode);
-
             # we check if we have a reserv for this transfer
             my $holds = $item->current_holds;
             if ( my $first_hold = $holds->next ) {
-                my $patron = Koha::Patrons->find( $first_hold->borrowernumber );
-                # FIXME The full patron object should be passed to the template
-                $getransf{'borrowernum'}       = $patron->borrowernumber;
-                $getransf{'borrowername'}      = $patron->surname;
-                $getransf{'borrowerfirstname'} = $patron->firstname;
-                $getransf{'borrowermail'}      = $patron->email if $patron->email;
-                $getransf{'borrowerphone'}     = $patron->phone;
+                $getransf{patron} = Koha::Patrons->find( $first_hold->borrowernumber );
             }
             push( @transferloop, \%getransf );
         }
@@ -135,8 +121,8 @@ while ( my $library = $libraries->next ) {
 $template->param(
     branchesloop => \@branchesloop,
     show_date    => output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }),
-       TransfersMaxDaysWarning => C4::Context->preference('TransfersMaxDaysWarning'),
-       latetransfers => $latetransfers ? 1 : 0,
+    TransfersMaxDaysWarning => C4::Context->preference('TransfersMaxDaysWarning'),
+    latetransfers => $latetransfers ? 1 : 0,
 );
 
 # Checking if there is a Fast Cataloging Framework