[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] CVS: koha request.pl,1.2,1.3
From: |
Finlay Thompson |
Subject: |
[Koha-cvs] CVS: koha request.pl,1.2,1.3 |
Date: |
Thu, 06 Jun 2002 16:30:42 -0700 |
Update of /cvsroot/koha/koha
In directory usw-pr-cvs1:/tmp/cvs-serv23069
Modified Files:
request.pl
Log Message:
rewrite, so that it correctly displays branches and waiting reserves.
Index: request.pl
===================================================================
RCS file: /cvsroot/koha/koha/request.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** request.pl 8 Apr 2002 23:44:43 -0000 1.2
--- request.pl 6 Jun 2002 23:30:39 -0000 1.3
***************
*** 11,17 ****
--- 11,174 ----
use C4::Acquisitions;
use C4::Koha;
+ use C4::Circulation::Circ2;
use CGI;
my $input = new CGI;
+
+ # get biblio information....
+ my $bib = $input->param('bib');
+ my $dat = bibdata($bib);
+
+ # get existing reserves .....
+ my ($count,$reserves) = FindReserves($bib);
+ foreach my $res (@$reserves) {
+ if ($res->{'found'} eq 'W') {
+ $count--;
+ }
+ }
+
+ # make priorities options
+ my $num = $count + 1;
+ my $priorityoptions = priorityoptions($num, $num);
+
+
+ # get branch information
+ my $branch = $input->cookie('branch');
+ my $branches = getbranches();
+
+ warn $branch;
+
+ my $branchoptions = branchoptions($branch);
+
+
+ # todays date
+ my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =localtime(time);
+ $year=$year+1900;
+ $mon++;
+ my $date="$mday/$mon/$year";
+
+
+
+
+ # get biblioitem information and build rows for form
+ my ($count2,@data) = bibitems($bib);
+ my $bibitemrows = "";
+ for (my $i=0; $i<$count2; $i++){
+ my @barcodes = barcodes($data[$i]->{'biblioitemnumber'});
+ if ($data[$i]->{'dewey'} == 0){
+ $data[$i]->{'dewey'}="";
+ }
+ $data[$i]->{'dewey'}=~ s/\.0000$//;
+ $data[$i]->{'dewey'}=~ s/00$//;
+ my
$class="$data[$i]->{'classification'}$data[$i]->{'dewey'}$data[$i]->{'subclass'}";
+ $bibitemrows .= <<"EOF";
+ <tr VALIGN=TOP>
+ <TD><input type=checkbox name=reqbib value=$data[$i]->{'biblioitemnumber'}>
+ <input type=hidden name=biblioitem value=$data[$i]->{'biblioitemnumber'}>
+ </td>
+ <TD>$data[$i]->{'description'}</td>
+ <TD>$class</td>
+ <td>$data[$i]->{'volumeddesc'}</td>
+ <td>$data[$i]->{'isbn'}</td>
+ <td>$dat->{'copyrightdate'}</td>
+ <td>$data[$i]->{'publicationyear'}</td>
+ <td>@barcodes</td>
+ </tr>
+ EOF
+ }
+
+
+
+ my $existingreserves = "";
+ foreach my $res (sort {$a->{'found'} cmp $b->{'found'}} @$reserves){
+ #my $bor=$reserves->[$i]{'firstname'}."%20".$reserves->[$i]{'surname'};
+ #$bor=~ s/ /%20/g;
+ my $prioropt = priorityoptions($count, $res->{'priority'});
+ my $bropt = branchoptions($res->{'branchcode'});
+ warn $res->{'branchcode'};
+ my $bor=$res->{'borrowernumber'};
+ $date = slashifyDate($res->{'reservedate'});
+
+ my $type=$res->{'constrainttype'};
+ if ($type eq 'a'){
+ $type='Next Available';
+ } elsif ($type eq 'o'){
+ $type="This type only $res->{'volumeddesc'} $res->{'itemtype'}";
+ }
+
+ my $notes = $res->{'reservenotes'}." ";
+ my $rank;
+ my $pickup;
+ my $change;
+ if ($res->{'found'} eq 'W') {
+ my %env;
+ my $item = $res->{'itemnumber'};
+ $item = getiteminformation(\%env,$item);
+ $item = "<a href=/cgi-bin/koha/detail.pl?bib=$item->{'biblionumber'}
&type=intra onClick=\"openWindow(this, 'Item', 480,
640)\">$item->{'barcode'}</a>";
+ my $wbra = $branches->{$res->{'branchcode'}}->{'branchname'};
+ $rank = "Item waiting";
+ $type = $item;
+ $pickup = "at <b>".$wbra."</b>";
+ $change = "<input type=checkbox name=rank-request value=del>delete";
+ } else {
+ $rank = "<select name=rank-request>$prioropt<option
value=del>Del</select>";
+ $pickup = "<select name=pickup>$bropt</select>";
+ $change = "<select name=itemtype>
+ <option value=next>Next Available
+ <option value=change>Change Selection
+ <option value=nc >No Change</select>";
+ }
+ $existingreserves .= <<"EOF";
+ <input type=hidden name=borrower value=$res->{'borrowernumber'}>
+ <input type=hidden name=biblio value=$res->{'biblionumber'}>
+ <tr VALIGN=TOP>
+ <TD>$rank</td>
+ <TD>
+ <a href=/cgi-bin/koha/moremember.pl?bornum=$bor>$res->{'firstname'}
$res->{'surname'}</a>
+ </td>
+ <td>$notes</td>
+ <TD>$date</td>
+ <TD>$pickup</td>
+ <TD>$type</td>
+ <TD>$change</td>
+ </tr>
+ EOF
+ }
+
+
+
+ sub priorityoptions {
+ my ($count, $sel) = @_;
+ my $out = "";
+ for (my $i=1; $i<=$count; $i++){
+ $out .= "<option value=$i";
+ if ($sel == $i){
+ $out .= " selected";
+ }
+ $out .= ">$i\n";
+ }
+ return $out;
+ }
+
+ # make branch selection options...
+ sub branchoptions {
+ my ($selbr) = @_;
+ my $out = "";
+ foreach my $br (keys %$branches) {
+ (next) unless $branches->{$br}->{'CU'};
+ my $selected = "";
+ if ($br eq $selbr) {
+ $selected = "selected";
+ }
+ $out .= "<option value=$br
$selected>$branches->{$br}->{'branchname'}\n";
+ }
+ return $out;
+ }
+
+
+
+ # printout the page
+
+
print $input->header;
***************
*** 20,32 ****
print startpage();
print startmenu();
! my $blah;
! my $bib=$input->param('bib');
! my $dat=bibdata($bib);
! my ($count,$reserves)=FindReserves($bib);
! #print $count;
! #print $input->dump;
print <<printend
<form action="placerequest.pl" method=post>
<INPUT TYPE="image" name="submit" VALUE="request" height=42 WIDTH=187
BORDER=0 src="/images/place-request.gif" align=right >
--- 177,186 ----
print startpage();
print startmenu();
!
!
print <<printend
+
<form action="placerequest.pl" method=post>
<INPUT TYPE="image" name="submit" VALUE="request" height=42 WIDTH=187
BORDER=0 src="/images/place-request.gif" align=right >
***************
*** 34,46 ****
<input type=hidden name=type value=str8>
<input type=hidden name=title value="$dat->{'title'}">
! <FONT SIZE=6><em>Requesting: <a
href=/cgi-bin/koha/detail.pl?bib=$bib>$dat->{'title'}</a>
($dat->{'author'})</em></FONT><P>
<p>
- <TABLE CELLSPACING=0 CELLPADDING=5 border=1 align=left >
<!----------------BIBLIO RESERVE TABLE-------------->
-
<TABLE CELLSPACING=0 CELLPADDING=5 border=1 >
<TR VALIGN=TOP>
--- 188,200 ----
<input type=hidden name=type value=str8>
<input type=hidden name=title value="$dat->{'title'}">
! <FONT SIZE=6><em>Requesting: <br>
! <a href=/cgi-bin/koha/detail.pl?bib=$bib>$dat->{'title'}</a>
! ($dat->{'author'})</em></FONT><P>
<p>
<!----------------BIBLIO RESERVE TABLE-------------->
<TABLE CELLSPACING=0 CELLPADDING=5 border=1 >
<TR VALIGN=TOP>
***************
*** 53,91 ****
</TR>
<tr VALIGN=TOP >
! <TD><select name=rank-request>
! printend
! ;
! $count++;
! my $i;
! for ($i=1;$i<$count;$i++){
! print "<option value=$i>$i\n";
! }
! print "<option value=$i selected>$i\n";
! my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =localtime(time);
! $year=$year+1900;
! $mon++;
! my $date="$mday/$mon/$year";
! print <<printend
! </select>
! </td>
! <TD><input type=text size=10 name=member></td>
! <TD><input type=text size=20 name=notes></td>
! <TD>$date</td>
! <TD><select name=pickup>
! printend
! ;
! my ($count2,@branches)=branches;
! for (my $i=0;$i<$count2;$i++){
! print "<option value=$branches[$i]->{'branchcode'}";
! print ">$branches[$i]->{'branchname'}";
! }
! print <<printend
! </select>
! </td>
! <td><input type=checkbox name=request value=any>Next Available, <br>(or
choose from list below)</td>
! </tr>
!
!
! </table>
</p>
--- 207,222 ----
</TR>
<tr VALIGN=TOP >
! <td><select name=rank-request>
! $priorityoptions
! </select></td>
! <td><input type=text size=10 name=member></td>
! <td><input type=text size=20 name=notes></td>
! <td>$date</td>
! <td><select name=pickup>
! $branchoptions
! </select></td>
! <td><input type=checkbox name=request value=any>Next Available,
! <br>(or choose from list below)</td>
! </tr></table>
</p>
***************
*** 103,136 ****
<td bgcolor="99cc33"
background="/images/background-mem.gif"><B>Copies</b></TD>
</TR>
! printend
! ;
! my $blah;
! my ($count2,@data)=bibitems($bib);
! for ($i=0;$i<$count2;$i++){
! my @barcodes=barcodes($data[$i]->{'biblioitemnumber'});
! if ($data[$i]->{'dewey'} == 0){
! $data[$i]->{'dewey'}="";
! }
! $data[$i]->{'dewey'}=~ s/\.0000$//;
! $data[$i]->{'dewey'}=~ s/00$//;
! my
$class="$data[$i]->{'classification'}$data[$i]->{'dewey'}$data[$i]->{'subclass'}";
! print "<tr VALIGN=TOP >
! <TD><input type=checkbox name=reqbib value=$data[$i]->{'biblioitemnumber'}>
! <input type=hidden name=biblioitem value=$data[$i]->{'biblioitemnumber'}>
! </td>
! <TD>$data[$i]->{'description'}</td>
! <TD>$class</td>
! <td>$data[$i]->{'volumeddesc'}</td>
! <td>$data[$i]->{'isbn'}</td>
! <td>$dat->{'copyrightdate'}</td>
! <td>$data[$i]->{'publicationyear'}</td>
! <td>@barcodes</td>
! </tr>";
! }
! print <<printend
</table>
</p>
</form>
! <p> </p>
<!-----------MODIFY EXISTING REQUESTS----------------->
--- 234,245 ----
<td bgcolor="99cc33"
background="/images/background-mem.gif"><B>Copies</b></TD>
</TR>
! $bibitemrows
</table>
</p>
</form>
! <p> </p>
!
!
!
<!-----------MODIFY EXISTING REQUESTS----------------->
***************
*** 152,240 ****
<td bgcolor="99cc33" background="/images/background-mem.gif"><B>Change
To</b></TD>
</TR>
! printend
! ;
! $count--;
!
! for ($i=0;$i<$count;$i++){
! print "<input type=hidden name=borrower
value=$reserves->[$i]{'borrowernumber'}>";
! print "<input type=hidden name=biblio value=$reserves->[$i]{'biblionumber'}>";
! #my $bor=$reserves->[$i]{'firstname'}."%20".$reserves->[$i]{'surname'};
! #$bor=~ s/ /%20/g;
! my $bor=$reserves->[$i]{'borrowernumber'};
! $date = slashifyDate($reserves->[$i]{'reservedate'});
!
! my $type=$reserves->[$i]{'constrainttype'};
! #print "test";
! if ($type eq 'a'){
! $type='Next Available';
! } elsif ($type eq 'o'){
! # print "test";
! my
$res=getreservetitle($reserves->[$i]{'biblionumber'},$reserves->[$i]{'borrowernumber'},$reserves->[$i]{'reservedate'},$reserves->[$i]{'timestamp'});
! $type="This type only $res->{'volumeddesc'} $res->{'itemtype'}";
! # my @data=ItemInfo(\$blah,$reserves->[$i]{'borrowernumber'});
!
! }
! print "<tr VALIGN=TOP >
! <TD><select name=rank-request>
! ";
! for (my $i2=1;$i2<=$count;$i2++){
! print "<option value=$i2";
! if ($reserves->[$i]{'priority'} eq $i2){
! print " selected";
! }
! print">$i2";
! }
! print "<option value=del>Del";
! print "</select>
! </td>
! <TD><a
href=/cgi-bin/koha/moremember.pl?bornum=$bor>$reserves->[$i]{'firstname'}
$reserves->[$i]{'surname'}</a></td>
! <td>$reserves->[$i]{'reservenotes'}</td>
! <TD>$date</td>
! <TD><select name=pickup>
! ";
! my ($count2,@branches)=branches;
! for (my $i2=0;$i2<$count2;$i2++){
! print "<option value=$branches[$i2]->{'branchcode'}";
! if ($reserves->[$i]{'branchcode'} eq $branches[$i2]->{'branchcode'}){
! print " Selected";
! }
! print ">$branches[$i2]->{'branchname'}\n";
! }
! print "
! </select>
! </td>
! <TD>$type</td>
! <TD><select name=itemtype>
! <option value=next>Next Available
! <option value=change>Change Selection
! <option value=nc >No Change
! </select>
! </td>
! </tr>
! ";
! }
! print <<printend
!
!
! <tr VALIGN=TOP >
!
<TD colspan=6 align=right>
Delete a request by selecting "del" from the rank list.
-
<INPUT TYPE="image" name="submit" VALUE="request" height=42 WIDTH=64
BORDER=0 src="/images/ok.gif"></td>
-
-
</tr>
-
-
</table>
<P>
-
<br>
-
-
-
-
</form>
printend
;
--- 261,275 ----
<td bgcolor="99cc33" background="/images/background-mem.gif"><B>Change
To</b></TD>
</TR>
! $existingreserves
! <tr VALIGN=TOP>
<TD colspan=6 align=right>
Delete a request by selecting "del" from the rank list.
<INPUT TYPE="image" name="submit" VALUE="request" height=42 WIDTH=64
BORDER=0 src="/images/ok.gif"></td>
</tr>
</table>
<P>
<br>
</form>
+
printend
;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] CVS: koha request.pl,1.2,1.3,
Finlay Thompson <=