[Koha] Notice ACQORDERS shows aqorders.listprice with six decimal places

Michael Kuhn mik at adminkuhn.ch
Thu Sep 26 19:43:30 NZST 2024


Hi Jonathan

Many thanks for the hint! I found more about this syntax and table 
references in 
https://wiki.koha-community.org/wiki/Notices_with_Template_Toolkit

Now our ACQORDER notice lokks something like this:

[%- USE Price -%]
[% FOREACH order IN orders %]
<p><b>Author:</b> [% order.biblio.abstract %]<br>
<b>Title:</b> [% order.biblio.title %]<br>
<b>Publisher:</b> <<biblioitems.publishercode>><br>
<b>Year:</b> [% order.biblio.copyrightdate %]<br>
<b>ISBN:</b> <<biblioitems.isbn>><br>
<b>Price:</b> € [% order.listprice | $Price %] </p>
[% END %]

Best wishes: Michael
-- 
Geschäftsführer · Diplombibliothekar BBS, Informatiker eidg. Fachausweis
Admin Kuhn GmbH · Pappelstrasse 20 · 4123 Allschwil · Schweiz
T 0041 (0)61 261 55 61 · E mik at adminkuhn.ch · W www.adminkuhn.ch




Am 23.09.24 um 10:35 schrieb Jonathan Druart:
> Use the "Price" template plugin
> 
> At the top of the template, add:
> [%- USE Price -%]
> 
> Then:
> [% order.listprice | $Price %]
> 
> Le ven. 20 sept. 2024 à 11:07, Michael Kuhn <mik at adminkuhn.ch> a écrit :
>>
>> Hi
>>
>> In database field "aqorders.listprice" is given with six decimal places,
>> thus a price would look like: 40.100000
>>
>> To beautify this we have added the following in notice ACQORDERS which
>> removed the last four decimal places
>>
>>    [% "<<aqorders.listprice>>" FILTER remove('\d{4}$') %]
>>
>> so the price would look like: 40.10
>>
>> Since the update to Koha 24.05.01 this does not work anymore, instead it
>> shows again: 40.100000
>>
>> We have also tested the following regex (which should limit the decimal
>> places to two), but to no avail:
>>
>>    [% "<<aqorders.listprice>>" FILTER remove('^(\d+\.\d{2})\d+$') %]
>>
>> Is there a way to get rid of the unwanted decimal places in the notices
>> of Koha 24.05?
>>
>> Best wishes: Michael
>> --
>> Geschäftsführer · Diplombibliothekar BBS, Informatiker eidg. Fachausweis
>> Admin Kuhn GmbH · Pappelstrasse 20 · 4123 Allschwil · Schweiz
>> T 0041 (0)61 261 55 61 · E mik at adminkuhn.ch · W www.adminkuhn.ch
>> _______________________________________________
>>
>> Koha mailing list  http://koha-community.org
>> Koha at lists.katipo.co.nz
>> Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha




More information about the Koha mailing list