[Top][All Lists]
[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 05:33:51 +0000 |
CVSROOT: /sources/koha
Module name: koha
Branch: dev_week
Changes by: Mason James <sushi> 07/07/09 05:33:51
Modified files:
C4 : Labels.pm
Log message:
new dropbox() for layout edit
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Labels.pm?cvsroot=koha&only_with_tag=dev_week&r1=1.3.4.18&r2=1.3.4.19
Patches:
Index: Labels.pm
===================================================================
RCS file: /sources/koha/koha/C4/Labels.pm,v
retrieving revision 1.3.4.18
retrieving revision 1.3.4.19
diff -u -b -r1.3.4.18 -r1.3.4.19
--- Labels.pm 9 Jul 2007 00:48:52 -0000 1.3.4.18
+++ Labels.pm 9 Jul 2007 05:33:50 -0000 1.3.4.19
@@ -53,13 +53,14 @@
&GetUnitsValue &DrawBarcode
&get_printingtypes
&get_layouts
-&get_barcode_types
+ &get_barcode_types
&get_batches &delete_batch
&add_batch &SetFontSize &printText
-&GetItemFields
-&get_text_fields
-&get_layout
-&set_active_layout &by_order
+ &GetItemFields
+ &get_text_fields
+ &get_layout
+ &set_active_layout &by_order
+ &build_text_dropbox
);
@@ -83,7 +84,6 @@
return $conf_data;
}
-
sub get_layouts {
## FIXME: this if/else could be compacted...
@@ -95,12 +95,12 @@
my @resultsloop;
while ( my $data = $sth->fetchrow_hashref ) {
- $data->{'fieldlist'} = get_text_fields($data->{'id'});
+ $data->{'fieldlist'} = get_text_fields( $data->{'id'} );
push( @resultsloop, $data );
}
$sth->finish;
-### get 9999999999999999999999999999999
-### @resultsloop
+
+ # @resultsloop
return @resultsloop;
}
@@ -108,8 +108,9 @@
sub get_layout {
## FIXME: this if/else could be compacted...
-my ($layout_id) = @_;
+ my ($layout_id) = @_;
my $dbh = C4::Context->dbh;
+
# get the actual items to be printed.
my $query = " Select * from labels_conf where id = ?";
my $sth = $dbh->prepare($query);
@@ -119,10 +120,6 @@
return $data;
}
-
-
-
-
sub get_printingtypes {
my ( $a, $b, $c, $d, $e );
@@ -133,61 +130,95 @@
$e = { code => 'ALT', desc => "alternating labels" };
my @printingtypes = ( $a, $b, $c, $d, $e );
- my $conf= get_label_options();
+ my $conf = get_label_options();
my $active_printingtype = $conf->{'printingtype'};
-# lop thru layout, insert selected to hash
- foreach my $printingtype(@printingtypes) {
- if ($printingtype->{'code'} eq $active_printingtype) {
+ # lop thru layout, insert selected to hash
+
+ foreach my $printingtype (@printingtypes) {
+ if ( $printingtype->{'code'} eq $active_printingtype ) {
$printingtype->{'active'} = 'MOO';
}
}
return @printingtypes;
}
+sub build_text_dropbox {
+ my ($order) = @_;
+# my @fields = get_text_fields();
+# my $field_count = scalar @fields;
+ my $field_count = 10; # <----------- FIXME hard coded
+
+ my @lines;
+ for ( my $i = 1 ; $i <= $field_count ; $i++ ) {
+ my $line = { num => "$i" };
+ $line->{'selected'} = 1 if $i eq $order;
+ push( @lines, $line );
+ }
+### @lines
+ return @lines;
+}
sub get_text_fields {
my ($layout_id) = @_;
my ( $a, $b, $c, $d, $e, $f, $g, $h, $i );
-my $sortorder = get_layout($layout_id);
-### $sortorder
+ my $sortorder = get_layout($layout_id);
+
+ # $sortorder
- $a = { code => 'ITYPE', desc => "Item Type", order =>
$sortorder->{'itemtype'} };
- $b = { code => 'DEWEY', desc => "Dewey/Callnumber", order =>
$sortorder->{'dewey'} };
+ $a = {
+ code => 'ITYPE',
+ desc => "Item Type",
+ order => $sortorder->{'itemtype'}
+ };
+ $b = {
+ code => 'DEWEY',
+ desc => "Dewey/Callnumber",
+ order => $sortorder->{'dewey'}
+ };
$c = { code => 'ISSN', desc => "ISSN", order => $sortorder->{'issn'} };
$d = { code => 'ISBN', desc => "ISBN", order => $sortorder->{'isbn'} };
- $e = { code => 'CLASS', desc => "Classification", order =>
$sortorder->{'class'} };
- $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 => >
$sortorder->{'title'} };
+ $e = {
+ code => 'CLASS',
+ desc => "Classification",
+ order => $sortorder->{'class'}
+ };
+ $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 => $sortorder->{'title'} };
my @text_fields = ( $a, $b, $c, $d, $e, $f, $g, $h, $i );
-my @new_fields;
-foreach my $field (@text_fields) {
- push ( @new_fields, $field) if $field->{'order'} > 0;
-}
+ 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
+ my $active_fields;
+ foreach my $field (@sorted_fields) {
$active_fields .= "$field->{'code'} ";
-}
-### $active_fields
+ }
return $active_fields;
}
sub by_order {
$$a{order} <=> $$b{order};
- }
-
-
+}
sub add_batch {
my $new_batch;
@@ -199,38 +230,16 @@
my $data = $sth->fetchrow_hashref;
$sth->finish;
- if( !$data->{'batch_id'}) {
+ if ( !$data->{'batch_id'} ) {
$new_batch = 1;
- } else {
- $new_batch = ($data->{'batch_id'} + 1);
+ }
+ else {
+ $new_batch = ( $data->{'batch_id'} + 1 );
}
return $new_batch;
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
sub get_batches {
my $dbh = C4::Context->dbh;
my $q = "select distinct batch_id from labels";
@@ -242,9 +251,9 @@
}
$sth->finish;
-# adding a dummy batch=1 value , if none exists in the db
- if (!scalar(@resultsloop) ) {
- push (@resultsloop , { batch_id => '1'});
+ # adding a dummy batch=1 value , if none exists in the db
+ if ( !scalar(@resultsloop) ) {
+ push( @resultsloop, { batch_id => '1' } );
}
return @resultsloop;
}
@@ -333,7 +342,6 @@
$sth->finish;
}
-
sub set_active_layout {
my ($layout_id) = @_;
@@ -348,12 +356,6 @@
$sth->finish;
}
-
-
-
-
-
-
sub DeleteTemplate {
my ($tmpl_code) = @_;
my $dbh = C4::Context->dbh;
@@ -460,10 +462,10 @@
sub SaveConf {
my (
- $barcodetype, $title, $isbn,
- $issn, $itemtype, $bcn, $dcn,
- $classif, $subclass, $itemcallnumber, $author,
- $tmpl_id, $printingtype, $guidebox, $startlabel, $layoutname
+ $barcodetype, $title, $isbn, $issn,
+ $itemtype, $bcn, $dcn, $classif,
+ $subclass, $itemcallnumber, $author, $tmpl_id,
+ $printingtype, $guidebox, $startlabel, $layoutname
) = @_;
my $dbh = C4::Context->dbh;
@@ -478,6 +480,7 @@
my $sth2 = $dbh->prepare($query2);
$sth2->execute(
$barcodetype, $title, $isbn, $issn,
+
$itemtype, $bcn, $dcn, $classif,
$subclass, $itemcallnumber, $author, $printingtype,
$guidebox, $startlabel, $layoutname
@@ -559,8 +562,6 @@
return @fields;
}
-
-
sub DrawSpineText {
my ( $y_pos, $label_height, $fontsize, $x_pos, $left_text_margin,
@@ -586,12 +587,12 @@
#warn Dumper $item;
foreach my $field (@fields) {
-# testing hack
- $$item->{"$field"} = $field.": ".$$item->{"$field"};
+ # testing hack
-warn $$item->{"$field"};
+ $$item->{"$field"} = $field . ": " . $$item->{"$field"};
+ warn $$item->{"$field"};
# if the display option for this field is selected in the DB,
# and the item record has some values for this field, display it.
- [Koha-cvs] koha/C4 Labels.pm [dev_week], Mason James, 2007/07/03
- [Koha-cvs] koha/C4 Labels.pm [dev_week], Mason James, 2007/07/05
- [Koha-cvs] koha/C4 Labels.pm [dev_week], Mason James, 2007/07/05
- [Koha-cvs] koha/C4 Labels.pm [dev_week], Mason James, 2007/07/05
- [Koha-cvs] koha/C4 Labels.pm [dev_week], Mason James, 2007/07/05
- [Koha-cvs] koha/C4 Labels.pm [dev_week], Mason James, 2007/07/06
- [Koha-cvs] koha/C4 Labels.pm [dev_week], Mason James, 2007/07/06
- [Koha-cvs] koha/C4 Labels.pm [dev_week], Mason James, 2007/07/08
- [Koha-cvs] koha/C4 Labels.pm [dev_week], Mason James, 2007/07/08
- [Koha-cvs] koha/C4 Labels.pm [dev_week],
Mason James <=
- [Koha-cvs] koha/C4 Labels.pm [dev_week], Mason James, 2007/07/09
- [Koha-cvs] koha/C4 Labels.pm [dev_week], Mason James, 2007/07/09
- [Koha-cvs] koha/C4 Labels.pm [dev_week], Mason James, 2007/07/09
- [Koha-cvs] koha/C4 Labels.pm [dev_week], Mason James, 2007/07/09
- [Koha-cvs] koha/C4 Labels.pm [dev_week], Mason James, 2007/07/10
- [Koha-cvs] koha/C4 Labels.pm [dev_week], Mason James, 2007/07/10
- [Koha-cvs] koha/C4 Labels.pm [dev_week], Mason James, 2007/07/10
- [Koha-cvs] koha/C4 Labels.pm [dev_week], Mason James, 2007/07/10
- [Koha-cvs] koha/C4 Labels.pm [dev_week], Mason James, 2007/07/10
- [Koha-cvs] koha/C4 Labels.pm [dev_week], Mason James, 2007/07/10