Bug 14366 - Units doesn't get saved usefully for patroncards
Summary: Units doesn't get saved usefully for patroncards
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Label/patron card printing (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor (vote)
Assignee: Chris Nighswonger
QA Contact: Testopia
URL:
Keywords:
: 8602 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-06-09 04:23 UTC by David Cook
Modified: 2017-03-11 19:02 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 14366 - Units doesn't get saved usefully for patroncards (2.02 KB, patch)
2015-06-09 04:27 UTC, David Cook
Details | Diff | Splinter Review
[SIGNED OFF] Bug 14366 - Units doesn't get saved usefully for patroncards (2.09 KB, patch)
2015-06-10 21:42 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 14366 - Units doesn't get saved usefully for patroncards (2.14 KB, patch)
2015-06-16 09:22 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description David Cook 2015-06-09 04:23:44 UTC
"Units" gets saved into "layout_xml" for patroncards, but not into "units" in the `creator_layouts` table, so when you edit a layout for the patroncards, it'll always say "PostScript Points".

It looks like the code could use a good clean-up... but I have a small fix which sets it right so not going to refactor unnecessarily...
Comment 1 David Cook 2015-06-09 04:27:52 UTC Comment hidden (obsolete)
Comment 2 David Cook 2015-06-09 04:52:50 UTC
Of course... I'm not sure that the actual label creator is using the different units... that's fun...
Comment 3 Chris Nighswonger 2015-06-09 10:13:50 UTC
(In reply to David Cook from comment #2)
> Of course... I'm not sure that the actual label creator is using the
> different units... that's fun...

User selected units are converted to postscript points before rendering. Postscript points are the common denominator.
Comment 4 Katrin Fischer 2015-06-09 12:58:47 UTC
*** Bug 8602 has been marked as a duplicate of this bug. ***
Comment 5 Nick Clemens 2015-06-10 21:42:08 UTC Comment hidden (obsolete)
Comment 6 David Cook 2015-06-15 05:40:34 UTC
(In reply to Chris Nighswonger from comment #3)
> (In reply to David Cook from comment #2)
> > Of course... I'm not sure that the actual label creator is using the
> > different units... that's fun...
> 
> User selected units are converted to postscript points before rendering.
> Postscript points are the common denominator.

Are you certain? I tried changing a label by 1cm but it looks like it only changed by 1pt.

I haven't had time to look into this yet, unfortunately :/.
Comment 7 Chris Nighswonger 2015-06-15 12:58:18 UTC
(In reply to David Cook from comment #6)
> (In reply to Chris Nighswonger from comment #3)
> > (In reply to David Cook from comment #2)
> > > Of course... I'm not sure that the actual label creator is using the
> > > different units... that's fun...
> > 
> > User selected units are converted to postscript points before rendering.
> > Postscript points are the common denominator.
> 
> Are you certain? I tried changing a label by 1cm but it looks like it only
> changed by 1pt.
> 
> I haven't had time to look into this yet, unfortunately :/.

Point conversions are done here:

http://tinyurl.com/o99ve52

This bug is addressing the fact that labels do not save the user's preferred UOM, which explains the phenomena you are describing.

The real fix is for the labels code to be refactored to save templates as xml as patroncard code does. That was my long-term intention when I wrote the patroncard feature. Of course, even the best of intentions never materialize at times. :-P
Comment 8 Jonathan Druart 2015-06-16 09:22:37 UTC
Created attachment 40168 [details] [review]
Bug 14366 - Units doesn't get saved usefully for patroncards

This patch causes the "Units" to be saved and displayed correctly
for the "Edit layout" screen in Patroncards.

_TEST PLAN_

Before applying:
0) Create a new layout
1) Edit the layout, change the units, and click Save
2) Edit the layout again, and notice the units are still "PostScript Points"

Apply the patch:
3) Edit the layout again, change the units, and click Save
4) Edit the layout again, note that the units have changed to your
selection

5) Rejoice

Signed-off-by: Nick Clemens <nick@quecheelibrary.org>

Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
Comment 9 Tomás Cohen Arazi 2015-07-08 18:19:44 UTC
Patch pushed to master.

Thanks David!
Comment 10 Chris Cormack 2015-07-14 20:32:57 UTC
Pushed to 3.20.x will be in 3.20.2
Comment 11 Mason James 2015-07-25 13:11:22 UTC
Pushed to 3.16.x, will be in 3.16.13