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 00:48:52 +0000

CVSROOT:        /sources/koha
Module name:    koha
Branch:         dev_week
Changes by:     Mason James <sushi>     07/07/09 00:48:52

Modified files:
        C4             : Labels.pm 

Log message:
        this commit (and previous commit), adding subs to handle text field 
selection and order sorting. also some subs to manage (create/edit/delete) 
layout def's.

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

Patches:
Index: Labels.pm
===================================================================
RCS file: /sources/koha/koha/C4/Labels.pm,v
retrieving revision 1.3.4.17
retrieving revision 1.3.4.18
diff -u -b -r1.3.4.17 -r1.3.4.18
--- Labels.pm   8 Jul 2007 22:14:21 -0000       1.3.4.17
+++ Labels.pm   9 Jul 2007 00:48:52 -0000       1.3.4.18
@@ -59,7 +59,7 @@
 &GetItemFields 
 &get_text_fields 
 &get_layout
-&set_active_layout
+&set_active_layout &by_order
 
 );
 
@@ -84,8 +84,6 @@
 }
 
 
-
-
 sub get_layouts {
 
 ## FIXME: this if/else could be compacted...
@@ -96,10 +94,14 @@
     $sth->execute();
     my @resultsloop;
     while ( my $data = $sth->fetchrow_hashref ) {
-     $data->{'fieldlist'} = "BAR, ITYPE, MOO";
+
+     $data->{'fieldlist'} = get_text_fields($data->{'id'});
         push( @resultsloop, $data );
     }
     $sth->finish;
+### get    9999999999999999999999999999999
+### @resultsloop
+
     return @resultsloop;
 }
 
@@ -113,7 +115,6 @@
     my $sth   = $dbh->prepare($query);
     $sth->execute($layout_id);
     my $data = $sth->fetchrow_hashref;
-    $data->{'fieldlist'} = "BAR, ITYPE, MOO";
     $sth->finish;
     return $data;
 }
@@ -161,18 +162,30 @@
     $f = { code => 'SUBCLASS',    desc => "Sub-Class", order => 
$sortorder->{'subclass'} };
     $g = { code => 'BARCODE',    desc => "Barcode", order => 
$sortorder->{'barcode'} };
     $h = { code => 'AUTHOR',    desc => "Author", order => 
$sortorder->{'author'} };
-    $i = { code => 'TITLE',    desc => "Title", order => '2' };
+    $i = { code => 'TITLE',    desc => "Title", order => > 
$sortorder->{'title'}  };
 
     my @text_fields = ( $a, $b, $c, $d, $e, $f, $g, $h, $i );
 
-### fields need to be sorted here.....
- @textfields = sort { my $ii->{'order'} cmp my $jj->{'order'} } @text_fields ;
-### @text_fields;
-    return @text_fields;
+my @new_fields;
+foreach my $field (@text_fields) {
+    push ( @new_fields, $field)      if $field->{'order'} > 0;
+}
+
+ my @sorted_fields = sort by_order  @new_fields;
 
+my $active_fields;
+foreach my $field (@sorted_fields) {
+### $field
+    $active_fields .= "$field->{'code'} ";
 }
+###  $active_fields 
+    return $active_fields;
 
+}
 
+sub by_order {
+       $$a{order} <=> $$b{order};
+       }
 
 
 




reply via email to

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