Bug 5578: Self checkout by Login enhancement
[koha.git] / circ / circulation.pl
index 539b88c..1e7d42e 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/perl
 
-# written 8/5/2002 by Finlay
 # script to execute issuing of books
 
 # Copyright 2000-2002 Katipo Communications
+# copyright 2010 BibLibre
 #
 # This file is part of Koha.
 #
@@ -16,9 +16,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.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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., 59 Temple Place,
+# Suite 330, Boston, MA  02111-1307 USA
 
 use strict;
 #use warnings; FIXME - Bug 2505
@@ -109,6 +109,10 @@ if (C4::Context->preference("DisplayClearScreenButton")) {
     $template->param(DisplayClearScreenButton => 1);
 }
 
+if (C4::Context->preference("UseTablesortForCirc")) {
+    $template->param(UseTablesortForCirc => 1);
+}
+
 my $barcode        = $query->param('barcode') || '';
 $barcode =~  s/^\s*|\s*$//g; # remove leading/trailing whitespace
 
@@ -132,37 +136,25 @@ if ( $barcode ) {
     }
 }
 
-my ($datedue,$invalidduedate,$globalduedate);
+my ($datedue,$invalidduedate);
 
-if(C4::Context->preference('globalDueDate') && (C4::Context->preference('globalDueDate') =~ C4::Dates->regexp('syspref'))){
-        $globalduedate = C4::Dates->new(C4::Context->preference('globalDueDate'));
-}
 my $duedatespec_allow = C4::Context->preference('SpecifyDueDate');
 if($duedatespec_allow){
     if ($duedatespec) {
         if ($duedatespec =~ C4::Dates->regexp('syspref')) {
             my $tempdate = C4::Dates->new($duedatespec);
-            if ($tempdate and $tempdate->output('iso') gt C4::Dates->new()->output('iso')) {
-                # i.e., it has to be later than today/now
+#           if ($tempdate and $tempdate->output('iso') gt C4::Dates->new()->output('iso')) {
+#               # i.e., it has to be later than today/now
                 $datedue = $tempdate;
-            } else {
-                $invalidduedate = 1;
-                $template->param(IMPOSSIBLE=>1, INVALID_DATE=>$duedatespec);
-            }
+#           } else {
+#               $invalidduedate = 1;
+#               $template->param(IMPOSSIBLE=>1, INVALID_DATE=>$duedatespec);
+#           }
         } else {
             $invalidduedate = 1;
             $template->param(IMPOSSIBLE=>1, INVALID_DATE=>$duedatespec);
         }
-    } else {
-        # pass global due date to tmpl if specifyduedate is true 
-        # and we have no barcode (loading circ page but not checking out)
-        if($globalduedate &&  ! $barcode ){
-            $duedatespec = $globalduedate->output();
-            $stickyduedate = 1;
-        }
     }
-} else {
-    $datedue = $globalduedate if ($globalduedate);
 }
 
 my $todaysdate = C4::Dates->new->output('iso');
@@ -298,6 +290,7 @@ if ($barcode) {
                 $template->param(
                     $needsconfirmation => $$question{$needsconfirmation},
                     getTitleMessageIteminfo => $getmessageiteminfo->{'title'},
+                    getBarcodeMessageIteminfo => $getmessageiteminfo->{'barcode'},
                     NEEDSCONFIRMATION  => 1
                 );
                 $confirm_required = 1;
@@ -306,10 +299,6 @@ if ($barcode) {
         unless($confirm_required) {
             AddIssue( $borrower, $barcode, $datedue, $cancelreserve );
             $inprocess = 1;
-            if($globalduedate && ! $stickyduedate && $duedatespec_allow ){
-                $duedatespec = $globalduedate->output();
-                $stickyduedate = 1;
-            }
         }
     }
     
@@ -347,6 +336,7 @@ if ($borrowernumber) {
         $getreserv{nottransfered} = 0;
 
         $getreserv{reservedate}    = format_date( $num_res->{'reservedate'} );
+        $getreserv{reservenumber}  = $num_res->{'reservenumber'};
         $getreserv{title}          = $getiteminfo->{'title'};
         $getreserv{itemtype}       = $itemtypeinfo->{'description'};
         $getreserv{author}         = $getiteminfo->{'author'};
@@ -488,7 +478,7 @@ if ($borrowerslist) {
         -id       => 'borrowernumber',
         -values   => \@values,
         -labels   => \%labels,
-       -onclick  => "window.location = '/cgi-bin/koha/circ/circulation.pl?borrowernumber=' + this.value;",
+        -ondblclick => 'document.forms[\'mainform\'].submit()',
         -size     => 7,
         -tabindex => '',
         -multiple => 0
@@ -609,6 +599,11 @@ if($bor_messages_loop){ $template->param(flagged => 1 ); }
 my (undef, $roadttype_hashref) = &GetRoadTypes();
 my $address = $borrower->{'streetnumber'}.' '.$roadttype_hashref->{$borrower->{'streettype'}}.' '.$borrower->{'address'};
 
+my $fast_cataloging = 0;
+    if (defined getframeworkinfo('FA')) {
+    $fast_cataloging = 1 
+    }
+
 $template->param(
     lib_messages_loop => $lib_messages_loop,
     bor_messages_loop => $bor_messages_loop,
@@ -652,6 +647,7 @@ $template->param(
     is_child          => ($borrower->{'category_type'} eq 'C'),
     circview => 1,
     soundon           => C4::Context->preference("SoundOn"),
+    fast_cataloging   => $fast_cataloging,
 );
 
 # save stickyduedate to session