[Koha-cvs] CVS: koha request.pl,1.18,1.19

Henri-Damien LAURENT hdl at users.sourceforge.net
Thu Jan 23 00:33:44 CET 2003


Update of /cvsroot/koha/koha
In directory sc8-pr-cvs1:/tmp/cvs-serv3994

Modified Files:
	request.pl 
Log Message:
Templating Request.tmpl

Index: request.pl
===================================================================
RCS file: /cvsroot/koha/koha/request.pl,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -r1.18 -r1.19
*** request.pl	19 Nov 2002 12:31:34 -0000	1.18
--- request.pl	22 Jan 2003 23:33:39 -0000	1.19
***************
*** 32,35 ****
--- 32,36 ----
  use C4::Koha;
  use C4::Circulation::Circ2;
+ use HTML::Template;
  
  use CGI;
***************
*** 51,55 ****
  # make priorities options
  my $num = $count + 1;
! my $priorityoptions = priorityoptions($num, $num);
  
  
--- 52,64 ----
  # make priorities options
  my $num = $count + 1;
! 
! #priorityoptions building
! my @optionloop;
! for (my $i=1; $i<=$num; $i++){
! 	my %option;
! 	$option{num}=$i;
! 	$option{selected}=($i==$num);
! 	push(@optionloop, \%option);
! }
  
  
***************
*** 59,62 ****
--- 68,83 ----
  my $branches = getbranches();
  my $branchoptions = branchoptions($branch);
+ # make branch selection options...
+ my @branchloop;
+ foreach my $br (keys %$branches) {
+ 	(next) unless $branches->{$br}->{'IS'};
+ 			# Only branches with the 'IS' branchrelation
+ 			# can issue books
+ 	my %abranch;
+ 	$abranch{'selected'}=($br eq $branch);
+ 	$abranch{'branch'}=$br;
+ 	$abranch{'branchname'}=$branches->{$br}->{'branchname'};
+ 	push(@branchloop,\%abranch);
+ }
  
  
***************
*** 68,196 ****
  
  
- 
- 
  # get biblioitem information and build rows for form
  my ($count2, at data) = bibitems($bib);
- my $bibitemrows = "";
- 
  
  foreach my $dat (sort {$b->{'dateaccessioned'} cmp $a->{'dateaccessioned'}} @data) {
-     my @barcodes = barcodes($dat->{'biblioitemnumber'});
-     my $barcodestext = "";
-     foreach my $num (@barcodes) {
- 	my $message = $num->{'itemlost'} == 1 ? "(lost)" :
- 	    $num->{'itemlost'} == 2 ? "(long overdue)" : "";
- 	$barcodestext .= "$num->{'barcode'} $message <br>";
-     }
-     $barcodestext = substr($barcodestext, 0, -4);
- 
      $dat->{'dewey'}="" if ($dat->{'dewey'} == 0);
- 
      $dat->{'volumeddesc'} = "&nbsp;" unless $dat->{'volumeddesc'};
      $dat->{'dewey'}=~ s/\.0000$//;
      $dat->{'dewey'}=~ s/00$//;
-     my $class="$dat->{'classification'}$dat->{'dewey'}$dat->{'subclass'}";
-     my $select;
-     if (($dat->{'notforloan'})
- 	|| ($dat->{'itemlost'} == 1))  {
- 	$select = "Cannot be reserved.";
-     } else {
- 	$select = " <input type=checkbox name=reqbib value=$dat->{'biblioitemnumber'}><input type=hidden name=biblioitem value=$dat->{'biblioitemnumber'}>";
-     }
-     $bibitemrows .= <<"EOF";
- <tr VALIGN=TOP>
- <TD>$select</td>
- <TD>$dat->{'description'}</td>
- <TD>$class</td>
- <td>$dat->{'volumeddesc'}</td>
- <td>$dat->{'publicationyear'}</td>
- <td>$barcodestext</td>
- </tr>
- EOF
- }
  
! 
! 
! 
! my $existingreserves = "";
! foreach my $res (sort {$a->{'found'} cmp $b->{'found'}} @$reserves){
!     my $prioropt = priorityoptions($totalcount, $res->{'priority'});
!     my $bropt = branchoptions($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;
!     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 $wbrcd = $res->{'branchcode'};
! 	my $wbra = $branches->{$wbrcd}->{'branchname'};
! 	$type = $item;
! 	$rank = "<select name=rank-request><option value=W selected>Waiting</option>$prioropt<option value=del>Del</option></select>";
! 	$pickup = "Item waiting at <b>".$wbra."</b> <input type=hidden name=pickup value=$wbrcd>";
!     } else {
! 	$rank = "<select name=rank-request>$prioropt<option value=del>Del</option></select>";
! 	$pickup = "<select name=pickup>$bropt</select>";
      }
!     $existingreserves .= <<"EOF";
! <tr VALIGN=TOP>
! <TD>
! <input type=hidden name=borrower value=$res->{'borrowernumber'}>
! <input type=hidden name=biblio value=$res->{'biblionumber'}>
! $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>OO $pickup</td>
! <TD>$type</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</option>\n";
!     }
!     return $out;
! }
! 
! # make branch selection options...
! sub branchoptions {
!     my ($selbr) = @_;
!     my $out = "";
!     foreach my $br (keys %$branches) {
! 	(next) unless $branches->{$br}->{'IS'};
! 			# Only branches with the 'IS' branchrelation
! 			# can issue books
! 	my $selected = "";
! 	if ($br eq $selbr) {
! 	    $selected = "selected";
  	}
- 	$out .= "<option value=$br $selected>$branches->{$br}->{'branchname'}</option>\n";
-     }
-     return $out;
- }
  
  
  #get the time for the form name...
--- 89,175 ----
  
  
  # get biblioitem information and build rows for form
  my ($count2, at data) = bibitems($bib);
  
+ my @bibitemloop;
  foreach my $dat (sort {$b->{'dateaccessioned'} cmp $a->{'dateaccessioned'}} @data) {
      $dat->{'dewey'}="" if ($dat->{'dewey'} == 0);
      $dat->{'volumeddesc'} = "&nbsp;" unless $dat->{'volumeddesc'};
      $dat->{'dewey'}=~ s/\.0000$//;
      $dat->{'dewey'}=~ s/00$//;
  
! 	my %abibitem;
! 	my @barcodeloop;
!     my @barcodes = barcodes($dat->{'biblioitemnumber'});
!     foreach my $num (@barcodes) {
! 		my %barcode;
! 		$barcode{'barcode'}=$num->{'barcode'};
! 		$barcode{'message'}=$num->{'itemlost'} == 1 ? "(lost)" :
! 	    $num->{'itemlost'} == 2 ? "(long overdue)" : "";
! 		push(@barcodeloop, \%barcode);
      }
! 	$abibitem{'barcodeloop'}=\@barcodeloop;
!     $abibitem{'class'}="$dat->{'classification'}$dat->{'dewey'}$dat->{'subclass'}";
!     my $select;
!     $abibitem{'itemlost'}=(($dat->{'notforloan'})|| ($dat->{'itemlost'} == 1)) ;
! 	$abibitem{'biblioitemnumber'}=$dat->{'biblioitemnumber'};
! 	$abibitem{'description'}=$dat->{'description'};
! 	$abibitem{'volumeddesc'}=$dat->{'volumeddesc'};
! 	$abibitem{'publicationyear'}=$dat->{'publicationyear'};
! 	push(@bibitemloop,\%abibitem);
  }
  
  
  
! #existingreserves building
! my @reserveloop;
! foreach my $res (sort {$a->{'found'} cmp $b->{'found'}} @$reserves){
! 	my %reserve;
! #    my $prioropt = priorityoptions($totalcount, $res->{'priority'});
! 	my @optionloop;
! 	for (my $i=1; $i<=$totalcount; $i++){
! 		my %option;
! 		$option{num}=$i;
! 		$option{selected}=($i==$res->{'priority'});
! 		push(@optionloop, \%option);
  	}
! #    my $bropt = branchoptions($res->{'branchcode'});
! 	my @branchloop;
! 	foreach my $br (keys %$branches) {
! 		(next) unless $branches->{$br}->{'IS'};
! 				# Only branches with the 'IS' branchrelation
! 				# can issue books
! 		my %abranch;
! 		$abranch{'selected'}=($br eq $res->{'branchcode'});
! 		$abranch{'branch'}=$br;
! 		$abranch{'branchname'}=$branches->{$br}->{'branchname'};
! 		push(@branchloop,\%abranch);
  	}
  
+     if ($res->{'found'} eq 'W') {
+ 		my %env;
+ 		my $item = $res->{'itemnumber'};
+ 		$item = getiteminformation(\%env,$item);
+ 		$reserve{'barcode'}=$item->{'barcode'};
+ 		$reserve{'biblionumber'}=$item->{'biblionumber'};
+ 		$reserve{'wbrcode'} = $res->{'branchcode'};
+ 		$reserve{'wbrname'} = $branches->{$wbrcd}->{'branchname'};
+     }
+     $reserve{'date'} = slashifyDate($res->{'reservedate'});
+ 	$reserve{'borrowernumber'}=$res->{'borrowernumber'};
+ 	$reserve{'biblionumber'}=$res->{'biblionumber'};
+ 	$reserve{'bornum'}=$res->{'borrowernumber'};
+ 	$reserve{'firstname'}=$res->{'firstname'};
+ 	$reserve{'bornum'}=$res->{'borrowernumber'};
+ 	$reserve{'notes'}=$res->{'reservenotes'};
+ 	$reserve{'wait'}=($res->{'found'} eq 'W');
+ 	$reserve{'constrainttypea'}=($res->{'constrainttype'} eq 'a');
+ 	$reserve{'constrainttypeo'}=($res->{'constrainttype'} eq 'o');
+ 	$reserve{'voldesc'}=$res->{'volumeddesc'};
+ 	$reserve{'itemtype'}=$res->{'itemtype'};
+ 	$reserve{'branchloop'}=\@branchloop;
+ 	$reserve{'optionloop'}=\@optionloop;
+ 	push(@reserveloop,\%reserve);
+ }
  
  #get the time for the form name...
***************
*** 198,307 ****
  
  
- # printout the page
- 
- 
- 
  
- print $input->header(-expires=>'now');
  
  
  #setup colours
! print startmenu('catalogue');
! 
! 
! 
! 
! 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 >
! <input type=hidden name=biblio value=$bib>
! <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>
! 
! 
! 
! 
! 
! <TABLE  CELLSPACING=0  CELLPADDING=5 border=1 >
! <TR VALIGN=TOP>
! <td  bgcolor="99cc33" background="/images/background-mem.gif"><B>Rank</b></TD>
! <td  bgcolor="99cc33" background="/images/background-mem.gif"><B>Member Number</b></TD>
! <td  bgcolor="99cc33" background="/images/background-mem.gif"><B>Notes</b></TD>
! <td  bgcolor="99cc33" background="/images/background-mem.gif"><B>Date</b></TD>
! <td  bgcolor="99cc33" background="/images/background-mem.gif"><B>Pickup</b></TD>
! <td  bgcolor="99cc33" background="/images/background-mem.gif"><B>Request</b></TD>
! </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>
! 
! 
! 
! <TABLE  CELLSPACING=0  CELLPADDING=5 border=1 >
! <TR VALIGN=TOP>
! 
! <td  bgcolor="99cc33" background="/images/background-mem.gif"><B>Request</b></TD>
! <td  bgcolor="99cc33" background="/images/background-mem.gif"><B>Item Type</b></TD>
! <td  bgcolor="99cc33" background="/images/background-mem.gif"><B>Classification</b></TD>
! <td  bgcolor="99cc33" background="/images/background-mem.gif"><B>Volume</b></TD>
! <td  bgcolor="99cc33" background="/images/background-mem.gif"><B>Pubdate</b></TD>
! <td  bgcolor="99cc33" background="/images/background-mem.gif"><B>Copies</b></TD>
! </TR>
! $bibitemrows
! </table>
! 
! </form>
! <p>&nbsp;</p>
! 
! 
! 
! 
! 
! <form name=T$time action=modrequest.pl method=post>
! 
! <TABLE  CELLSPACING=0  CELLPADDING=5 border=1 >
! 
! <TR VALIGN=TOP>
! 
! <td  bgcolor="99cc33" background="/images/background-mem.gif" colspan=7><B>MODIFY EXISTING REQUESTS </b></TD>
! </TR>
! <TR VALIGN=TOP>
! 
! <td  bgcolor="99cc33" background="/images/background-mem.gif"><B>Rank</b></TD>
! <td  bgcolor="99cc33" background="/images/background-mem.gif"><B>Member</b></TD>
! <td  bgcolor="99cc33" background="/images/background-mem.gif"><B>Notes</b></TD>
! <td  bgcolor="99cc33" background="/images/background-mem.gif"><B>Date</b></TD>
! <td  bgcolor="99cc33" background="/images/background-mem.gif"><B>Pickup</b></TD>
! <td  bgcolor="99cc33" background="/images/background-mem.gif"><B>Request</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
! ;
! 
! print endmenu();
! print endpage();
--- 177,197 ----
  
  
  
  
  
  #setup colours
! my ($template, $borrowernumber, $cookie)
!     = get_template_and_user({template_name => "request.tmpl",
! 							query => $input,
!                             type => "intranet",
!                             authnotrequired => 0,
!                             flagsrequired => {parameters => 1},
!                          });
! $template->param(	optionloop =>\@optionloop,
! 								branchloop => \@branchloop,
! 								reserveloop => \@reserveloop,
! 								'time' => $time,
! 								bibitemloop => \@bibitemloop,
! 								date => $date);
! # printout the page
! print $input->header(-expires=>'now'), $template->output;





More information about the Koha-cvs mailing list