[Koha-cvs] koha/C4 Serials.pm

paul poulain paul at koha-fr.org
Fri Aug 11 16:35:10 CEST 2006


CVSROOT:	/sources/koha
Module name:	koha
Changes by:	paul poulain <tipaul>	06/08/11 14:35:10

Modified files:
	C4             : Serials.pm 

Log message:
	reintroducing letters management dropped by toins synch

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Serials.pm?cvsroot=koha&r1=1.4&r2=1.5

Patches:
Index: Serials.pm
===================================================================
RCS file: /sources/koha/koha/C4/Serials.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- Serials.pm	21 Jul 2006 01:48:41 -0000	1.4
+++ Serials.pm	11 Aug 2006 14:35:10 -0000	1.5
@@ -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: Serials.pm,v 1.4 2006/07/21 01:48:41 bob_lyon Exp $
+# $Id: Serials.pm,v 1.5 2006/08/11 14:35:10 tipaul Exp $
 
 use strict;
 use C4::Date;
@@ -25,12 +25,13 @@
 use C4::Suggestions;
 use C4::Biblio;
 use C4::Search;
+use C4::Letters;
 require Exporter;
 
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
 
 # set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.4 $' =~ /\d+/g;
+$VERSION = do { my @v = '$Revision: 1.5 $' =~ /\d+/g;
         shift(@v) . "." . join("_", map {sprintf "%03d", $_ } @v); };
 
 
@@ -1002,7 +1003,7 @@
         $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
         $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
         $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
-        $numberingmethod, $status, $notes) = @_;
+        $numberingmethod, $status, $notes, $letter) = @_;
     my $dbh = C4::Context->dbh;
 #save subscription (insert into database)
     my $query = qq|
@@ -1012,8 +1013,8 @@
             add1,every1,whenmorethan1,setto1,lastvalue1,innerloop1,
             add2,every2,whenmorethan2,setto2,lastvalue2,innerloop2,
             add3,every3,whenmorethan3,setto3,lastvalue3,innerloop3,
-            numberingmethod, status, notes)
-        VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
+            numberingmethod, status, notes, letter)
+        VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
         |;
     my $sth=$dbh->prepare($query);
     $sth->execute(
@@ -1022,7 +1023,7 @@
         $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
         $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
         $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
-        $numberingmethod, $status, $notes);
+        $numberingmethod, $status, $notes, $letter);
 
 #then create the 1st waited number
     my $subscriptionid = $dbh->{'mysql_insertid'};
@@ -1188,6 +1189,13 @@
 	$sth = $dbh->prepare("update subscription set lastvalue1=?, lastvalue2=?,lastvalue3=? where subscriptionid = ?");
 	$sth->execute($newlastvalue1,$newlastvalue2,$newlastvalue3,$subscriptionid);
     }
+    # check if an alert must be sent... (= a letter is defined & status became "arrived"
+   	$sth = $dbh->prepare("select * from subscription where subscriptionid = ? ");
+	$sth->execute($subscriptionid);
+	my $subscription = $sth->fetchrow_hashref; 
+    if ($subscription->{letter} && $status eq 2) {
+        sendalerts('issue',$subscription->{subscriptionid},$subscription->{letter});
+    }
 }
 
 





More information about the Koha-cvs mailing list