[Koha-cvs] koha C4/Circulation.pm koha-tmpl/intranet-tmpl/...

Bruno Toumi btoumi at ouestprovence.fr
Wed Jul 25 16:09:40 CEST 2007


CVSROOT:	/cvsroot/koha
Module name:	koha
Changes by:	Bruno Toumi <btoumi>	07/07/25 14:09:40

Modified files:
	C4             : Circulation.pm 
	koha-tmpl/intranet-tmpl/prog/en/circ: circulation.tmpl 
	koha-tmpl/intranet-tmpl/prog/en/members: moremember.tmpl 
	members        : moremember.pl 
	reserve        : renewscript.pl 

Log message:
	add control of 'return date' if it 's a special or repeatable holidays , and return a right return date
	(renewal)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Circulation.pm?cvsroot=koha&r1=1.30&r2=1.31
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/circ/circulation.tmpl?cvsroot=koha&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/members/moremember.tmpl?cvsroot=koha&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/koha/members/moremember.pl?cvsroot=koha&r1=1.42&r2=1.43
http://cvs.savannah.gnu.org/viewcvs/koha/reserve/renewscript.pl?cvsroot=koha&r1=1.10&r2=1.11

Patches:
Index: C4/Circulation.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Circulation.pm,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- C4/Circulation.pm	12 Jul 2007 15:22:09 -0000	1.30
+++ C4/Circulation.pm	25 Jul 2007 14:09:39 -0000	1.31
@@ -17,7 +17,7 @@
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
-# $Id: Circulation.pm,v 1.30 2007/07/12 15:22:09 toins Exp $
+# $Id: Circulation.pm,v 1.31 2007/07/25 14:09:39 btoumi Exp $
 
 use strict;
 require Exporter;
@@ -45,7 +45,7 @@
 our ($VERSION, at ISA, at EXPORT, at EXPORT_OK,%EXPORT_TAGS);
 
 # set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.30 $' =~ /\d+/g; shift(@v).".".join( "_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.31 $' =~ /\d+/g; shift(@v).".".join( "_", map { sprintf "%03d", $_ } @v ); };
 
 =head1 NAME
 
@@ -1633,7 +1633,7 @@
 
 sub AddRenewal {
 
-    my ( $borrowernumber, $itemnumber, $datedue ) = @_;
+    my ( $borrowernumber, $itemnumber, $branch ,$datedue ) = @_;
     my $dbh = C4::Context->dbh;
 
     # If the due date wasn't specified, calculate it by adding the
@@ -1650,7 +1650,7 @@
         my ( $due_year, $due_month, $due_day ) =
           Add_Delta_DHMS( Today_and_Now(), $loanlength, 0, 0, 0 );
         $datedue = "$due_year-$due_month-$due_day";
-
+	$datedue=CheckValidDatedue($datedue,$itemnumber,$branch);
     }
 
     # Find the issues record for this book
@@ -1942,7 +1942,8 @@
 	($dow=0) if ($dow>6);
 	my $result=CheckRepeatableHolidays($itemnumber,$dow,$branchcode);
 	my $countspecial=CheckSpecialHolidays($years,$month,$day,$itemnumber,$branchcode);
-		if (($result ne '0') or ($countspecial ne '0') ){
+	my $countspecialrepeatable=CheckRepeatableSpecialHolidays($month,$day,$itemnumber,$branchcode);
+		if (($result ne '0') or ($countspecial ne '0') or ($countspecialrepeatable ne '0') ){
 		$i=0;
 		(($years,$month,$day) = Add_Delta_Days($years,$month,$day, 1))if ($i ne '1');
 		}
@@ -2002,6 +2003,33 @@
 return $countspecial;
 }
 
+=head2 CheckRepeatableSpecialHolidays
+
+$countspecial = CheckRepeatableSpecialHolidays($month,$day,$itemnumber,$branchcode);
+this function check if the date is a repeatble special holidays
+C<$month>   = the month of datedue
+C<$day>     = the day of datedue
+C<$itemnumber>  = itemnumber
+C<$branchcode>  = localisation of issue 
+=cut
+sub CheckRepeatableSpecialHolidays{
+my ($month,$day,$itemnumber,$branchcode) = @_;
+my $dbh = C4::Context->dbh;
+my $query=qq|SELECT count(*) 
+	     FROM `repeatable_holidays`
+	     WHERE month=?
+	     AND day=?
+             AND branchcode=?
+	    |;
+my $sth = $dbh->prepare($query);
+$sth->execute($month,$day,$branchcode);
+my $countspecial=$sth->fetchrow ;
+$sth->finish;
+return $countspecial;
+}
+
+
+
 sub CheckValidBarcode{
 my ($barcode) = @_;
 my $dbh = C4::Context->dbh;

Index: koha-tmpl/intranet-tmpl/prog/en/circ/circulation.tmpl
===================================================================
RCS file: /cvsroot/koha/koha/koha-tmpl/intranet-tmpl/prog/en/circ/circulation.tmpl,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- koha-tmpl/intranet-tmpl/prog/en/circ/circulation.tmpl	24 Jul 2007 14:17:07 -0000	1.17
+++ koha-tmpl/intranet-tmpl/prog/en/circ/circulation.tmpl	25 Jul 2007 14:09:39 -0000	1.18
@@ -718,6 +718,7 @@
     <input type="hidden" value="circ" name="destination" />
     <input type="hidden" name="cardnumber" value="<!-- TMPL_VAR NAME="cardnumber" -->" />
     <input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR NAME="borrowernumber" -->" />
+    <input type="hidden" name="branch" value="<!-- TMPL_VAR NAME="branch" -->" />	
     
 <!-- TMPL_IF NAME="todayissues" -->
     <table>

Index: koha-tmpl/intranet-tmpl/prog/en/members/moremember.tmpl
===================================================================
RCS file: /cvsroot/koha/koha/koha-tmpl/intranet-tmpl/prog/en/members/moremember.tmpl,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- koha-tmpl/intranet-tmpl/prog/en/members/moremember.tmpl	3 Jul 2007 18:19:51 -0000	1.24
+++ koha-tmpl/intranet-tmpl/prog/en/members/moremember.tmpl	25 Jul 2007 14:09:39 -0000	1.25
@@ -210,6 +210,7 @@
     <h2>Items on loan</h2>
     <form action="/cgi-bin/koha/reserve/renewscript.pl" method="post">
         <input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR NAME="borrowernumber" -->" />
+	<input type="hidden" name="branch" value="<!-- TMPL_VAR NAME="branch" -->" />
     <table>
         <tr>
             <th scope="col">Title</th>

Index: members/moremember.pl
===================================================================
RCS file: /cvsroot/koha/koha/members/moremember.pl,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -b -r1.42 -r1.43
--- members/moremember.pl	17 Jul 2007 08:56:06 -0000	1.42
+++ members/moremember.pl	25 Jul 2007 14:09:39 -0000	1.43
@@ -17,7 +17,7 @@
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
-# $Id: moremember.pl,v 1.42 2007/07/17 08:56:06 toins Exp $
+# $Id: moremember.pl,v 1.43 2007/07/25 14:09:39 btoumi Exp $
 
 =head1 moremember.pl
 
@@ -90,7 +90,8 @@
 
 # re-reregistration function to automatic calcul of date expiry
 (
-    $data->{'dateexpiry'} = GetMembeReregistration(
+#     $data->{'dateexpiry'} = GetMembeReregistration(
+ $data->{'dateexpiry'} = ExtendMemberSubscriptionTo(
         $data->{'categorycode'},
         $borrowernumber, $data->{'dateenrolled'}
     )
@@ -330,7 +331,7 @@
 if ( -e $htdocs . "$picture" ) {
     $template->param( picture => $picture );
 }
-
+my $branch=C4::Context->userenv->{'branch'};
 
 $template->param($data);
 
@@ -338,6 +339,7 @@
     roaddetails      => $roaddetails,
     borrowernumber   => $borrowernumber,
     reregistration   => $reregistration,
+    branch	     => $branch,	
     totalprice       => sprintf( "%.2f", $totalprice ),
     totaldue         => sprintf( "%.2f", $total ),
     issueloop        => \@issuedata,

Index: reserve/renewscript.pl
===================================================================
RCS file: /cvsroot/koha/koha/reserve/renewscript.pl,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- reserve/renewscript.pl	15 Jun 2007 13:44:46 -0000	1.10
+++ reserve/renewscript.pl	25 Jul 2007 14:09:40 -0000	1.11
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# $Id: renewscript.pl,v 1.10 2007/06/15 13:44:46 tipaul Exp $
+# $Id: renewscript.pl,v 1.11 2007/07/25 14:09:40 btoumi Exp $
 
 #written 18/1/2000 by chris at katipo.co.nz
 #script to renew items from the web
@@ -39,7 +39,7 @@
 else {
     @data = $input->param('items[]');
 }
-
+my $branch=$input->param('branch');
 #
 # renew items
 #
@@ -51,7 +51,7 @@
 #    warn "CanBookbeRenewed";
     if (CanBookBeRenewed($borrowernumber,$itemno)){
 #	warn "$itemno can be renewed for $borrowernumber";
-        AddRenewal($borrowernumber,$itemno);
+        AddRenewal($borrowernumber,$itemno,$branch);
 #	warn "renewal added";
 #    }else {
 #	warn "cannot renew";





More information about the Koha-cvs mailing list