[Koha-cvs] koha opac/opac-reserve.pl admin/itemtypes.pl ko... [dev_week]

Chris Cormack crc at liblime.com
Fri Jun 22 01:11:25 CEST 2007


CVSROOT:	/sources/koha
Module name:	koha
Branch:		dev_week
Changes by:	Chris Cormack <rangi>	07/06/21 23:11:24

Modified files:
	opac           : opac-reserve.pl 
	admin          : itemtypes.pl 
	koha-tmpl/intranet-tmpl/npl/en/parameters: itemtypes.tmpl 
	updater        : updatedatabase 

Log message:
	Code to allow the librarians to set an itemtype as not for reserve

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-reserve.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.22.2.9.2.5&r2=1.22.2.9.2.6
http://cvs.savannah.gnu.org/viewcvs/koha/admin/itemtypes.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.16.2.7&r2=1.16.2.7.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/npl/en/parameters/itemtypes.tmpl?cvsroot=koha&only_with_tag=dev_week&r1=1.4.2.5.2.1&r2=1.4.2.5.2.2
http://cvs.savannah.gnu.org/viewcvs/koha/updater/updatedatabase?cvsroot=koha&only_with_tag=dev_week&r1=1.100.2.43.2.12&r2=1.100.2.43.2.13

Patches:
Index: opac/opac-reserve.pl
===================================================================
RCS file: /sources/koha/koha/opac/opac-reserve.pl,v
retrieving revision 1.22.2.9.2.5
retrieving revision 1.22.2.9.2.6
diff -u -b -r1.22.2.9.2.5 -r1.22.2.9.2.6
--- opac/opac-reserve.pl	12 Jun 2007 00:58:17 -0000	1.22.2.9.2.5
+++ opac/opac-reserve.pl	21 Jun 2007 23:11:23 -0000	1.22.2.9.2.6
@@ -132,6 +132,16 @@
 my %types;
 my %itemtypes;
 my @duedates;
+
+# find out if can be reserved
+my @items2;
+foreach my $itm (@items){
+	if (CanBeReserved('',$itm->{'itemtype'})){  # just checking at itemtype level at the moment
+		push @items2,$itm;
+	}
+}
+ at items=@items2;
+
 foreach my $itm (@items) {
     push @duedates, {date_due => format_date($itm->{'date_due'})} if defined $itm->{'date_due'};
     $itm->{$itm->{'publictype'}} = 1;
@@ -285,6 +295,7 @@
 	if ($query->param('all')) {                                                                                                                          
 		CreateReserve(undef,$branch,$borrowernumber,$biblionumber,'a', undef, $rank,'',$title);                                                      
 	}          
+	print $query->redirect("/cgi-bin/koha/opac-user.pl");
 } else {
 	# Here we check that the borrower can actually make reserves Stage 1.
 	my $noreserves = 0;

Index: admin/itemtypes.pl
===================================================================
RCS file: /sources/koha/koha/admin/itemtypes.pl,v
retrieving revision 1.16.2.7
retrieving revision 1.16.2.7.2.1
diff -u -b -r1.16.2.7 -r1.16.2.7.2.1
--- admin/itemtypes.pl	5 Feb 2006 21:59:21 -0000	1.16.2.7
+++ admin/itemtypes.pl	21 Jun 2007 23:11:23 -0000	1.16.2.7.2.1
@@ -96,7 +96,7 @@
 	my $data;
 	if ($itemtype) {
 		my $dbh = C4::Context->dbh;
-		my $sth=$dbh->prepare("select itemtype,description,renewalsallowed,rentalcharge,notforloan from itemtypes where itemtype=?");
+		my $sth=$dbh->prepare("select itemtype,description,renewalsallowed,rentalcharge,notforloan,notforreserve from itemtypes where itemtype=?");
 		$sth->execute($itemtype);
 		$data=$sth->fetchrow_hashref;
 		$sth->finish;
@@ -105,7 +105,8 @@
 							description => $data->{'description'},
 							renewalsallowed => $data->{'renewalsallowed'},
 							rentalcharge => sprintf("%.2f",$data->{'rentalcharge'}),
-							notforloan => $data->{'notforloan'}
+							notforloan => $data->{'notforloan'},
+		                    notforreserve => $data->{'notforreserve'}
 							);
 ;
 													# END $OP eq ADD_FORM
@@ -113,11 +114,11 @@
 # called by add_form, used to insert/modify data in DB
 } elsif ($op eq 'add_validate') {
 	my $dbh = C4::Context->dbh;
-	my $sth=$dbh->prepare("replace itemtypes (itemtype,description,renewalsallowed,rentalcharge,notforloan) values (?,?,?,?,?)");
+	my $sth=$dbh->prepare("replace itemtypes (itemtype,description,renewalsallowed,rentalcharge,notforloan,notforreserve) values (?,?,?,?,?,?)");
 	$sth->execute(
 		$input->param('itemtype'),$input->param('description'),
 		$input->param('renewalsallowed'),$input->param('rentalcharge'),
-		$input->param('notforloan')?1:0);
+		$input->param('notforloan')?1:0, $input->param('notforreserve')?1:0);
 	$sth->finish;
 	print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=itemtypes.pl\"></html>";
 	exit;
@@ -180,6 +181,7 @@
 		$row_data{description} = $results->[$i]{description};
 		$row_data{renewalsallowed} = $results->[$i]{renewalsallowed};
 		$row_data{notforloan} = $results->[$i]{notforloan};
+		$row_data{notforreserve} = $results->[$i]{notforreserve};
 		$row_data{rentalcharge} = sprintf("%.2f",$results->[$i]{rentalcharge});
 		push(@loop_data, \%row_data);
 	}

Index: koha-tmpl/intranet-tmpl/npl/en/parameters/itemtypes.tmpl
===================================================================
RCS file: /sources/koha/koha/koha-tmpl/intranet-tmpl/npl/en/parameters/Attic/itemtypes.tmpl,v
retrieving revision 1.4.2.5.2.1
retrieving revision 1.4.2.5.2.2
diff -u -b -r1.4.2.5.2.1 -r1.4.2.5.2.2
--- koha-tmpl/intranet-tmpl/npl/en/parameters/itemtypes.tmpl	19 Sep 2006 13:22:11 -0000	1.4.2.5.2.1
+++ koha-tmpl/intranet-tmpl/npl/en/parameters/itemtypes.tmpl	21 Jun 2007 23:11:24 -0000	1.4.2.5.2.2
@@ -24,7 +24,7 @@
 			<!-- TMPL_IF name="itemtype" -->
 				<tr><th><label for="">Item type</label></th><td><input type="hidden" name="itemtype" value="<!-- TMPL_VAR name="itemtype" -->" /><!-- TMPL_VAR name="itemtype" --></td></tr>
 			<!-- TMPL_ELSE -->
-				<tr><th><label for="">Item type</label></th><td><input type="text" name="itemtype" size="6" maxlength="4" onblur="toUC(this)" /></td></tr>
+				<tr><th><label for="">Item type</label></th><td><input type="text" name="itemtype" size="13" maxlength="12" onblur="toUC(this)" /></td></tr>
 			<!-- /TMPL_IF -->
 			<tr>
 				<th><label for="description">Description</label></th>
@@ -41,6 +41,12 @@
 				<th><label for="renewalsallowed">Renewals</label></th>
 				<td><input type="text" id="renewalsallowed" name="renewalsallowed" size="3" maxlength="3" value="<!-- TMPL_IF name="renewalsallowed" --><!-- TMPL_VAR NAME="renewalsallowed" --><!-- /TMPL_IF -->" value="1" /></td>
 			</tr>
+
+			<tr>
+				<th><label for="reserves">Not Reservable</label></th>
+				<td><!-- TMPL_IF name="notforreserve" --><input type="checkbox" id="notforreserve" name="notforreserve" checked="checked" value="1" /><!-- TMPL_ELSE --><input type="checkbox" id="notforreserve" name="notforreserve" value="1" /><!-- /TMPL_IF -->
+ (if checked, no item of this type can be reserved.)</td>
+			</tr>
  			<tr>
 				<th><label for="rentalcharge">Rental charge</label></th>
 				<td><input type="text" id="rentalcharge" name="rentalcharge" size="10" value="<!-- TMPL_VAR name="rentalcharge" -->" /></td>
@@ -61,7 +67,9 @@
 	<tr><th>Description</th><td><!-- TMPL_VAR name="description" --></td></tr>
 	<tr><th>Loan length</th><td><!-- TMPL_VAR name="loanlength" --></td></tr>
 	<tr><th>Renewals</th><td><!-- TMPL_IF name="renewalsallowed" -->Allowed<!-- TMPL_ELSE -->Not allowed<!-- /TMPL_IF --></td></tr>
-<tr><th>Rental charge</th><td><!-- TMPL_VAR name="rentalcharge" --></td></tr></table></div>
+    <tr><th>Rental charge</th><td><!-- TMPL_VAR name="rentalcharge" --></td></tr>
+	<tr><th>Not for reserve</th><td><!-- TMPL_IF name="notforreserve" -->Yes<!-- TMPL_ELSE --><!-- /TMPL_IF --></td></tr>
+</table></div>
 		<div class="tabitem"><form action="<!-- TMPL_VAR name="script_name" -->" method="post">
 		<input type="hidden" name="op" value="delete_confirmed" /><input type="hidden" name="itemtype" value="<!-- TMPL_VAR name="itemtype" -->" /><!-- TMPL_IF name="total" -->
 		</form><form action="<!-- TMPL_VAR name="script_name" -->" method="post"><input type="submit" value="OK" class="submit" /></form>
@@ -81,6 +89,7 @@
 		<th>Not for Loan</th>
 		<th>Renewable</th>
 		<th>Charge</th>
+		<th>Not for Reserve</th>		
 		<th>Edit</th>
 		<th>Delete</th>
 	</tr>
@@ -96,6 +105,13 @@
 					<!-- /TMPL_IF -->
 			</td>
 		<td><!-- TMPL_UNLESS name="notforloan" --><!-- TMPL_VAR NAME="rentalcharge" --><!-- /TMPL_UNLESS --></td>
+		<td><!-- TMPL_IF NAME="notforreserve" -->
+						Yes
+						<!-- TMPL_ELSE -->
+						
+					<!-- /TMPL_IF -->
+			</td>
+
 			<td><form action="<!-- TMPL_VAR name="script_name" -->" method="get"><input type="hidden" name="op" value="add_form" /><input type="hidden" name="itemtype" value="<!-- TMPL_VAR name="itemtype" escape="HTML" -->" /><input type="submit" value="Edit" class="submit" /></form></td>
 			<td><form action="<!-- TMPL_VAR name="script_name" -->" method="get"><input type="hidden" name="op" value="delete_confirm" /><input type="hidden" name="itemtype" value="<!-- TMPL_VAR name="itemtype" escape="HTML" -->" /><input type="submit" class="delete" value="Delete" /></form></td>
 		</tr>

Index: updater/updatedatabase
===================================================================
RCS file: /sources/koha/koha/updater/updatedatabase,v
retrieving revision 1.100.2.43.2.12
retrieving revision 1.100.2.43.2.13
diff -u -b -r1.100.2.43.2.12 -r1.100.2.43.2.13
--- updater/updatedatabase	12 Jun 2007 16:49:41 -0000	1.100.2.43.2.12
+++ updater/updatedatabase	21 Jun 2007 23:11:24 -0000	1.100.2.43.2.13
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# $Id: updatedatabase,v 1.100.2.43.2.12 2007/06/12 16:49:41 kylemhall Exp $
+# $Id: updatedatabase,v 1.100.2.43.2.13 2007/06/21 23:11:24 rangi Exp $
 
 # Database Updater
 # This script checks for required updates to the database.
@@ -238,7 +238,7 @@
 
 my %requirefields = (
 	subscription => { 'letter' => 'char(20) NULL', 'distributedto' => 'text NULL'},
-	itemtypes => { 'imageurl' => 'char(200) NULL'},
+	itemtypes => { 'imageurl' => 'char(200) NULL', 'notforreserve' => 'tinyint'},
 	aqbookfund => { 'branchcode' => 'varchar(4) NULL'},
 	aqbudget => { 'branchcode' => 'varchar(4) NULL'},
 	auth_header => { 'marc' => 'BLOB NOT NULL', 'linkid' => 'INT(4) NULL'},
@@ -1778,6 +1778,9 @@
 exit;
 
 # $Log: updatedatabase,v $
+# Revision 1.100.2.43.2.13  2007/06/21 23:11:24  rangi
+# Code to allow the librarians to set an itemtype as not for reserve
+#
 # Revision 1.100.2.43.2.12  2007/06/12 16:49:41  kylemhall
 # Added max_issues_history to borrowers table. Max_issues_history defines
 # how many items will show up in the OPAC Reading History page. So, if





More information about the Koha-cvs mailing list