This patch allows the Branch Transfer Limits feature to limit transfers either by...
[koha_fer] / circ / circulation.pl
index 15eb8e7..d51f2d3 100755 (executable)
@@ -1,7 +1,5 @@
 #!/usr/bin/perl
 
-# Please use 8-character tabs for this file (indents are every 4 characters)
-
 # written 8/5/2002 by Finlay
 # script to execute issuing of books
 
@@ -23,6 +21,7 @@
 # Suite 330, Boston, MA  02111-1307 USA
 
 use strict;
+# use warnings;  # FIXME
 use CGI;
 use C4::Output;
 use C4::Print;
@@ -87,7 +86,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user (
         query           => $query,
         type            => "intranet",
         authnotrequired => 0,
-        flagsrequired   => { circulate => 1 },
+        flagsrequired   => { circulate => 'circulate_remaining_permissions' },
     }
 );
 
@@ -108,12 +107,9 @@ $printer = C4::Context->userenv->{'branchprinter'};
 
 
 # If Autolocated is not activated, we show the Circulation Parameters to chage settings of librarian
-    if (C4::Context->preference("AutoLocation") ne 1)
-        {
-            $template->param(
-            ManualLocation => 1,
-            );
-        }
+if (C4::Context->preference("AutoLocation") ne 1) { # FIXME: string comparison to number
+    $template->param(ManualLocation => 1);
+}
 
 my $barcode        = $query->param('barcode') || '';
 
@@ -200,6 +196,14 @@ if ($findborrower) {
     my ( $count, $borrowers ) =
       SearchMember($findborrower, 'cardnumber', 'web' );
     my @borrowers = @$borrowers;
+        $template->param(
+                "AddPatronLists_".C4::Context->preference("AddPatronLists")=> "1",
+        );
+        if (C4::Context->preference("AddPatronLists")=~/code/){
+                my $categories=GetBorrowercategoryList;
+                $categories->[0]->{'first'}=1;
+                $template->param(categories=>$categories);
+        }
     if ( $#borrowers == -1 ) {
         $query->param( 'findborrower', '' );
         $message = "'$findborrower'";
@@ -426,7 +430,7 @@ my @issued_itemtypes_count_loop;
 
 if ($borrower) {
 # get each issue of the borrower & separate them in todayissues & previous issues
-    my ($countissues,$issueslist) = GetPendingIssues($borrower->{'borrowernumber'});
+    my ($issueslist) = GetPendingIssues($borrower->{'borrowernumber'});
 
     # split in 2 arrays for today & previous
     foreach my $it ( @$issueslist ) {
@@ -486,7 +490,7 @@ FROM issuingrules
   WHERE categorycode=?
 " );
 #my @issued_itemtypes_count;  # huh?
-$issueqty_sth->execute("*");   # FIXME: Why have a WHERE clause at all with a hardcoded "*"?
+$issueqty_sth->execute("*");   # This is a literal asterisk, not a wildcard.
 
 while ( my $data = $issueqty_sth->fetchrow_hashref() ) {
 
@@ -529,6 +533,7 @@ if ($borrowerslist) {
         -id       => 'borrowernumber',
         -values   => \@values,
         -labels   => \%labels,
+       -onclick  => "window.location = '/cgi-bin/koha/circ/circulation.pl?borrowernumber=' + this.value;",
         -size     => 7,
         -tabindex => '',
         -multiple => 0