Bug 28169: Add quotes around value in template to render proper JS
authorAndrew Nugged <nugged@gmail.com>
Mon, 19 Apr 2021 12:02:09 +0000 (15:02 +0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 28 Apr 2021 09:16:14 +0000 (11:16 +0200)
commit631cd5d8a7de68b5c67ef5cd0d5765a0535378f9
treeb9217007f83aff611b7bf7eef273f9550409b25e
parent011ee862d375d1aceb694159cebe5b54d6e0f6b5
Bug 28169: Add quotes around value in template to render proper JS

There is code in request.tt:

    homebranch: "[% ... %]",
    holdallowed: [% ... %]

There only digits where expected earlier in holdallowed
but now it can be string value ('from_any_library' for example),
so it should be in quotes.

To reproduce the problem:
1. Add circulation rules which allow 1 hold only to the itemtype
2. Make sure AllowHoldPolicyOverride syspref enabled
3. Make 1 hold to patron for any biblio which has a few items available,
   for example on "reset_all dev db set":
   /cgi-bin/koha/reserve/request.pl?biblionumber=4&findborrower=1
   (this biblio record has 4 items)
4. Start another hold for same patron on any biblio record or the same,
   and keep browser's JS console open,
   for example on "reset_all dev db set":
   /cgi-bin/koha/reserve/request.pl?biblionumber=4&findborrower=1
5. You should see now JS error in browser console:
   Uncaught ReferenceError: from_any_library is not defined
   Uncaught ReferenceError: columns_settings_borrowers_table is not defined
6. Apply the patch
7. Repeat the steps 4-5 (reload the page) and now the JS error should be gone

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt