[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, 27 Aug 2007 05:53:58 +0000 |
CVSROOT: /sources/koha
Module name: koha
Branch: dev_week
Changes by: Mason James <sushi> 07/08/27 05:53:58
Modified files:
C4 : Labels.pm
Log message:
tty sane
:
VS:
s.pm
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Labels.pm?cvsroot=koha&only_with_tag=dev_week&r1=1.3.4.41&r2=1.3.4.42
Patches:
Index: Labels.pm
===================================================================
RCS file: /sources/koha/koha/C4/Labels.pm,v
retrieving revision 1.3.4.41
retrieving revision 1.3.4.42
diff -u -b -r1.3.4.41 -r1.3.4.42
--- Labels.pm 6 Aug 2007 01:24:08 -0000 1.3.4.41
+++ Labels.pm 27 Aug 2007 05:53:58 -0000 1.3.4.42
@@ -26,7 +26,7 @@
use Text::Wrap;
use Algorithm::CheckDigits;
# use Data::Dumper;
-# use Smart::Comments;
+ use Smart::Comments '####';
$VERSION = 0.01;
@@ -45,10 +45,17 @@
&get_label_options &get_label_items
&build_circ_barcode &draw_boundaries
&drawbox &GetActiveLabelTemplate
+
+ &get_multi_label_templates
+ &get_multi_label_layouts
+
&GetAllLabelTemplates &DeleteTemplate
&GetSingleLabelTemplate &SaveTemplate
&CreateTemplate &SetActiveTemplate
- &SaveConf &DrawSpineText &GetTextWrapCols
+ &SaveConf &DrawSpineText
+ &DrawSpineTextManual draw_text_block_manual
+
+&GetTextWrapCols
&GetUnitsValue &DrawBarcode
&get_printingtypes
&get_layouts
@@ -64,6 +71,7 @@
&build_text_dropbox
&delete_layout &get_active_layout
&get_highest_batch
+
);
=item get_label_options;
@@ -193,7 +201,7 @@
my ($layout_id, $sorttype) = @_;
#FIXME: use pushes, this is lame :)
- my ( $a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k );
+ my ( $a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l );
my $sortorder = get_layout($layout_id);
@@ -236,9 +244,10 @@
$j = { code => 'itemcallnumber', desc => "Item-Callnumber", order =>
$sortorder->{'itemcallnumber'} };
$k = { code => 'subtitle', desc => "Subtitle", order =>
$sortorder->{'subtitle'} };
+ $l = { code => 'ccode', desc => "Collection Code", order =>
$sortorder->{'ccode'} };
- my @text_fields = ( $a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k );
+ my @text_fields = ( $a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k ,$l);
my @new_fields;
foreach my $field (@text_fields) {
@@ -388,6 +397,38 @@
return $active_tmpl;
}
+
+sub get_multi_label_templates {
+ my $dbh = C4::Context->dbh;
+ my $query = " SELECT * FROM labels_templates where tmpl_code like
'multi%'";
+ my $sth = $dbh->prepare($query);
+ $sth->execute();
+ my @resultsloop;
+ while ( my $data = $sth->fetchrow_hashref ) {
+ push( @resultsloop, $data );
+ }
+ $sth->finish;
+ return @resultsloop;
+}
+
+
+sub get_multi_label_layouts {
+ my $dbh = C4::Context->dbh;
+ my $query = " SELECT * FROM labels_conf where laypoutname like 'multi%'";
+ my $sth = $dbh->prepare($query);
+ $sth->execute();
+ my @resultsloop;
+ while ( my $data = $sth->fetchrow_hashref ) {
+ push( @resultsloop, $data );
+ }
+ $sth->finish;
+ return @resultsloop;
+}
+
+
+
+
+
sub GetSingleLabelTemplate {
my ($tmpl_id) = @_;
my $dbh = C4::Context->dbh;
@@ -548,7 +589,7 @@
my (
$barcodetype, $title, $subtitle , $isbn, $issn,
$itemtype, $bcn, $dcn, $classif,
- $subclass, $itemcallnumber, $author, $tmpl_id,
+ $subclass, $itemcallnumber, $author, $ccode, $tmpl_id,
$printingtype, $guidebox, $startlabel, $layoutname,
$layout_id
) = @_;
@@ -561,13 +602,13 @@
my $query2 = "update labels_conf set
barcodetype=?, title=?, subtitle=?, isbn=?,issn=?,
itemtype=?, barcode=?, dewey=?, class=?,
- subclass=?, itemcallnumber=?, author=?, printingtype=?,
+ subclass=?, itemcallnumber=?, author=?, ccode=?, printingtype=?,
guidebox=?, startlabel=?, layoutname=? where id = ?";
my $sth2 = $dbh->prepare($query2);
$sth2->execute(
$barcodetype, $title, $subtitle , $isbn, $issn,
$itemtype, $bcn, $dcn, $classif,
- $subclass, $itemcallnumber, $author, $printingtype,
+ $subclass, $itemcallnumber, $author, $ccode, $printingtype,
$guidebox, $startlabel, $layoutname, $layout_id
);
$sth2->finish;
@@ -648,9 +689,90 @@
return @fields;
}
+
+
+
+sub draw_text_block_manual{
+
+ my ( $y_pos, $label_height, $fontsize, $x_pos, $gutter,
+ $text_wrap_cols, @fields )
+ = @_;
+
+# hack to fix column name mismatch betwen labels_conf.class,
+# and bibitems.classification
+
+ $Text::Wrap::columns = $text_wrap_cols;
+ $Text::Wrap::separator = "\n";
+
+ my $str;
+# $item
+
+ my $top_text_margin = ( $fontsize + $gutter );
+ my $line_spacer = ($fontsize); # number of pixels between text rows.
+
+ # add your printable fields manually in here
+
+#### @fields
+
+ my $vPos = ( $y_pos + ( $label_height - $top_text_margin ) );
+ my $hPos = ( $x_pos + $gutter );
+
+ # warn Dumper $conf_data;
+ #warn Dumper $item;
+
+ foreach my $field (@fields) {
+
+ # if the display option for this field is selected in the DB,
+ # and the item record has some values for this field, display it.
+
+ warn "CONF_TYPE = $field";
+
+ # get the string
+ $str = $field;
+#### $str
+
+ # strip out naughty existing nl/cr's
+ $str =~ s/\n//g;
+ $str =~ s/\r//g;
+
+ # chop the string up into _upto_ 12 chunks
+ # and seperate the chunks with newlines
+
+ $str = wrap( "", "", "$str" );
+ $str = wrap( "", "", "$str" );
+
+ # split the chunks between newline's, into an array
+ my @strings = split /\n/, $str;
+
+ # then loop for each string line
+ foreach my $str (@strings) {
+
+ #warn "HPOS , VPOS $hPos, $vPos ";
+ # set the font size A
+
+ # prText( $hPos, $vPos, $str );
+ PrintText( $hPos, $vPos, $fontsize, $str );
+ $vPos = $vPos - $line_spacer;
+ }
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
sub DrawSpineText {
- my ( $y_pos, $label_height, $fontsize, $x_pos, $left_text_margin,
+ my ( $x_pos, $y_pos, $label_height, $fontsize,$x_pos, $left_text_margin,
$text_wrap_cols, $item, $conf_data )
= @_;
@@ -1216,7 +1338,7 @@
sub drawbox {
my ( $llx, $lly, $urx, $ury ) = @_;
- # warn "llx,y= $llx,$lly , urx,y=$urx,$ury \n";
+warn "llx,y= $llx,$lly , urx,y=$urx,$ury\n";
my $str = "q\n"; # save the graphic state
$str .= "0.5 w\n"; # border color red