koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Mason James
Subject: [Koha-cvs] koha/C4 Labels.pm [dev_week]
Date: Mon, 09 Jul 2007 18:04:09 +0000

CVSROOT:        /sources/koha
Module name:    koha
Branch:         dev_week
Changes by:     Mason James <sushi>     07/07/09 18:04:09

Modified files:
        C4             : Labels.pm 

Log message:
        misc little changes for barcodes gui

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

Patches:
Index: Labels.pm
===================================================================
RCS file: /sources/koha/koha/C4/Labels.pm,v
retrieving revision 1.3.4.19
retrieving revision 1.3.4.20
diff -u -b -r1.3.4.19 -r1.3.4.20
--- Labels.pm   9 Jul 2007 05:33:50 -0000       1.3.4.19
+++ Labels.pm   9 Jul 2007 18:04:09 -0000       1.3.4.20
@@ -58,10 +58,10 @@
   &add_batch &SetFontSize &printText
   &GetItemFields
   &get_text_fields
-  &get_layout
+  &get_layout &save_layout
   &set_active_layout &by_order
   &build_text_dropbox
-
+ &delete_layout
 );
 
 =item get_label_options;
@@ -120,27 +120,46 @@
     return $data;
 }
 
+
+
+sub delete_layout {
+    my ($layout_id) = @_;
+    my $dbh = C4::Context->dbh;
+    # get the actual items to be printed.
+    my $query = "delete from  labels_conf where id = ?";
+    my $sth   = $dbh->prepare($query);
+    $sth->execute($layout_id);
+    $sth->finish;
+}
+
+
+
+
+
+
+
+
 sub get_printingtypes {
-    my ( $a, $b, $c, $d, $e );
+    my ($layout_id) = @_;
+    my @printtypes;
 
-    $a = { code => 'BAR',    desc => "barcode" };
-    $b = { code => 'BIB',    desc => "biblio" };
-    $c = { code => 'BARBIB', desc => "barcode / biblio" };
-    $d = { code => 'BIBBAR', desc => "biblio / barcode" };
-    $e = { code => 'ALT',    desc => "alternating labels" };
-
-    my @printingtypes       = ( $a, $b, $c, $d, $e );
-    my $conf                = get_label_options();
-    my $active_printingtype = $conf->{'printingtype'};
+    push (@printtypes,  { code => 'BAR',    desc => "barcode" });
+     push (@printtypes,  { code => 'BIB',    desc => "biblio" });
+      push (@printtypes,   { code => 'BARBIB', desc => "barcode / biblio" });
+   push (@printtypes,      { code => 'BIBBAR', desc => "biblio / barcode" });
+   push (@printtypes,      { code => 'ALT',    desc => "alternating labels" });
+
+    my $conf                = get_layout($layout_id);
+    my $active_printtype = $conf->{'printtype'};
 
     # lop thru layout, insert selected to hash
 
-    foreach my $printingtype (@printingtypes) {
-        if ( $printingtype->{'code'} eq $active_printingtype ) {
-            $printingtype->{'active'} = 'MOO';
+    foreach my $printtype (@printtypes) {
+        if ( $printtype->{'code'} eq $active_printtype ) {
+            $printtype->{'active'} = 'MOO';
         }
     }
-    return @printingtypes;
+    return @printtypes;
 }
 
 sub build_text_dropbox {
@@ -151,12 +170,16 @@
     my $field_count = 10;    # <-----------       FIXME hard coded
 
     my @lines;
+!$order ? push (@lines, {num => '', selected => '1'}) :  push (@lines, {num => 
''}) ;
     for ( my $i = 1 ; $i <= $field_count ; $i++ ) {
         my $line = { num => "$i" };
         $line->{'selected'} = 1 if $i eq $order;
         push( @lines, $line );
     }
-### @lines
+# add a blank row too
+
+
+
     return @lines;
 }
 
@@ -268,12 +291,21 @@
 }
 
 sub get_barcode_types {
-    my $a = { code => 'CODE39',    desc => 'Code 39' };
-    my $b = { code => 'CODE39MOD', desc => 'Code39 + Modulo43' };
-    my $c = { code => 'ITF',       desc => 'Interleaved 2 of 5' };
-
-    my @array = ( $a, $b, $c );
+    my ($layout_id) = @_;
+    my $layout = get_layout($layout_id);
+    my $barcode = $layout->{'barcodetype'};
+    my @array;
+
+    push (@array,  { code => 'CODE39',    desc => 'Code 39' });
+    push (@array,   { code => 'CODE39MOD', desc => 'Code39 + Modulo43' });
+    push (@array,  { code => 'ITF',       desc => 'Interleaved 2 of 5' });
+
+    foreach my $line (@array) {
+        if ($line->{'code'} eq $barcode) {
+            $line->{'active'} = 1;
+        }
 
+    }
     return @array;
 }
 
@@ -491,6 +523,39 @@
     return;
 }
 
+
+
+sub save_layout  {
+
+    my (
+        $barcodetype,  $title,          $isbn,       $issn,
+        $itemtype,     $bcn,            $dcn,        $classif,
+        $subclass,     $itemcallnumber, $author,     $tmpl_id,
+        $printingtype, $guidebox,       $startlabel, $layoutname,
+        $layout_id
+    ) = @_;
+### $layoutname
+### $layout_id
+
+    my $dbh    = C4::Context->dbh;
+    my $query2 = "update labels_conf set 
+             barcodetype=?, title=?, isbn=?,issn=?, 
+            itemtype=?, barcode=?,    dewey=?, class=?,
+             subclass=?, itemcallnumber=?, author=?,  printingtype=?,  
+               guidebox=?, startlabel=?, layoutname=? where id = ?";
+    my $sth2 = $dbh->prepare($query2);
+    $sth2->execute(
+        $barcodetype, $title, $isbn, $issn,
+        $itemtype, $bcn,            $dcn,    $classif,
+        $subclass, $itemcallnumber, $author, $printingtype,
+        $guidebox, $startlabel,     $layoutname, $layout_id
+    );
+    $sth2->finish;
+
+    return;
+}
+
+
 =item get_label_items;
 
         $options = get_label_items()




reply via email to

[Prev in Thread] Current Thread [Next in Thread]