X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=circ%2Fbranchtransfers.pl;h=85ad30e838e885f9add8c558d82fbb0a8c8a0799;hb=529af6e044729156b9589775d35e6e46bda9a22a;hp=ae2144eb41b6fcda59eb27d9965f9a350d074e4f;hpb=277f3490bec30c8e1a2892553c1c4c10b4aeac8f;p=koha.git diff --git a/circ/branchtransfers.pl b/circ/branchtransfers.pl index ae2144eb41..85ad30e838 100755 --- a/circ/branchtransfers.pl +++ b/circ/branchtransfers.pl @@ -1,171 +1,254 @@ #!/usr/bin/perl +# WARNING: This file uses 4-character tabs! #written 11/3/2002 by Finlay #script to execute branch transfers of books +# Copyright 2000-2002 Katipo Communications +# +# 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., 59 Temple Place, +# Suite 330, Boston, MA 02111-1307 USA + use strict; use CGI; -use C4::Circulation::Circ2; +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; ############################################### -# constants +# Getting state -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(); +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; + } +} -############################################### -# Getting state -my $query=new CGI; - -my $tobranchcd=$query->param('tobranchcd'); -my $frbranchcd=''; +####################################################################################### +# Make the page ..... +my ( $template, $cookie ); +my $user; +( $template, $user, $cookie ) = get_template_and_user( + { + template_name => "circ/branchtransfers.tmpl", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => { circulate => "circulate_remaining_permissions" }, + } +); + +my $branches = GetBranches; +my $branch = GetBranch( $query, $branches ); + +my $messages; +my $found; +my $reserved; +my $waiting; +my $reqmessage; +my $cancelled; +my $setwaiting; + +my $request = $query->param('request'); +my $borrowernumber = $query->param('borrowernumber'); +my $tobranchcd = $query->param('tobranchcd'); + +############ +# Deal with the requests.... +if ( $request eq "KillWaiting" ) { + my $item = $query->param('itemnumber'); + + CancelReserve( 0, $item, $borrowernumber ); + $cancelled = 1; + $reqmessage = 1; +} +my $ignoreRs = 0; +if ( $request eq "SetWaiting" ) { + my $item = $query->param('itemnumber'); + ModReserveAffect( $item, $borrowernumber ); + $ignoreRs = 1; + $setwaiting = 1; + $reqmessage = 1; +} +if ( $request eq 'KillReserved' ) { + my $biblio = $query->param('biblionumber'); + CancelReserve( $biblio, 0, $borrowernumber ); + $cancelled = 1; + $reqmessage = 1; +} # set up the branchselect options.... -my $tobranchoptions; -foreach my $br (keys %$branches) { - (next) if $branches->{$br}->{'PE'}; - my $selected=''; - ($selected='selected') if ($br eq $tobranchcd); - $tobranchoptions.="