From 052861306be3c759a2fca1cc621b39a720fbc84d Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Tue, 1 Jan 2008 19:25:25 -0600 Subject: [PATCH] Fix to redirect the user ot the select branch page if they try to use circulation without a branch set Signed-off-by: Joshua Ferraro --- circ/branchtransfers.pl | 13 ++++++++++++- circ/circulation.pl | 10 +++++++++- circ/returns.pl | 12 +++++++++++- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/circ/branchtransfers.pl b/circ/branchtransfers.pl index 37d9e0ee70..16fe6836d5 100755 --- a/circ/branchtransfers.pl +++ b/circ/branchtransfers.pl @@ -27,7 +27,7 @@ use C4::Circulation; use C4::Output; use C4::Reserves; use C4::Biblio; -use C4::Auth; +use C4::Auth qw/:DEFAULT get_session/; use C4::Branch; # GetBranches use C4::Koha; @@ -36,6 +36,17 @@ use C4::Koha; my $query = new CGI; +if (!C4::Context->userenv){ + my $sessionID = $query->cookie("CGISESSID"); + my $session = get_session($sessionID); + if ($session->param('branch') eq 'NO_LIBRARY_SET'){ + # no branch set we can't transfer + print $query->redirect("/cgi-bin/koha/circ/selectbranchprinter.pl"); + exit; + } +} + + ####################################################################################### # Make the page ..... my ( $template, $cookie ); diff --git a/circ/circulation.pl b/circ/circulation.pl index 6d9ab9b030..38c678e867 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -74,7 +74,15 @@ if ($printer){ $session->param('branchprinter',$printer); } - +if (!C4::Context->userenv && !$branch){ + my $sessionID = $query->cookie("CGISESSID") ; + my $session = get_session($sessionID); + 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 ( $template, $loggedinuser, $cookie ) = get_template_and_user ( { diff --git a/circ/returns.pl b/circ/returns.pl index a7e79b19a7..c7fcb87ea1 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -28,7 +28,7 @@ script to execute returns of books use strict; use CGI; use C4::Context; -use C4::Auth; +use C4::Auth qw/:DEFAULT get_session/; use C4::Output; use C4::Circulation; use C4::Dates qw/format_date/; @@ -41,6 +41,16 @@ use C4::Koha; # FIXME : is it still useful ? my $query = new CGI; +if (!C4::Context->userenv){ + 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; + } +} + #getting the template my ( $template, $librarian, $cookie ) = get_template_and_user( { -- 2.39.2