[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: |
Thu, 05 Jul 2007 16:43:40 +0000 |
CVSROOT: /sources/koha
Module name: koha
Branch: dev_week
Changes by: Mason James <sushi> 07/07/05 16:43:40
Modified files:
C4 : Labels.pm
Log message:
barcode horz split, saveing issn, new printtext() with fontsize too
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Labels.pm?cvsroot=koha&only_with_tag=dev_week&r1=1.3.4.9&r2=1.3.4.10
Patches:
Index: Labels.pm
===================================================================
RCS file: /sources/koha/koha/C4/Labels.pm,v
retrieving revision 1.3.4.9
retrieving revision 1.3.4.10
diff -u -b -r1.3.4.9 -r1.3.4.10
--- Labels.pm 3 Jul 2007 23:14:17 -0000 1.3.4.9
+++ Labels.pm 5 Jul 2007 16:43:40 -0000 1.3.4.10
@@ -27,6 +27,7 @@
use Text::Wrap;
use Algorithm::CheckDigits;
use Data::Dumper;
+use Smart::Comments;
$VERSION = 0.01;
@@ -51,7 +52,8 @@
&SaveConf &DrawSpineText &GetTextWrapCols
&GetUnitsValue &DrawBarcode
&get_layouts &get_barcode_types
- &get_batches
+ &get_batches &delete_batch
+ &add_batch &SetFontSize &printText
);
@@ -88,6 +90,21 @@
return @layouts;
}
+sub add_batch {
+ my $dbh = C4::Context->dbh;
+ my $q =
+ "select distinct batch_id from labels order by batch_id asc limit 1";
+ my $sth = $dbh->prepare($q);
+ $sth->execute();
+ my $data = $sth->fetchrow_hashref;
+ $sth->finish;
+ my $new_batch = ++$data->{'batch_id'};
+### $new_batch;
+ warn "hhhh";
+ warn Dumper $data;
+ return $data;
+}
+
sub get_batches {
my $dbh = C4::Context->dbh;
my $q = "select distinct batch_id from labels";
@@ -98,11 +115,16 @@
push( @resultsloop, $data );
}
$sth->finish;
-
- warn Dumper @resultsloop;
-
return @resultsloop;
+}
+sub delete_batch {
+ my ($batch_id) = @_;
+ my $dbh = C4::Context->dbh;
+ my $q = "DELETE FROM labels where batch_id = ?";
+ my $sth = $dbh->prepare($q);
+ $sth->execute($batch_id);
+ $sth->finish;
}
sub get_barcode_types {
@@ -123,7 +145,6 @@
$unitvalue = '2.83464567' if ( $units eq 'MM' );
$unitvalue = '28.3464567' if ( $units eq 'CM' );
$unitvalue = 72 if ( $units eq 'INCH' );
- warn $units, $unitvalue;
return $unitvalue;
}
@@ -287,10 +308,10 @@
sub SaveConf {
my (
- $barcodetype, $title, $isbn, $itemtype,
- $bcn, $dcn, $classif, $subclass,
- $itemcallnumber, $author, $tmpl_id, $printingtype,
- $guidebox, $startlabel
+ $barcodetype, $title, $isbn,,
+ $issn, $itemtype, $bcn, $dcn,
+ $classif, $subclass, $itemcallnumber, $author,
+ $tmpl_id, $printingtype, $guidebox, $startlabel
) = @_;
my $dbh = C4::Context->dbh;
@@ -298,16 +319,16 @@
my $sth2 = $dbh->prepare($query2);
$sth2->execute();
my $query2 = "INSERT INTO labels_conf
- ( barcodetype, title, isbn, itemtype, barcode,
+ ( barcodetype, title, isbn,issn, itemtype, barcode,
dewey, class, subclass, itemcallnumber, author, printingtype,
guidebox, startlabel )
- values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )";
+ values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,? )";
my $sth2 = $dbh->prepare($query2);
$sth2->execute(
- $barcodetype, $title, $isbn, $itemtype,
- $bcn, $dcn, $classif, $subclass,
- $itemcallnumber, $author, $printingtype, $guidebox,
- $startlabel
+ $barcodetype, $title, $isbn, $issn,
+ $itemtype, $bcn, $dcn, $classif,
+ $subclass, $itemcallnumber, $author, $printingtype,
+ $guidebox, $startlabel
);
$sth2->finish;
@@ -326,28 +347,46 @@
#'
sub get_label_items {
+ my ($batch_id) = @_;
my $dbh = C4::Context->dbh;
- # get the actual items to be printed.
+ my @resultsloop = ();
+ my $count;
my @data;
- my $query3 = " Select * from labels ";
- my $sth = $dbh->prepare($query3);
+ my $sth;
+
+ if ($batch_id) {
+ my $query3 = "Select * from labels where batch_id = ? ";
+ $sth = $dbh->prepare($query3);
+ $sth->execute($batch_id);
+
+ }
+ else {
+
+ my $query3 = "Select * from labels";
+ $sth = $dbh->prepare($query3);
$sth->execute();
- my @resultsloop;
+ }
my $cnt = $sth->rows;
my $i1 = 1;
while ( my $data = $sth->fetchrow_hashref ) {
# lets get some summary info from each item
- my $query1 =
- " select * from biblio, biblioitems, items where itemnumber = ? and
+ my $query1 = "
+ select * from biblio,biblioitems,items where itemnumber=? and
items.biblioitemnumber=biblioitems.biblioitemnumber and
biblioitems.biblionumber=biblio.biblionumber";
my $sth1 = $dbh->prepare($query1);
$sth1->execute( $data->{'itemnumber'} );
+
my $data1 = $sth1->fetchrow_hashref();
+ $data1->{'labelno'} = $i1;
+ $data1->{'batch_id'} = $batch_id;
+ $data1->{'summary'} =
+ "$data1->{'barcode'}, $data1->{'title'}, $data1->{'isbn'}";
+
push( @resultsloop, $data1 );
$sth1->finish;
@@ -355,6 +394,7 @@
}
$sth->finish;
return @resultsloop;
+
}
sub DrawSpineText {
@@ -408,16 +448,36 @@
foreach my $str (@strings) {
#warn "HPOS , VPOS $hPos, $vPos ";
- prText( $hPos, $vPos, $str );
+ # set the font size A
+
+ # prText( $hPos, $vPos, $str );
+ PrintText( $hPos, $vPos, $fontsize, $str );
$vPos = $vPos - $line_spacer;
}
- } # if field is valid
- } #foreach feild
+ } # if field is } #foreach feild
+ }
+}
+
+sub PrintText {
+ my ( $hPos, $vPos, $fontsize, $text ) = @_;
+ my $str = "BT /Ft1 $fontsize Tf $hPos $vPos Td ($text) Tj ET";
+ prAdd($str);
+}
+
+sub SetFontSize {
+
+ my ($fontsize) = @_;
+### fontsize
+ my $str = "BT/F13 30 Tf288 720 Td( AAAAAAAAAA ) TjET";
+ prAdd($str);
}
sub DrawBarcode {
+ # x and y are from the top-left :)
my ( $x_pos, $y_pos, $height, $width, $barcode, $barcodetype ) = @_;
+### --------------------------
+ warn " $x_pos, $y_pos, $height, $width, $barcode, $barcodetype ";
my $num_of_bars = length($barcode);
my $bar_width = $width * .8; # %80 of length of label width
my $tot_bar_length;
@@ -425,6 +485,7 @@
my $guard_length = 10;
my $xsize_ratio;
+### $height
if ( $barcodetype eq 'Code39' ) {
$bar_length = '17.5';
$tot_bar_length =
- [Koha-cvs] koha/C4 Labels.pm [dev_week], Mason James, 2007/07/03
- [Koha-cvs] koha/C4 Labels.pm [dev_week],
Mason James <=
- [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, 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