Bug 7976: Remove the borrow permission
[srvgit] / C4 / Auth.pm
index e136753..0d21575 100644 (file)
@@ -107,7 +107,7 @@ C4::Auth - Authenticates Koha users
             query           => $query,
       type            => "opac",
       authnotrequired => 0,
-      flagsrequired   => {borrow => 1, catalogue => '*', tools => 'import_patrons' },
+      flagsrequired   => { catalogue => '*', tools => 'import_patrons' },
   }
     );
 
@@ -131,7 +131,7 @@ automatically. This gets loaded into the template.
          query           => $query,
          type            => "opac",
          authnotrequired => 0,
-         flagsrequired   => {borrow => 1, catalogue => '*', tools => 'import_patrons' },
+         flagsrequired   => { catalogue => '*', tools => 'import_patrons' },
        }
      );
 
@@ -230,7 +230,6 @@ sub get_template_and_user {
             $template->param( CAN_user_borrowers        => 1 );
             $template->param( CAN_user_permissions      => 1 );
             $template->param( CAN_user_reserveforothers => 1 );
-            $template->param( CAN_user_borrow           => 1 );
             $template->param( CAN_user_editcatalogue    => 1 );
             $template->param( CAN_user_updatecharges    => 1 );
             $template->param( CAN_user_acquisition      => 1 );
@@ -252,7 +251,7 @@ sub get_template_and_user {
 
         if ($flags) {
             foreach my $module ( keys %$all_perms ) {
-                if ( $flags->{$module} == 1 ) {
+                if ( defined($flags->{$module}) && $flags->{$module} == 1 ) {
                     foreach my $subperm ( keys %{ $all_perms->{$module} } ) {
                         $template->param( "CAN_user_${module}_${subperm}" => 1 );
                     }
@@ -389,6 +388,7 @@ sub get_template_and_user {
         noItemTypeImages   => C4::Context->preference("noItemTypeImages"),
         marcflavour        => C4::Context->preference("marcflavour"),
         persona            => C4::Context->preference("persona"),
+        OPACBaseURL        => C4::Context->preference('OPACBaseURL'),
     );
     if ( $in->{'type'} eq "intranet" ) {
         $template->param(
@@ -410,7 +410,7 @@ sub get_template_and_user {
             intranetreadinghistory                                                     => C4::Context->preference("intranetreadinghistory"),
             intranetstylesheet                                                         => C4::Context->preference("intranetstylesheet"),
             IntranetUserCSS                                                            => C4::Context->preference("IntranetUserCSS"),
-            intranetuserjs                                                             => C4::Context->preference("intranetuserjs"),
+            IntranetUserJS                                                             => C4::Context->preference("IntranetUserJS"),
             intranetbookbag                                                            => C4::Context->preference("intranetbookbag"),
             suggestion                                                                 => C4::Context->preference("suggestion"),
             virtualshelves                                                             => C4::Context->preference("virtualshelves"),
@@ -433,12 +433,15 @@ sub get_template_and_user {
         $LibraryNameTitle =~ s/<(?:\/?)(?:br|p)\s*(?:\/?)>/ /sgi;
         $LibraryNameTitle =~ s/<(?:[^<>'"]|'(?:[^']*)'|"(?:[^"]*)")*>//sg;
 
-        # clean up the busc param in the session if the page is not opac-detail and not the "add to list" page
+        # clean up the busc param in the session
+        # if the page is not opac-detail and not the "add to list" page
+        # and not the "edit comments" page
         if ( C4::Context->preference("OpacBrowseResults")
             && $in->{'template_name'} =~ /opac-(.+)\.(?:tt|tmpl)$/ ) {
             my $pagename = $1;
             unless ( $pagename =~ /^(?:MARC|ISBD)?detail$/
-                or $pagename =~ /^addbybiblionumber$/ ) {
+                or $pagename =~ /^addbybiblionumber$/
+                or $pagename =~ /^review$/ ) {
                 my $sessionSearch = get_session( $sessionID || $in->{'query'}->cookie("CGISESSID") );
                 $sessionSearch->clear( ["busc"] ) if ( $sessionSearch->param("busc") );
             }
@@ -460,11 +463,6 @@ sub get_template_and_user {
             $opac_name = C4::Context->userenv->{'branch'};
         }
 
-        # FIXME Under Plack the CGI->https method always returns 'OFF' ($using_https will be set to 0 in this case)
-        my $opac_base_url = C4::Context->preference("OPACBaseURL");    #FIXME uses $using_https below as well
-        if ( !$opac_base_url ) {
-            $opac_base_url = $ENV{'SERVER_NAME'} . ( $ENV{'SERVER_PORT'} eq ( $using_https ? "443" : "80" ) ? '' : ":$ENV{'SERVER_PORT'}" );
-        }
         $template->param(
             OpacAdditionalStylesheet                   => C4::Context->preference("OpacAdditionalStylesheet"),
             AnonSuggestions                       => "" . C4::Context->preference("AnonSuggestions"),
@@ -483,7 +481,6 @@ sub get_template_and_user {
             OPACUserCSS                           => "" . C4::Context->preference("OPACUserCSS"),
             OPACViewOthersSuggestions             => "" . C4::Context->preference("OPACViewOthersSuggestions"),
             OpacAuthorities                       => C4::Context->preference("OpacAuthorities"),
-            OPACBaseURL                           => ( $using_https ? "https://" : "http://" ) . $opac_base_url,
             opac_css_override                     => $ENV{'OPAC_CSS_OVERRIDE'},
             opac_search_limit                     => $opac_search_limit,
             opac_limit_override                   => $opac_limit_override,
@@ -510,7 +507,7 @@ sub get_template_and_user {
             opacheader                            => "" . C4::Context->preference("opacheader"),
             opaclanguagesdisplay                  => "" . C4::Context->preference("opaclanguagesdisplay"),
             opacreadinghistory                    => C4::Context->preference("opacreadinghistory"),
-            opacuserjs                            => C4::Context->preference("opacuserjs"),
+            OPACUserJS                            => C4::Context->preference("OPACUserJS"),
             opacuserlogin                         => "" . C4::Context->preference("opacuserlogin"),
             ShowReviewer                          => C4::Context->preference("ShowReviewer"),
             ShowReviewerPhoto                     => C4::Context->preference("ShowReviewerPhoto"),
@@ -1182,7 +1179,7 @@ sub checkauth {
         OpacFavicon                           => C4::Context->preference("OpacFavicon"),
         opacreadinghistory                    => C4::Context->preference("opacreadinghistory"),
         opaclanguagesdisplay                  => C4::Context->preference("opaclanguagesdisplay"),
-        opacuserjs                            => C4::Context->preference("opacuserjs"),
+        OPACUserJS                            => C4::Context->preference("OPACUserJS"),
         opacbookbag                           => "" . C4::Context->preference("opacbookbag"),
         OpacCloud                             => C4::Context->preference("OpacCloud"),
         OpacTopissue                          => C4::Context->preference("OpacTopissue"),
@@ -1196,7 +1193,7 @@ sub checkauth {
         intranetbookbag                       => C4::Context->preference("intranetbookbag"),
         IntranetNav                           => C4::Context->preference("IntranetNav"),
         IntranetFavicon                       => C4::Context->preference("IntranetFavicon"),
-        intranetuserjs                        => C4::Context->preference("intranetuserjs"),
+        IntranetUserJS                        => C4::Context->preference("IntranetUserJS"),
         IndependentBranches                   => C4::Context->preference("IndependentBranches"),
         AutoLocation                          => C4::Context->preference("AutoLocation"),
         wrongip                               => $info{'wrongip'},