Changes to installed indexing.
[koha.git] / C4 / Auth.pm
old mode 100755 (executable)
new mode 100644 (file)
index 98c151e..7a5f6a3
@@ -265,6 +265,7 @@ sub get_template_and_user {
             LoginSurname                 => C4::Context->userenv?C4::Context->userenv->{"surname"}:"Inconnu",
             TagsEnabled                  => C4::Context->preference("TagsEnabled"),
             hide_marc                    => C4::Context->preference("hide_marc"),
+            dateformat                   => C4::Context->preference("dateformat"),
             'item-level_itypes'          => C4::Context->preference('item-level_itypes'),
             patronimages                 => C4::Context->preference("patronimages"),
             singleBranchMode             => C4::Context->preference("singleBranchMode"),
@@ -301,7 +302,7 @@ sub get_template_and_user {
         $LibraryNameTitle =~ s/<(?:\/?)(?:br|p)\s*(?:\/?)>/ /sgi;
         $LibraryNameTitle =~ s/<(?:[^<>'"]|'(?:[^']*)'|"(?:[^"]*)")*>//sg;
         $template->param(
-            AmazonContent             => "" . C4::Context->preference("AmazonContent"),
+            OPACAmazonContent             => "" . C4::Context->preference("OPACAmazonContent"),
             AnonSuggestions           => "" . C4::Context->preference("AnonSuggestions"),
             AuthorisedValueImages     => C4::Context->preference("AuthorisedValueImages"),
             LibraryName               => "" . C4::Context->preference("LibraryName"),
@@ -346,7 +347,6 @@ sub get_template_and_user {
             virtualshelves            => "" . C4::Context->preference("virtualshelves"),
         );
     }
-       $template->param(listloop=>[{shelfname=>"Freelist", shelfnumber=>110}]);
     return ( $template, $borrowernumber, $cookie, $flags);
 }
 
@@ -356,8 +356,8 @@ sub get_template_and_user {
 
 Verifies that the user is authorized to run this script.  If
 the user is authorized, a (userid, cookie, session-id, flags)
-quadruple is returned.  If the user is not authorized but does
-not have the required privilege (see $flagsrequired below), it
+quadruple is returned.  If the user is not authorized due to
+insufficent privileges (see $flagsrequired below), it
 displays an error page and exits.  Otherwise, it displays the
 login page and exits.
 
@@ -711,16 +711,16 @@ sub checkauth {
                                # and the number of lists to be displayed of each type in the 'Lists' button drop down
                                my $row_count = 10; # FIXME:This probably should be a syspref
                                my ($total, $totshelves, $barshelves, $pubshelves);
-                               ($barshelves, $totshelves) = GetRecentShelves(1, $row_count, $borrowernumber);
+                               ($barshelves, $totshelves) = C4::VirtualShelves::GetRecentShelves(1, $row_count, $borrowernumber);
                                $total->{'bartotal'} = $totshelves;
-                               ($pubshelves, $totshelves) = GetRecentShelves(2, $row_count, undef);
+                               ($pubshelves, $totshelves) = C4::VirtualShelves::GetRecentShelves(2, $row_count, undef);
                                $total->{'pubtotal'} = $totshelves;
-                               $session->param('barshelves', ${@$barshelves}[0]);
-                               $session->param('pubshelves', ${@$pubshelves}[0]);
+                               $session->param('barshelves', $barshelves->[0]);
+                               $session->param('pubshelves', $pubshelves->[0]);
                                $session->param('totshelves', $total);
                                
-                               C4::Context::set_shelves_userenv('bar',${@$barshelves}[0]);
-                               C4::Context::set_shelves_userenv('pub',${@$pubshelves}[0]);
+                               C4::Context::set_shelves_userenv('bar',$barshelves->[0]);
+                               C4::Context::set_shelves_userenv('pub',$pubshelves->[0]);
                                C4::Context::set_shelves_userenv('tot',$total);
                        }
                else {
@@ -738,11 +738,11 @@ sub checkauth {
                        # Grab the public shelves and add to the session...
                        my $row_count = 20; # FIXME:This probably should be a syspref
                        my ($total, $totshelves, $pubshelves);
-                       ($pubshelves, $totshelves) = GetRecentShelves(2, $row_count, undef);
+                       ($pubshelves, $totshelves) = C4::VirtualShelves::GetRecentShelves(2, $row_count, undef);
                        $total->{'pubtotal'} = $totshelves;
-                       $session->param('pubshelves', ${@$pubshelves}[0]);
-                       $session->param('pubtotal', $total->{'pubtotal'});
-                       C4::Context::set_shelves_userenv('pub',${@$pubshelves}[0]);
+                       $session->param('pubshelves', $pubshelves->[0]);
+                       $session->param('totshelves', $total);
+                       C4::Context::set_shelves_userenv('pub',$pubshelves->[0]);
                        C4::Context::set_shelves_userenv('tot',$total);
                        
                        # setting a couple of other session vars...
@@ -1212,7 +1212,7 @@ sub checkpw {
 
     my ( $dbh, $userid, $password ) = @_;
     if ($ldap) {
-        $debug and print "## checkpw - checking LDAP\n";
+        $debug and print STDERR "## checkpw - checking LDAP\n";
         my ($retval,$retcard) = checkpw_ldap(@_);    # EXTERNAL AUTH
         ($retval) and return ($retval,$retcard);
     }
@@ -1341,11 +1341,11 @@ sub get_user_subpermissions {
     my $userid = shift;
 
     my $dbh = C4::Context->dbh;
-    my $sth = $dbh->prepare("SELECT flag, code
+    my $sth = $dbh->prepare("SELECT flag, user_permissions.code as code
                              FROM user_permissions
                              JOIN permissions USING (module_bit, code)
-                             JOIN userflags ON (module_bit = bit)
-                             JOIN borrowers USING (borrowernumber)
+                             JOIN userflags ON (permissions.module_bit = userflags.bit)
+                             JOIN borrowers ON (user_permissions.borrowernumber=borrowers.borrowernumber)
                              WHERE userid = ?");
     $sth->execute($userid);