X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=circ%2Fbranchtransfers.pl;h=ad7aa9afd5e4babe6dbd24d0b4aab6a32974c9c7;hb=6dda8a63795439cde4d97f97b9d09b63011ef54a;hp=52660ff34aa7abec2076ee712ce64ea5a455092f;hpb=cf973f53bb61a69837b7d31ed72e7084aca82594;p=koha.git diff --git a/circ/branchtransfers.pl b/circ/branchtransfers.pl index 52660ff34a..ad7aa9afd5 100755 --- a/circ/branchtransfers.pl +++ b/circ/branchtransfers.pl @@ -1,170 +1,249 @@ #!/usr/bin/perl -#written 11/3/2002 by Finlay #script to execute branch transfers of books +# Copyright 2000-2002 Katipo Communications +# copyright 2010 BibLibre +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + use strict; +use warnings; use CGI; -use C4::Circulation::Circ2; -use C4::Search; +use C4::Circulation; use C4::Output; +use C4::Reserves; +use C4::Biblio; +use C4::Items; +use C4::Auth qw/:DEFAULT get_session/; +use C4::Branch; # GetBranches +use C4::Koha; +use C4::Members; + +############################################### +# Getting state + +my $query = new CGI; + +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'){ + # no branch set we can't transfer + print $query->redirect("/cgi-bin/koha/circ/selectbranchprinter.pl"); + exit; + } +} - -my %env; -my $headerbackgroundcolor='#99cc33'; -my $circbackgroundcolor='#ffffcc'; -my $circbackgroundcolor='white'; -my $linecolor1='#ffffcc'; -my $linecolor2='white'; -my $backgroundimage="/images/background-mem.gif"; - -my $query=new CGI; -my $branches=getbranches(\%env); - -my $tobranchcd=$query->param('tobranchcd'); -my $frbranchcd=''; - -$env{'tobranchcd'}=$tobranchcd; - - -my $tobranchoptions; -foreach (keys %$branches) { - (next) unless ($_); - (next) if (/^TR$/); - my $selected=''; - ($selected='selected') if ($_ eq $tobranchcd); - $tobranchoptions.="