Repeating receipt template macros, case sensitivity in macros

Bug #758945 reported by Jason Boyer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Low
Galen Charlton

Bug Description

Evergreen Versions effected: (at least) 1.6.0.0->trunk. Patch against 2.0.4

There was discussion in bug 744492 about making receipt template macros case-insensitive. This patch does that, and also adds g to most options making it possible to use the same macro more than once in a template section. PATRON_BARCODE and patron_barcode haven't been touched because it sounds like there are other plans for them.

An example for the second: I'm trying to use the shortcode in a switch statement to determine which library-specific contact information to print on a receipt, and we also print the shortcode itself in the same section (the footer in this case). Without the g option, whichever use comes first in the section is the only substitution made, with %SHORTCODE% printing anywhere else it's used in that section.

Notes about the patch: I'm hoping that it doesn't need to be run through dos2unix; it took a convoluted road to get from where it was to where I am, but I believe it's ok.

Revision history for this message
Jason Boyer (jasonb-myjclibrary) wrote :

Any opinions on this? I'm assuming there's not a good reason to keep case sensitivity, and the g option is an oversight that has been corrected in most of the new date macros.

Revision history for this message
Thomas Berezansky (tsbere) wrote :

At a minimum, for example, the TODAY_d and TODAY_D cannot be case insensitive. They mean different things. Your patch would negate the second one in the file (TODAY_D, I believe).

I believe TODAY_m and TODAY_M are a similar issue.

In fact, the only part I think should possibly be case insensitive is the part that follows all of that, the data dynamically loaded, which you haven't touched.

Revision history for this message
Jason Boyer (jasonb-myjclibrary) wrote :

Ouch, I wasn't paying nearly enough attention to that. If some things have to be case sensitive it would only be more confusing if others weren't. So I ditched that, this patch just adds the 'g' option to the template_sub regexes, making them all consistent. (And it was given the thrice-over before I packed it up this time)

Galen Charlton (gmc)
Changed in evergreen:
assignee: nobody → Galen Charlton (gmc)
Changed in evergreen:
importance: Undecided → Wishlist
importance: Wishlist → Low
Revision history for this message
Galen Charlton (gmc) wrote :

Reviewed and pushed to master. Would be trivial to backport to rel_2_1 if folks feel that this is more of a bug than an enhancement.

Changed in evergreen:
status: New → Fix Committed
Changed in evergreen:
milestone: none → 2.2.0
Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.