[Koha-cvs] koha circ/circulation.pl koha-tmpl/intranet-tmp...

LAURIN arnaud alaurin at ouestprovence.fr
Thu Jun 1 12:03:08 CEST 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch: 	
Changes by:	LAURIN arnaud <alaurin at savannah.gnu.org>	06/06/01 10:03:08

Modified files:
	circ           : circulation.pl 
	koha-tmpl/intranet-tmpl/prog/en/circ: circulation.tmpl 

Log message:
	Improvements for reserves infos in circulation.pl
	
	new infos displayed :
	
	-Waiting position of borrower on document reserve .
	-Follow the document he's in transfert 	.
	-more infos of document are displayed in a specific cell ....
	
	N.B : the old display of reserves infos are only commented, will be removed, if new display is ok for everybody ...

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha/circ/circulation.pl.diff?tr1=1.92&tr2=1.93&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/koha/koha/koha-tmpl/intranet-tmpl/prog/en/circ/circulation.tmpl.diff?tr1=1.5&tr2=1.6&r1=text&r2=text

Patches:
Index: koha/circ/circulation.pl
diff -u koha/circ/circulation.pl:1.92 koha/circ/circulation.pl:1.93
--- koha/circ/circulation.pl:1.92	Thu Jun  1 01:44:16 2006
+++ koha/circ/circulation.pl	Thu Jun  1 10:03:08 2006
@@ -25,6 +25,7 @@
 use strict;
 use CGI;
 use C4::Circulation::Circ2;
+use C4::Search;
 use C4::Members;
 use C4::Output;
 use C4::Print;
@@ -35,6 +36,8 @@
 use HTML::Template;
 use C4::Date;
 use Date::Manip;
+use C4::Biblio;
+use C4::Reserves2;
 
 #
 # PARAMETERS READING
@@ -51,50 +54,43 @@
     }
 );
 my $branches = getbranches();
-my $printers = getprinters();
-my $branch   = getbranch( $query, $branches );
-my $printer  = getprinter( $query, $printers );
+# my $printers = getprinters();
+# my $printer = getprinter($query, $printers);
 
 my $findborrower = $query->param('findborrower');
 $findborrower =~ s|,| |g;
 $findborrower =~ s|'| |g;
 my $borrowernumber = $query->param('borrnumber');
-my $print          = $query->param('print') || '';
-my $barcode        = $query->param('barcode') || '';
-my $year           = $query->param('year');
-my $month          = $query->param('month');
-my $day            = $query->param('day');
-my $stickyduedate  = $query->param('stickyduedate');
+# new op dev the branch and the printer are now defined by the userenv
+my $branch = C4::Context->userenv->{'branch'};
+my $printer=C4::Context->userenv->{'branchprinter'};
+
+my $barcode = $query->param('barcode') || '';
+my $year=$query->param('year');
+my $month=$query->param('month');
+my $day=$query->param('day');
+my $stickyduedate=$query->param('stickyduedate');
 my $issueconfirmed = $query->param('issueconfirmed');
 my $cancelreserve  = $query->param('cancelreserve');
 my $organisation   = $query->param('organisations');
+my $print = $query->param('print');
 
 #set up cookie.....
-my $branchcookie;
-my $printercookie;
-if ( $query->param('setcookies') ) {
-    $branchcookie = $query->cookie(
-        -name    => 'branch',
-        -value   => "$branch",
-        -expires => '+1y'
-    );
-    $printercookie = $query->cookie(
-        -name    => 'printer',
-        -value   => "$printer",
-        -expires => '+1y'
-    );
-}
-
-my %env
-  ; # FIXME env is used as an "environment" variable. Could be dropped probably...
-
-$env{'branchcode'} = $branch;
-$env{'printer'}    = $printer;
-$env{'queue'}      = $printer;
-$env{'organisation'} = $organisation;
+# my $branchcookie;
+# my $printercookie;
+# if ($query->param('setcookies')) {
+# 	$branchcookie = $query->cookie(-name=>'branch', -value=>"$branch", -expires=>'+1y');
+# 	$printercookie = $query->cookie(-name=>'printer', -value=>"$printer", -expires=>'+1y');
+# }
 
-my @datearr = localtime( time() );
+my %env; # FIXME env is used as an "environment" variable. Could be dropped probably...
+#
+my $print; 
+$env{'branchcode'}= $branch;
+$env{'printer'}= $printer;
+# $env{'queue'}=$printer;
 
+my @datearr = localtime(time());
 # FIXME - Could just use POSIX::strftime("%Y%m%d", localtime);
 my $todaysdate =
     ( 1900 + $datearr[5] )
@@ -212,6 +208,70 @@
 
 ##################################################################################
 # BUILD HTML
+# show all reserves of this borrower, and the position of the reservation ....
+if ($borrowernumber) {
+# new op dev
+# now we show the status of the borrower's reservations
+	my @borrowerreserv = FastFindReserves(0,$borrowernumber);
+	my @reservloop;
+	foreach my $num_res (@borrowerreserv) {
+		my %getreserv;
+		my %env;
+		my $getiteminfo = getiteminformation(\%env,$num_res->{'itemnumber'});
+		my $itemtypeinfo = getitemtypeinfo($getiteminfo->{'itemtype'});
+		my ($transfertwhen,$transfertfrom,$transfertto) = checktransferts($num_res->{'itemnumber'});
+
+		$getreserv{waiting} = 0;
+		$getreserv{transfered} = 0;
+		$getreserv{nottransfered} = 0;
+
+		$getreserv{reservedate} = format_date($num_res->{'reservedate'});
+		$getreserv{biblionumber} = $getiteminfo->{'biblionumber'};
+		$getreserv{title} = $getiteminfo->{'title'};
+		$getreserv{itemtype} = $itemtypeinfo->{'description'};
+		$getreserv{author} = $getiteminfo->{'author'};
+		$getreserv{barcodereserv} = $getiteminfo->{'barcode'};
+		$getreserv{itemcallnumber} = $getiteminfo->{'itemcallnumber'};
+# 		check if we have a waitin status for reservations
+		if ($num_res->{'found'} eq 'W'){
+			$getreserv{color} = 'reserved';
+			$getreserv{waiting} = 1; 
+		}
+
+# 		check transfers with the itemnumber foud in th reservation loop
+		if ($transfertwhen){
+		$getreserv{color} = 'transfered';
+		$getreserv{transfered} = 1;
+		$getreserv{datesent} = format_date($transfertwhen);
+		$getreserv{frombranch} = getbranchname($transfertfrom);
+		}
+
+		if (($getiteminfo->{'holdingbranch'} ne $num_res->{'branchcode'}) and not $transfertwhen){
+		$getreserv{nottransfered} = 1;
+		$getreserv{nottransferedby} = getbranchname($getiteminfo->{'holdingbranch'});
+		}
+
+# 		if we don't have a reserv on item, we put the biblio infos and the waiting position	
+		if ($getiteminfo->{'title'} eq '' ){
+			my $getbibinfo = bibitemdata($num_res->{'biblionumber'});
+			my $getbibtype = getitemtypeinfo($getbibinfo->{'itemtype'});
+			$getreserv{color} = 'inwait';
+			$getreserv{title} = $getbibinfo->{'title'};
+			$getreserv{waitingposition} = $num_res->{'priority'};
+			$getreserv{nottransfered} = 0;
+			$getreserv{itemtype} = $getbibtype->{'description'};
+			$getreserv{author} = $getbibinfo->{'author'};
+			$getreserv{itemcallnumber} = '----------';
+			
+ 		}
+
+		push(@reservloop, \%getreserv);
+	}
+	# return result to the template
+	$template->param(reservloop => \@reservloop);
+
+}
+
 
 # make the issued books table.....
 my $todaysissues = '';
@@ -365,8 +425,7 @@
     borrowernumber    => $borrowernumber,
     branch            => $branch,
     printer           => $printer,
-    branchname        => $branches->{$branch}->{'branchname'},
-    printername       => $printers->{$printer}->{'printername'},
+    printername       => $printer,
     firstname         => $borrower->{'firstname'},
     surname           => $borrower->{'surname'},
     categorycode      => $borrower->{'categorycode'},
@@ -399,9 +458,10 @@
     );
 }
 
-if ($branchcookie) {
-    $cookie = [ $cookie, $branchcookie, $printercookie ];
-}
+
+# if ($branchcookie) {
+#     $cookie=[$cookie, $branchcookie, $printercookie];
+# }
 
 output_html_with_http_headers $query, $cookie, $template->output;
 
@@ -450,24 +510,25 @@
                     chargesmsg => $flags->{'CHARGES'}->{'message'}
                 );
             }
-            if ( $flag eq 'WAITING' ) {
-                my $items = $flags->{$flag}->{'itemlist'};
-                my @itemswaiting;
-                foreach my $item (@$items) {
-                    my ($iteminformation) =
-                      getiteminformation( \%env, $item->{'itemnumber'}, 0 );
-                    $iteminformation->{'branchname'} =
-                      $branches->{ $iteminformation->{'holdingbranch'} }
-                      ->{'branchname'};
-                    push @itemswaiting, $iteminformation;
-                }
-                $template->param(
-                    flagged      => 1,
-                    waiting      => 'true',
-                    waitingmsg   => $flags->{'WAITING'}->{'message'},
-                    itemswaiting => \@itemswaiting,
-                );
-            }
+# FIXME this part can be removed if we keep new display of reserves "reservloop"
+#             if ( $flag eq 'WAITING' ) {
+#                 my $items = $flags->{$flag}->{'itemlist'};
+#                 my @itemswaiting;
+#                 foreach my $item (@$items) {
+#                     my ($iteminformation) =
+#                       getiteminformation( \%env, $item->{'itemnumber'}, 0 );
+#                     $iteminformation->{'branchname'} =
+#                       $branches->{ $iteminformation->{'holdingbranch'} }
+#                       ->{'branchname'};
+#                     push @itemswaiting, $iteminformation;
+#                 }
+#                 $template->param(
+#                     flagged      => 1,
+#                     waiting      => 'true',
+#                     waitingmsg   => $flags->{'WAITING'}->{'message'},
+#                     itemswaiting => \@itemswaiting,
+#                 );
+#             }
             if ( $flag eq 'ODUES' ) {
                 $template->param(
                     odues    => 'true',
Index: koha/koha-tmpl/intranet-tmpl/prog/en/circ/circulation.tmpl
diff -u koha/koha-tmpl/intranet-tmpl/prog/en/circ/circulation.tmpl:1.5 koha/koha-tmpl/intranet-tmpl/prog/en/circ/circulation.tmpl:1.6
--- koha/koha-tmpl/intranet-tmpl/prog/en/circ/circulation.tmpl:1.5	Thu Jun  1 01:44:16 2006
+++ koha/koha-tmpl/intranet-tmpl/prog/en/circ/circulation.tmpl	Thu Jun  1 10:03:08 2006
@@ -241,7 +241,7 @@
     </li>
       <!-- /TMPL_IF -->
   </ul>
-
+<!-- this part must be removed if we keep the new waiting infos display-->
       <!-- TMPL_IF name="waiting" -->
   <ul>
     <li>
@@ -257,6 +257,7 @@
     </li>
   </ul>
       <!-- /TMPL_IF --> <!-- waiting -->
+<!-- end of this part must be removed if we keep the new waiting infos display-->
 
       <!-- TMPL_IF name="notes" -->
   <ul>
@@ -627,6 +628,59 @@
 
   </fieldset>
 </form>
+
+<!-- TMPL_IF NAME="reservloop" -->
+<fieldset id="circ_circulation_issue">
+	<legend>Borrower current reserves</legend>
+	<table>
+		<tr>
+			<th>Reserve date</th>
+			<th>Barcode</th>
+			<th>Title</th>
+			<th>Author</th>
+			<th>Localisation</th>
+		</tr>
+		<!-- TMPL_LOOP NAME="reservloop" -->
+		<tr class="<!-- TMPL_VAR NAME="color" -->">
+					<td>
+						<!-- TMPL_VAR NAME="reservedate" -->
+					</td>
+					<td>
+						<!-- TMPL_IF name="barcodereserv" -->
+						<a href="/cgi-bin/koha/detail.pl?bib=<!-- TMPL_VAR NAME="biblionumber" -->&amp;type=intra" onclick="openWindow(this, 'Item', 480, 640); return false;"><!-- TMPL_VAR NAME="barcodereserv" --></a>
+						<!-- /TMPL_IF -->
+						<!-- TMPL_IF NAME="waitingposition" -->
+						Waiting position for this document :
+						<b> <!-- TMPL_VAR NAME="waitingposition" --> </b>
+						<!-- /TMPL_IF -->
+					</td>
+					<td>
+						<!-- TMPL_VAR NAME="title" --> (<b> <!-- TMPL_VAR NAME="itemtype" --> </b>) 
+
+						<!-- TMPL_IF name="waiting" -->
+						<br/>
+						<i>This document is available</i>
+						<!-- /TMPL_IF -->
+						<!-- TMPL_IF name="transfered" -->
+						<br/>
+						<i>This document has been transfered from library : 
+						<!-- TMPL_VAR NAME="frombranch" --> the : <!-- TMPL_VAR NAME="datesent" --> </i>
+						<!-- /TMPL_IF -->
+
+						<!-- TMPL_IF name="nottransfered" -->
+						<br/>
+						<i>This document hasn't been transfered yet from library : <!-- TMPL_VAR NAME="nottransferedby" --></i>
+						<!-- /TMPL_IF -->
+				
+					</td>
+					<td><!-- TMPL_VAR NAME="author" --></td>
+					<td><!-- TMPL_VAR NAME="itemcallnumber" --></td>
+			</tr>
+		<!-- /TMPL_LOOP -->
+	</table>
+</fieldset>
+<!-- /TMPL_IF -->
+
 <!-- /TMPL_IF --> <!-- borrowernumber -->
 
 <!-- SUMMARY : TODAY & PREVIOUS ISSUES -->
@@ -741,7 +795,6 @@
       <input type="submit" name="renew_checked" value="Renew Checked Items" />
       <input type="submit" name="renew_all" value="Renew All" />
     </div>
-    
   </fieldset>
 </form>
 





More information about the Koha-cvs mailing list