Bug 21746: Remove NO_LIBRARY_SET
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 14 Feb 2020 11:36:54 +0000 (12:36 +0100)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 2 Mar 2020 10:20:42 +0000 (10:20 +0000)
NO_LIBRARY_SET was used when the DB user was logged in. Since bug 20489
it's not longer possible. We could remove the code.

One occurrence left in C4::InstallAuth as there is no (real) logged in user yet.

Test plan:
* Install Koha to make sure NO_LIBRARY_SET is not needed during the
install process
* Login into Koha
* Make sure the your library's name is displayed correctly in the header
* Set another library
* Confirm that the library's name is updated

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
No problem during install, nor changing library.
Fixed (pre-existing) tab in circ/branchtransfers.pl
No errors

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

acqui/basket.pl
admin/smart-rules.pl
catalogue/detail.pl
circ/branchtransfers.pl
circ/circulation.pl
circ/returns.pl
koha-tmpl/intranet-tmpl/prog/en/includes/header.inc
tools/overduerules.pl

index d248f11..459f295 100755 (executable)
@@ -199,8 +199,7 @@ if ( $op eq 'delete_confirm' ) {
         # if requested, create basket group, close it and attach the basket
         if ($query->param('createbasketgroup')) {
             my $branchcode;
-            if(C4::Context->userenv and C4::Context->userenv->{'branch'}
-              and C4::Context->userenv->{'branch'} ne "NO_LIBRARY_SET") {
+            if(C4::Context->userenv and C4::Context->userenv->{'branch'}) {
                 $branchcode = C4::Context->userenv->{'branch'};
             }
             my $basketgroupid = NewBasketgroup( { name => $basket->{basketname},
@@ -543,8 +542,7 @@ sub edi_close_and_order {
         if ( $query->param('createbasketgroup') ) {
             my $branchcode;
             if (    C4::Context->userenv
-                and C4::Context->userenv->{'branch'}
-                and C4::Context->userenv->{'branch'} ne "NO_LIBRARY_SET" )
+                and C4::Context->userenv->{'branch'} )
             {
                 $branchcode = C4::Context->userenv->{'branch'};
             }
index 236ca8f..6bea920 100755 (executable)
@@ -66,8 +66,6 @@ my $can_edit_from_any_library = $logged_in_patron->has_permission( {parameters =
 $template->param( restricted_to_own_library => not $can_edit_from_any_library );
 $branch = C4::Context::mybranch() unless $can_edit_from_any_library;
 
-$branch = '*' if $branch eq 'NO_LIBRARY_SET';
-
 my $op = $input->param('op') || q{};
 my $language = C4::Languages::getlanguage();
 
index eb46ea5..89ae268 100755 (executable)
@@ -382,8 +382,7 @@ foreach my $item (@items) {
         }
     }
 
-    if ($currentbranch and $currentbranch ne "NO_LIBRARY_SET"
-    and C4::Context->preference('SeparateHoldings')) {
+    if ($currentbranch and C4::Context->preference('SeparateHoldings')) {
         if ($itembranchcode and $itembranchcode eq $currentbranch) {
             push @itemloop, $item;
         } else {
index f65402d..a8637ce 100755 (executable)
@@ -45,7 +45,7 @@ if (!C4::Context->userenv){
        my $sessionID = $query->cookie("CGISESSID");
     my $session;
        $session = get_session($sessionID) if $sessionID;
-       if (!$session or $session->param('branch') eq 'NO_LIBRARY_SET'){
+    if (!$session){
                # no branch set we can't transfer
                print $query->redirect("/cgi-bin/koha/circ/selectbranchprinter.pl");
                exit;
index 731565b..1572a08 100755 (executable)
@@ -73,13 +73,6 @@ my $override_high_holds_tmp = $query->param('override_high_holds_tmp');
 
 my $sessionID = $query->cookie("CGISESSID") ;
 my $session = get_session($sessionID);
-if (!C4::Context->userenv){
-    if ($session->param('branch') eq 'NO_LIBRARY_SET'){
-        # no branch set we can't issue
-        print $query->redirect("/cgi-bin/koha/circ/selectbranchprinter.pl");
-        exit;
-    }
-}
 
 my $barcodes = [];
 my $barcode =  $query->param('barcode');
index a9e2bc2..3bf7fee 100755 (executable)
@@ -70,11 +70,6 @@ my ( $template, $librarian, $cookie, $flags ) = get_template_and_user(
 
 my $sessionID = $query->cookie("CGISESSID");
 my $session = get_session($sessionID);
-if ($session->param('branch') eq 'NO_LIBRARY_SET'){
-    # no branch set we can't return
-    print $query->redirect("/cgi-bin/koha/circ/selectbranchprinter.pl");
-    exit;
-}
 
 # Print a reserve slip on this page
 if ( $query->param('print_slip') ) {
index 460fd83..512f274 100644 (file)
                             </brand>
                         [% ELSE %]
                             <strong>
-                                [% IF ( LoginBranchname == 'NO_LIBRARY_SET' ) %]
-                                    NO LIBRARY SET
-                                [% ELSE %]
-                                    <span class="logged-in-branch-name">[% LoginBranchname | html %]</span>
-                                    <span class="logged-in-branch-code content_hidden">[% Branches.GetLoggedInBranchcode | html %]</span>
-                                [% END %]
+                                <span class="logged-in-branch-name">[% LoginBranchname | html %]</span>
+                                <span class="logged-in-branch-code content_hidden">[% Branches.GetLoggedInBranchcode | html %]</span>
                             </strong>
                         [% END %]
                     </span>
                                 [% LoginBranchname | html %]
                             </brand>
                         [% ELSE %]
-                            [% IF ( LoginBranchname == 'NO_LIBRARY_SET' ) %]
-                                NO LIBRARY SET
-                            [% ELSE %]
-                                Location: <br />
-                                <span class="logged-in-branch-name">[% LoginBranchname | html %]</span>
-                                <span class="logged-in-branch-code content_hidden">[% Branches.GetLoggedInBranchcode | html %]</span>
-                            [% END %]
+                            Location: <br />
+                            <span class="logged-in-branch-name">[% LoginBranchname | html %]</span>
+                            <span class="logged-in-branch-code content_hidden">[% Branches.GetLoggedInBranchcode | html %]</span>
                         [% END %]
                     </li>
 
index 616f607..da02815 100755 (executable)
@@ -77,7 +77,6 @@ $branch =
   : Koha::Libraries->search->count() == 1                              ? undef
   :                                                                      undef;
 $branch ||= q{};
-$branch = q{} if $branch eq 'NO_LIBRARY_SET';
 
 my $op = $input->param('op');
 $op ||= q{};