Skip to content
Newer
Older
100755 192 lines (169 sloc) 5.71 KB
d0374d0 Initial revision
rangi authored Dec 19, 2000
1 #!/usr/bin/perl
2
7197a37 Added magic RCS comment.
arensb authored Oct 13, 2002
3 # $Id$
4
d0374d0 Initial revision
rangi authored Dec 19, 2000
5 #script to place reserves/requests
6 #writen 2/1/00 by chris@katipo.oc.nz
7
1e67687 Added copyright statement to all .pl and .pm files
tonnesen authored Aug 14, 2002
8
9 # Copyright 2000-2002 Katipo Communications
10 #
11 # This file is part of Koha.
12 #
13 # Koha is free software; you can redistribute it and/or modify it under the
14 # terms of the GNU General Public License as published by the Free Software
15 # Foundation; either version 2 of the License, or (at your option) any later
16 # version.
17 #
18 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
19 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
20 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
21 #
22 # You should have received a copy of the GNU General Public License along with
23 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
24 # Suite 330, Boston, MA 02111-1307 USA
25
d0374d0 Initial revision
rangi authored Dec 19, 2000
26 use strict;
27 use C4::Search;
28 use C4::Output;
3202a41 bugfixes :
hdl authored Jan 23, 2003
29 use C4::Auth;
d0374d0 Initial revision
rangi authored Dec 19, 2000
30 use C4::Reserves2;
5c67993 road to 1.3.2
tipaul authored Nov 19, 2002
31 use C4::Biblio;
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored Apr 8, 2002
32 use C4::Koha;
7a3ac6d rewrite, so that it correctly displays branches and waiting reserves.
finlayt authored Jun 6, 2002
33 use C4::Circulation::Circ2;
abfac97 Templating Request.tmpl
hdl authored Jan 22, 2003
34 use HTML::Template;
ae96102 * graphic bugfixes
tipaul authored Mar 10, 2003
35 use C4::Catalogue;
0376493 refactored slashifyDate function out of inline code, created C4/Koha.pm
pate authored Apr 8, 2002
36 use CGI;
333e222 *** empty log message ***
wolfpac444 authored Mar 26, 2003
37 use C4::Date;
38
d0374d0 Initial revision
rangi authored Dec 19, 2000
39 my $input = new CGI;
7a3ac6d rewrite, so that it correctly displays branches and waiting reserves.
finlayt authored Jun 6, 2002
40
41 # get biblio information....
42 my $bib = $input->param('bib');
43 my $dat = bibdata($bib);
44
45 # get existing reserves .....
46 my ($count,$reserves) = FindReserves($bib);
13e7c89 Added the possiblity of deleting waiting reservesm or setting them ba…
finlayt authored Sep 27, 2002
47 my $totalcount = $count;
7a3ac6d rewrite, so that it correctly displays branches and waiting reserves.
finlayt authored Jun 6, 2002
48 foreach my $res (@$reserves) {
49 if ($res->{'found'} eq 'W') {
50 $count--;
51 }
52 }
53
54 # make priorities options
55 my $num = $count + 1;
abfac97 Templating Request.tmpl
hdl authored Jan 22, 2003
56
57 #priorityoptions building
58 my @optionloop;
59 for (my $i=1; $i<=$num; $i++){
60 my %option;
61 $option{num}=$i;
62 $option{selected}=($i==$num);
63 push(@optionloop, \%option);
64 }
7a3ac6d rewrite, so that it correctly displays branches and waiting reserves.
finlayt authored Jun 6, 2002
65
66 # todays date
67 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =localtime(time);
68 $year=$year+1900;
69 $mon++;
8b4a044 Changed the scripts to use format_date
wolfpac444 authored May 8, 2003
70 my $date=format_date("$year-$mon-$mday");
7a3ac6d rewrite, so that it correctly displays branches and waiting reserves.
finlayt authored Jun 6, 2002
71
72
73 # get biblioitem information and build rows for form
74 my ($count2,@data) = bibitems($bib);
816520a Fixed up the display of bibitems, implemented some restrictions on wh…
finlayt authored Aug 22, 2002
75
abfac97 Templating Request.tmpl
hdl authored Jan 22, 2003
76 my @bibitemloop;
70003da Fixed the ordering of bibitems displayed in the request page. Most re…
finlayt authored Sep 19, 2002
77 foreach my $dat (sort {$b->{'dateaccessioned'} cmp $a->{'dateaccessioned'}} @data) {
78 $dat->{'dewey'}="" if ($dat->{'dewey'} == 0);
79 $dat->{'volumeddesc'} = "&nbsp;" unless $dat->{'volumeddesc'};
80 $dat->{'dewey'}=~ s/\.0000$//;
81 $dat->{'dewey'}=~ s/00$//;
7a3ac6d rewrite, so that it correctly displays branches and waiting reserves.
finlayt authored Jun 6, 2002
82
abfac97 Templating Request.tmpl
hdl authored Jan 22, 2003
83 my %abibitem;
84 my @barcodeloop;
85 my @barcodes = barcodes($dat->{'biblioitemnumber'});
86 foreach my $num (@barcodes) {
87 my %barcode;
88 $barcode{'barcode'}=$num->{'barcode'};
89 $barcode{'message'}=$num->{'itemlost'} == 1 ? "(lost)" :
90 $num->{'itemlost'} == 2 ? "(long overdue)" : "";
91 push(@barcodeloop, \%barcode);
7a3ac6d rewrite, so that it correctly displays branches and waiting reserves.
finlayt authored Jun 6, 2002
92 }
abfac97 Templating Request.tmpl
hdl authored Jan 22, 2003
93 $abibitem{'barcodeloop'}=\@barcodeloop;
94 $abibitem{'class'}="$dat->{'classification'}$dat->{'dewey'}$dat->{'subclass'}";
95 my $select;
96 $abibitem{'itemlost'}=(($dat->{'notforloan'})|| ($dat->{'itemlost'} == 1)) ;
97 $abibitem{'biblioitemnumber'}=$dat->{'biblioitemnumber'};
98 $abibitem{'description'}=$dat->{'description'};
99 $abibitem{'volumeddesc'}=$dat->{'volumeddesc'};
100 $abibitem{'publicationyear'}=$dat->{'publicationyear'};
101 push(@bibitemloop,\%abibitem);
7a3ac6d rewrite, so that it correctly displays branches and waiting reserves.
finlayt authored Jun 6, 2002
102 }
103
104
105
abfac97 Templating Request.tmpl
hdl authored Jan 22, 2003
106 #existingreserves building
107 my @reserveloop;
e862f50 fix for #387
tipaul authored May 15, 2003
108 my $branches = getbranches();
abfac97 Templating Request.tmpl
hdl authored Jan 22, 2003
109 foreach my $res (sort {$a->{'found'} cmp $b->{'found'}} @$reserves){
110 my %reserve;
111 # my $prioropt = priorityoptions($totalcount, $res->{'priority'});
112 my @optionloop;
113 for (my $i=1; $i<=$totalcount; $i++){
114 my %option;
115 $option{num}=$i;
116 $option{selected}=($i==$res->{'priority'});
117 push(@optionloop, \%option);
7a3ac6d rewrite, so that it correctly displays branches and waiting reserves.
finlayt authored Jun 6, 2002
118 }
e862f50 fix for #387
tipaul authored May 15, 2003
119 my @branchloop;
120 foreach my $br (keys %$branches) {
121 # (next) unless $branches->{$br}->{'IS'};
122 # Only branches with the 'IS' branchrelation
123 # can issue books
124 my %abranch;
125 $abranch{'selected'}=($br eq $res->{'branchcode'});
126 $abranch{'branch'}=$br;
127 $abranch{'branchname'}=$branches->{$br}->{'branchname'};
128 push(@branchloop,\%abranch);
129 }
abfac97 Templating Request.tmpl
hdl authored Jan 22, 2003
130
131 if ($res->{'found'} eq 'W') {
132 my %env;
133 my $item = $res->{'itemnumber'};
134 $item = getiteminformation(\%env,$item);
135 $reserve{'barcode'}=$item->{'barcode'};
136 $reserve{'biblionumber'}=$item->{'biblionumber'};
137 $reserve{'wbrcode'} = $res->{'branchcode'};
3202a41 bugfixes :
hdl authored Jan 23, 2003
138 $reserve{'wbrname'} = $branches->{$res->{'branchcode'}}->{'branchname'};
7a3ac6d rewrite, so that it correctly displays branches and waiting reserves.
finlayt authored Jun 6, 2002
139 }
333e222 *** empty log message ***
wolfpac444 authored Mar 26, 2003
140 $reserve{'date'} = format_date($res->{'reservedate'});
abfac97 Templating Request.tmpl
hdl authored Jan 22, 2003
141 $reserve{'borrowernumber'}=$res->{'borrowernumber'};
142 $reserve{'biblionumber'}=$res->{'biblionumber'};
143 $reserve{'bornum'}=$res->{'borrowernumber'};
144 $reserve{'firstname'}=$res->{'firstname'};
145 $reserve{'bornum'}=$res->{'borrowernumber'};
146 $reserve{'notes'}=$res->{'reservenotes'};
147 $reserve{'wait'}=($res->{'found'} eq 'W');
148 $reserve{'constrainttypea'}=($res->{'constrainttype'} eq 'a');
149 $reserve{'constrainttypeo'}=($res->{'constrainttype'} eq 'o');
150 $reserve{'voldesc'}=$res->{'volumeddesc'};
151 $reserve{'itemtype'}=$res->{'itemtype'};
152 $reserve{'branchloop'}=\@branchloop;
153 $reserve{'optionloop'}=\@optionloop;
154 push(@reserveloop,\%reserve);
7a3ac6d rewrite, so that it correctly displays branches and waiting reserves.
finlayt authored Jun 6, 2002
155 }
156
ae96102 * graphic bugfixes
tipaul authored Mar 10, 2003
157 my @branches;
158 my @select_branch;
159 my %select_branches;
160 my ($count2,@branches)=branches();
161 for (my $i=0;$i<$count2;$i++){
162 push @select_branch, $branches[$i]->{'branchcode'};#
163 $select_branches{$branches[$i]->{'branchcode'}} = $branches[$i]->{'branchname'};
164 }
165 my $CGIbranch=CGI::scrolling_list( -name => 'pickup',
166 -values => \@select_branch,
167 -labels => \%select_branches,
168 -size => 1,
169 -multiple => 0 );
170
13e7c89 Added the possiblity of deleting waiting reservesm or setting them ba…
finlayt authored Sep 27, 2002
171 #get the time for the form name...
172 my $time = time();
173
d0374d0 Initial revision
rangi authored Dec 19, 2000
174 #setup colours
abfac97 Templating Request.tmpl
hdl authored Jan 22, 2003
175 my ($template, $borrowernumber, $cookie)
176 = get_template_and_user({template_name => "request.tmpl",
177 query => $input,
178 type => "intranet",
179 authnotrequired => 0,
180 flagsrequired => {parameters => 1},
181 });
182 $template->param( optionloop =>\@optionloop,
ae96102 * graphic bugfixes
tipaul authored Mar 10, 2003
183 CGIbranch => $CGIbranch,
abfac97 Templating Request.tmpl
hdl authored Jan 22, 2003
184 reserveloop => \@reserveloop,
185 'time' => $time,
186 bibitemloop => \@bibitemloop,
ae96102 * graphic bugfixes
tipaul authored Mar 10, 2003
187 date => $date,
188 bib => $bib,
189 title =>$dat->{title});
abfac97 Templating Request.tmpl
hdl authored Jan 22, 2003
190 # printout the page
191 print $input->header(-expires=>'now'), $template->output;
Something went wrong with that request. Please try again.