Bug 38621 - [% today %] variable unavailable in report templates
Summary: [% today %] variable unavailable in report templates
Status: CONFIRMED
Alias: None
Product: Koha
Classification: Unclassified
Component: Notices (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on: 34136
Blocks:
  Show dependency treegraph
 
Reported: 2024-12-04 14:49 UTC by Caroline Cyr La Rose
Modified: 2024-12-12 05:36 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Caroline Cyr La Rose 2024-12-04 14:49:50 UTC
I tried adding a date to a report template, but it doesn't seem to work. I was told on MM that this is a bug.

To recreate:
1. Create a report notice template with [% today %]
   1.1. Go to Tools > Notices and slips
   1.2. Click New notice > Reports
   1.3. Enter a code and a name
   1.4. Click Email
   1.5. Enter a subject
   1.6. In the message body, add some info with [% today %], here is what I used

[% USE KohaDates %]
[% today | $KohaDates %]
[% FOREACH d IN data %]
[% d.title %]
[% END %]

   1.7. Click Save

2. Create a report that works with this template
   2.1. Go to Reports > Create from SQL
   2.2. Enter a report name
   2.3. In the SQL field, enter a report that would work with the template, this is what I used

SELECT * from biblio limit 1

   2.4. Click Save report

3. Click Run with template > Template name

--> The date doesn't appear

I also tried with a the simple [% today %] without the USE and without the KohaDates filter, but it doesn't show the date either. If I don't put the USE but use the filter, the template simply doesn't work (when you click Run with template > Template name, the report is displayed as normal in table form).
Comment 1 Jonathan Druart 2024-12-04 15:03:25 UTC
I know it can be confusing, but a workaround is to use:
  [% KohaDates.datetime_from_string | $KohaDates %]