Bugzilla – Attachment 14812 Details for
Bug 9480
Set barcode width and height configurable with system preferences in patron card creator
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9480: Set barcode width and height configurable with system preferences in patron card creator
Bug-9480-Set-barcode-width-and-height-configurable.patch (text/plain), 5.16 KB, created by
Vitor Fernandes
on 2013-01-24 10:59:11 UTC
(
hide
)
Description:
Bug 9480: Set barcode width and height configurable with system preferences in patron card creator
Filename:
MIME Type:
Creator:
Vitor Fernandes
Created:
2013-01-24 10:59:11 UTC
Size:
5.16 KB
patch
obsolete
>From a47fd8f882fbb4bee93c67dbd2faa9511d60440b Mon Sep 17 00:00:00 2001 >From: Vitor FERNANDES <vfernandes@keep.pt> >Date: Thu, 24 Jan 2013 10:56:01 +0000 >Subject: [PATCH] Bug 9480: Set barcode width and height configurable with > system preferences in patron card creator > >Problem: > >- barcode width scale is always set to 0.8 of the total width >- barcode height scale is always set to 0.01 of total height >- happens in 3.8.X, 3.10.X and master code > >Test plan: > >- Apply patch >- Check if your patron cards still prints normally >- Change the sysprefs BarcodeWidthScale and BarcodeHeightScale (double values) and see the barcode change >- Remove the sysprefs value (empty) and your patron cards should print normally (uses the default values) > >Sponsored-by: KEEP SOLUTIONS >--- > C4/Patroncards/Patroncard.pm | 6 ++++-- > installer/data/mysql/sysprefs.sql | 2 ++ > installer/data/mysql/updatedatabase.pl | 8 ++++++++ > .../en/modules/admin/preferences/creators.pref | 8 ++++++++ > 4 files changed, 22 insertions(+), 2 deletions(-) > >diff --git a/C4/Patroncards/Patroncard.pm b/C4/Patroncards/Patroncard.pm >index 339b969..87088a9 100644 >--- a/C4/Patroncards/Patroncard.pm >+++ b/C4/Patroncards/Patroncard.pm >@@ -53,8 +53,10 @@ sub new { > sub draw_barcode { > my ($self, $pdf) = @_; > #FIXME: We do some scaling foo on the barcode here which probably should be done by the one invoking draw_barcode >- my $barcode_width = 0.8 * $self->{'width'}; # this scales the barcode width to 80% of the label width >- my $barcode_y_scale_factor = 0.01 * $self->{'height'}; # this scales the barcode height to 1% of the label height >+ my $barcode_width_scale = C4::Context->preference('BarcodeWidthScale') ? C4::Context->preference('BarcodeWidthScale') : 0.8; >+ my $barcode_height_scale = C4::Context->preference('BarcodeHeightScale') ? C4::Context->preference('BarcodeHeightScale') : 0.01; >+ my $barcode_width = $barcode_width_scale * $self->{'width'}; >+ my $barcode_y_scale_factor = $barcode_height_scale * $self->{'height'}; > _draw_barcode( $self, > llx => $self->{'llx'} + $self->{'layout'}->{'barcode'}->[0]->{'llx'}, > lly => $self->{'lly'} + $self->{'layout'}->{'barcode'}->[0]->{'lly'}, >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index d5d15d7..ee57cb4 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -406,3 +406,5 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('NotesBlacklist','','List of notes fields that should not appear in the title notes/description separator of details',NULL,'free'); > INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('SCOUserCSS', '', NULL, 'Add CSS to be included in the SCO module in an embedded <style> tag.', 'free'); > INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('SCOUserJS', '', NULL, 'Define custom javascript for inclusion in the SCO module', 'free'); >+INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('BarcodeWidthScale','0.8', NULL, 'Patron cards barcode width scale', 'Double'); >+INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('BarcodeHeightScale','0.01', NULL, 'Patron cards barcode height scale', 'Double'); >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 77265f4..5f21519 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -6339,6 +6339,14 @@ if ( CheckVersion($DBversion) ) { > SetVersion ($DBversion); > } > >+$DBversion = "3.11.00.XXX"; >+if ( CheckVersion($DBversion) ) { >+ $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('BarcodeWidthScale','0.8', NULL, 'Patron cards barcode width scale', 'Double')"); >+ $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('BarcodeHeightScale','0.01', NULL, 'Patron cards barcode height scale', 'Double')"); >+ print "Upgrade to $DBversion done (Bug 9480: Set barcode width and height configurable with system preferences in patron card creator)\n"; >+ SetVersion ($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 TableExists($table) >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/creators.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/creators.pref >index bb92b8f..7df2ab3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/creators.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/creators.pref >@@ -5,3 +5,11 @@ Creators: > - pref: ImageLimit > class: Integer > - images. >+ - >+ - Use the following scale for barcode width in patron cards creator >+ - pref: BarcodeWidthScale >+ class: Double >+ - >+ - Use the following scale for barcode height in patron cards creator >+ - pref: BarcodeHeightScale >+ class: Double >-- >1.7.9.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 9480
: 14812