[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: |
Sun, 08 Jul 2007 17:54:34 +0000 |
CVSROOT: /sources/koha
Module name: koha
Branch: dev_week
Changes by: Mason James <sushi> 07/07/08 17:54:34
Modified files:
C4 : Labels.pm
Log message:
bit more work
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Labels.pm?cvsroot=koha&only_with_tag=dev_week&r1=1.3.4.15&r2=1.3.4.16
Patches:
Index: Labels.pm
===================================================================
RCS file: /sources/koha/koha/C4/Labels.pm,v
retrieving revision 1.3.4.15
retrieving revision 1.3.4.16
diff -u -b -r1.3.4.15 -r1.3.4.16
--- Labels.pm 6 Jul 2007 14:16:36 -0000 1.3.4.15
+++ Labels.pm 8 Jul 2007 17:54:34 -0000 1.3.4.16
@@ -51,11 +51,15 @@
&CreateTemplate &SetActiveTemplate
&SaveConf &DrawSpineText &GetTextWrapCols
&GetUnitsValue &DrawBarcode
-
- &get_layouts &get_barcode_types
+ &get_printingtypes
+ &get_layouts
+&get_barcode_types
&get_batches &delete_batch
&add_batch &SetFontSize &printText
&GetItemFields
+&get_text_fields
+&get_layout
+&set_active_layout
);
@@ -79,7 +83,46 @@
return $conf_data;
}
+
+
+
sub get_layouts {
+
+## FIXME: this if/else could be compacted...
+ my $dbh = C4::Context->dbh;
+ my @data;
+ my $query = " Select * from labels_conf";
+ my $sth = $dbh->prepare($query);
+ $sth->execute();
+ my @resultsloop;
+ while ( my $data = $sth->fetchrow_hashref ) {
+ $data->{'fieldlist'} = "BAR, ITYPE, MOO";
+ push( @resultsloop, $data );
+ }
+ $sth->finish;
+ return @resultsloop;
+}
+
+sub get_layout {
+
+## FIXME: this if/else could be compacted...
+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);
+ $sth->execute($layout_id);
+ my $data = $sth->fetchrow_hashref;
+ $data->{'fieldlist'} = "BAR, ITYPE, MOO";
+ $sth->finish;
+ return $data;
+}
+
+
+
+
+
+sub get_printingtypes {
my ( $a, $b, $c, $d, $e );
$a = { code => 'BAR', desc => "barcode" };
@@ -88,19 +131,51 @@
$d = { code => 'BIBBAR', desc => "biblio / barcode" };
$e = { code => 'ALT', desc => "alternating labels" };
- my @layouts = ( $a, $b, $c, $d, $e );
+ my @printingtypes = ( $a, $b, $c, $d, $e );
my $conf= get_label_options();
- my $active_layout = $conf->{'printingtype'};
+ my $active_printingtype = $conf->{'printingtype'};
# lop thru layout, insert selected to hash
- foreach my $layout(@layouts) {
- if ($layout->{'code'} eq $active_layout) {
- $layout->{'active'} = 'MOO';
+ foreach my $printingtype(@printingtypes) {
+ if ($printingtype->{'code'} eq $active_printingtype) {
+ $printingtype->{'active'} = 'MOO';
}
}
- return @layouts;
+ return @printingtypes;
+}
+
+
+
+sub get_text_fields {
+ my ($layout_id) = @_;
+ my ( $a, $b, $c, $d, $e, $f, $g, $h, $i );
+
+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'} };
+ $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 => '2' };
+
+ my @text_fields = ( $a, $b, $c, $d, $e, $f, $g, $h, $i );
+
+### fields need to be sorted here.....
+#y @textfields = sort { my $ii->order cmp my $jj->order } @text_fields ;
+### @text_fields;
+ return @text_fields;
+
}
+
+
+
+
sub add_batch {
my $new_batch;
my $dbh = C4::Context->dbh;
@@ -120,6 +195,29 @@
return $new_batch;
}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
sub get_batches {
my $dbh = C4::Context->dbh;
my $q = "select distinct batch_id from labels";
@@ -222,6 +320,27 @@
$sth->finish;
}
+
+sub set_active_layout {
+
+ my ($layout_id) = @_;
+ my $dbh = C4::Context->dbh;
+ my $query = " UPDATE labels_conf SET active = NULL";
+ my $sth = $dbh->prepare($query);
+ $sth->execute();
+
+ my $query = "UPDATE labels_conf SET active = 1 WHERE id = ?";
+ my $sth = $dbh->prepare($query);
+ $sth->execute($layout_id);
+ $sth->finish;
+}
+
+
+
+
+
+
+
sub DeleteTemplate {
my ($tmpl_code) = @_;
my $dbh = C4::Context->dbh;
@@ -331,7 +450,7 @@
$barcodetype, $title, $isbn,
$issn, $itemtype, $bcn, $dcn,
$classif, $subclass, $itemcallnumber, $author,
- $tmpl_id, $printingtype, $guidebox, $startlabel
+ $tmpl_id, $printingtype, $guidebox, $startlabel, $layoutname
) = @_;
my $dbh = C4::Context->dbh;
@@ -341,14 +460,14 @@
my $query2 = "INSERT INTO labels_conf
( barcodetype, title, isbn,issn, itemtype, barcode,
dewey, class, subclass, itemcallnumber, author, printingtype,
- guidebox, startlabel, active )
- values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?, 1 )";
+ guidebox, startlabel, layoutname, active )
+ values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?, 1 )";
my $sth2 = $dbh->prepare($query2);
$sth2->execute(
$barcodetype, $title, $isbn, $issn,
$itemtype, $bcn, $dcn, $classif,
$subclass, $itemcallnumber, $author, $printingtype,
- $guidebox, $startlabel
+ $guidebox, $startlabel, $layoutname
);
$sth2->finish;
- [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 <=
- [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/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/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