Merge commit 'kc/master'
[koha.git] / reserve / request.pl
index 561bb5a..859a65b 100755 (executable)
@@ -15,9 +15,9 @@
 # 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.
 
 =head1 request.pl
 
@@ -51,7 +51,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
         query           => $input,
         type            => "intranet",
         authnotrequired => 0,
-        flagsrequired   => { reserveforothers => 1 },
+        flagsrequired   => { reserveforothers => 'place_holds' },
     }
 );
 
@@ -479,7 +479,7 @@ foreach my $biblionumber (@biblionumbers) {
                 );
         }
         
-        if ( defined $res->{'found'} && $res->{'found'} eq 'W' ) {
+        if ( defined $res->{'found'} && $res->{'found'} eq 'W' || $res->{'found'} eq 'T' ) {
             my $item = $res->{'itemnumber'};
             $item = GetBiblioFromItemNumber($item,undef);
             $reserve{'wait'}= 1; 
@@ -494,6 +494,7 @@ foreach my $biblionumber (@biblionumbers) {
             }
             # set found to 1 if reserve is waiting for patron pickup
             $reserve{'found'} = 1 if $res->{'found'} eq 'W';
+            $reserve{'intransit'} = 1 if $res->{'found'} eq 'T';
         } elsif ($res->{priority} > 0) {
             if (defined($res->{itemnumber})) {
                 my $item = GetItem($res->{itemnumber});
@@ -509,7 +510,8 @@ foreach my $biblionumber (@biblionumbers) {
            $reserve{'hidename'} = 1;
            $reserve{'cardnumber'} = $reserveborrowerinfo->{'cardnumber'};
        }
-        $reserve{'expirationdate'} = format_date( $res->{'expirationdate'} ) unless ( $res->{'expirationdate'} eq '0000-00-00' );
+        $reserve{'expirationdate'} = format_date( $res->{'expirationdate'} ) 
+            unless ( !defined($res->{'expirationdate'}) || $res->{'expirationdate'} eq '0000-00-00' );
         $reserve{'date'}           = format_date( $res->{'reservedate'} );
         $reserve{'borrowernumber'} = $res->{'borrowernumber'};
         $reserve{'biblionumber'}   = $res->{'biblionumber'};
@@ -585,7 +587,7 @@ if ($multihold) {
 }
 
 if ( C4::Context->preference( 'AllowHoldDateInFuture' ) ) {
-  template->param( reserve_in_future => 1 );
+    $template->param( reserve_in_future => 1 );
 }
     
 # printout the page