[Koha-cvs] koha/C4 Labels.pm [dev_week]

Mason James szrj1m at yahoo.com
Tue Jul 10 08:36:06 CEST 2007


CVSROOT:	/sources/koha
Module name:	koha
Branch:		dev_week
Changes by:	Mason James <sushi>	07/07/10 06:36:06

Modified files:
	C4             : Labels.pm 

Log message:
	adding get_highest_batch() sub.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Labels.pm?cvsroot=koha&only_with_tag=dev_week&r1=1.3.4.27&r2=1.3.4.28

Patches:
Index: Labels.pm
===================================================================
RCS file: /sources/koha/koha/C4/Labels.pm,v
retrieving revision 1.3.4.27
retrieving revision 1.3.4.28
diff -u -b -r1.3.4.27 -r1.3.4.28
--- Labels.pm	10 Jul 2007 05:51:25 -0000	1.3.4.27
+++ Labels.pm	10 Jul 2007 06:36:05 -0000	1.3.4.28
@@ -61,6 +61,7 @@
   &set_active_layout &by_order
   &build_text_dropbox
   &delete_layout &get_active_layout
+&get_highest_batch
 );
 
 =item get_label_options;
@@ -266,6 +267,28 @@
     return $new_batch;
 }
 
+
+sub get_highest_batch {
+    my $new_batch;
+    my $dbh = C4::Context->dbh;
+    my $q =
+      "select distinct batch_id from labels order by batch_id desc limit 1";
+    my $sth = $dbh->prepare($q);
+    $sth->execute();
+    my $data = $sth->fetchrow_hashref;
+    $sth->finish;
+
+    if ( !$data->{'batch_id'} ) {
+        $new_batch = 1;
+    }
+    else {
+        $new_batch =  $data->{'batch_id'};
+    }
+
+    return $new_batch;
+}
+
+
 sub get_batches {
     my $dbh = C4::Context->dbh;
     my $q   = "select distinct batch_id from labels";





More information about the Koha-cvs mailing list