Description
Jonathan Druart
2017-01-23 13:12:27 UTC
Created attachment 59439 [details] [review] Bug 17965: TT syntax for notices - Prove that DUEDGST is compatible This notice template have the particular feature of using <<count>>. This value is substitued during the process of the notice template. For the TT syntax, all what we need is to send the values to substitute to the template. Note that items.content can also be used in these template, you can have a look at bug 17967 to see a better alternative to this marker. Test plan: Generate DUEDGST and DUE notice messages. You should be able to generate the same messages with the TT syntax. I forgot an important thing here: the items.fine value which was available in the historical syntax is no longer supported. It's of course a bug we will need to address. (In reply to Jonathan Druart from comment #2) > I forgot an important thing here: the items.fine value which was available > in the historical syntax is no longer supported. > It's of course a bug we will need to address. This is not for DUEDGST but ODUE, forget it :) I tested this patch on top of 17979, 17963 and 17964 ( https://bugs.koha-community.org/bugzilla3/showdependencygraph.cgi?id=17965 ) DUEDGST notice is defined as: You have <<count>> items due, with TT syntax: [% count %] The message created (for a patron with 2 items due) is: You have 2 items due, with TT syntax: [% count %] Expected: You have 2 items due, with TT syntax: 2 Did I forget a dependency or is something wrong with the definition? (In reply to Marc Véron from comment #4) > I tested this patch on top of 17979, 17963 and 17964 ( > https://bugs.koha-community.org/bugzilla3/showdependencygraph.cgi?id=17965 ) It works for me, could you confirm you apply 17970 and not 17979? You should use `yes|git bz apply 17965` to apply the correct dependencies (with the patched git-bz to apply dependencies) Re-tested. Applied 17970, 17963, 17964, 17965. Changed DUEDGST to You have <<count>> items due, with TT syntax: [% count %] items due Run: koha-foreach --enabled --email /home/marc/koha/misc/cronjobs/advance_notices.pl -c Verify message(including time created...) in a patron's "Sent notices" Get: You have 2 items due, with TT syntax: [% count %] items due Running TemplateToolkit.t fails the very first time, if I run it again it passes OK. ...and that are the two outputs of TemplateToolkit.t: --First run --------------------------- marc@debian8vm:~/koha$ prove t/db_dependent/Letters/TemplateToolkit.t t/db_dependent/Letters/TemplateToolkit.t .. 1/16 DBD::mysql::st execute failed: Duplicate entry '37' for key 'PRIMARY' [for Statement "INSERT INTO old_issues SELECT * FROM issues WHERE borrowernumber = ? AND itemnumber = ?" with ParamValues: 0='654336', 1='25'] at /home/marc/koha/C4/Circulation.pm line 2172. DBD::mysql::st execute failed: Duplicate entry '37' for key 'PRIMARY' [for Statement "INSERT INTO old_issues SELECT * FROM issues WHERE borrowernumber = ? AND itemnumber = ?" with ParamValues: 0='654336', 1='25'] at /home/marc/koha/C4/Circulation.pm line 2172. at t/db_dependent/Letters/TemplateToolkit.t line 463. # Failed test at t/db_dependent/Letters/TemplateToolkit.t line 470. # got: ' # The following items have been checked out: # Test Biblio 1 # Test Biblio 2 # Thank you for visiting YCIAZz. # ' # expected: ' # The following items have been checkin out: # Test Biblio 1 was due on 01.03.2017 # Thank you for visiting YCIAZz. # ' # Failed test at t/db_dependent/Letters/TemplateToolkit.t line 471. # got: ' # The following items have been checkin out: # Test Biblio 2 was due on 01.03.2017 # Thank you for visiting YCIAZz. # ' # expected: ' # The following items have been checkin out: # Test Biblio 1 was due on 01.03.2017 # Test Biblio 2 was due on 01.03.2017 # Thank you for visiting YCIAZz. # ' # Looks like you failed 2 tests of 4. # Failed test 'CHECKOUT+CHECKIN' # at t/db_dependent/Letters/TemplateToolkit.t line 473. # Looks like you failed 1 test of 4. t/db_dependent/Letters/TemplateToolkit.t .. 16/16 # Failed test 'regression tests' # at t/db_dependent/Letters/TemplateToolkit.t line 503. # Looks like you failed 1 test of 16. t/db_dependent/Letters/TemplateToolkit.t .. Dubious, test returned 1 (wstat 256, 0x100) Failed 1/16 subtests Test Summary Report ------------------- t/db_dependent/Letters/TemplateToolkit.t (Wstat: 256 Tests: 16 Failed: 1) Failed test: 16 Non-zero exit status: 1 Files=1, Tests=16, 3 wallclock secs ( 0.02 usr 0.02 sys + 2.28 cusr 0.36 csys = 2.68 CPU) Result: FAIL -Second run, immediately after first run----------------- marc@debian8vm:~/koha$ prove t/db_dependent/Letters/TemplateToolkit.t t/db_dependent/Letters/TemplateToolkit.t .. ok All tests successful. Files=1, Tests=16, 2 wallclock secs ( 0.03 usr 0.00 sys + 1.63 cusr 0.87 csys = 2.53 CPU) Result: PASS (In reply to Marc Véron from comment #6) > koha-foreach --enabled --email > /home/marc/koha/misc/cronjobs/advance_notices.pl -c Prefer koha-shell then execute the advance_notices.pl script. To make sure it will use the correct modules. (In reply to Marc Véron from comment #7) > ...and that are the two outputs of TemplateToolkit.t: > > --First run --------------------------- > > marc@debian8vm:~/koha$ prove t/db_dependent/Letters/TemplateToolkit.t > t/db_dependent/Letters/TemplateToolkit.t .. 1/16 DBD::mysql::st execute > failed: Duplicate entry '37' for key 'PRIMARY' [for Statement "INSERT INTO > old_issues SELECT * FROM issues This happens if AI of old_issues is >= AI of issues, it does not come from this patch set. (In reply to Jonathan Druart from comment #8) > (In reply to Marc Véron from comment #6) > > koha-foreach --enabled --email > > /home/marc/koha/misc/cronjobs/advance_notices.pl -c > > Prefer koha-shell then execute the advance_notices.pl script. > To make sure it will use the correct modules. > (...) Thanks for the hint regarding koha-shell. The problem was related to PERL5LIB pointing to a wrong directory. Created attachment 60625 [details] [review] Bug 17965: TT syntax for notices - Prove that DUEDGST is compatible This notice template have the particular feature of using <<count>>. This value is substitued during the process of the notice template. For the TT syntax, all what we need is to send the values to substitute to the template. Note that items.content can also be used in these template, you can have a look at bug 17967 to see a better alternative to this marker. Test plan: Generate DUEDGST and DUE notice messages. You should be able to generate the same messages with the TT syntax. Signed-off-by: Marc Véron <veron@veron.ch> (In reply to Marc Véron from comment #9) > (In reply to Jonathan Druart from comment #8) > > (In reply to Marc Véron from comment #6) > > > koha-foreach --enabled --email > > > /home/marc/koha/misc/cronjobs/advance_notices.pl -c > > > > Prefer koha-shell then execute the advance_notices.pl script. > > To make sure it will use the correct modules. > > (...) > > Thanks for the hint regarding koha-shell. The problem was related to > PERL5LIB pointing to a wrong directory. FYI this is fixed in master, you should copy the debian files from the git repo to the one used by the system. Forgot to switch status (see comment #10) Created attachment 63967 [details] [review] Bug 17965: TT syntax for notices - Prove that DUEDGST is compatible This notice template have the particular feature of using <<count>>. This value is substitued during the process of the notice template. For the TT syntax, all what we need is to send the values to substitute to the template. Note that items.content can also be used in these template, you can have a look at bug 17967 to see a better alternative to this marker. Test plan: Generate DUEDGST and DUE notice messages. You should be able to generate the same messages with the TT syntax. Signed-off-by: Marc Véron <veron@veron.ch> Created attachment 63971 [details] [review] Bug 17965: TT syntax for notices - Prove that DUEDGST is compatible This notice template have the particular feature of using <<count>>. This value is substitued during the process of the notice template. For the TT syntax, all what we need is to send the values to substitute to the template. Note that items.content can also be used in these template, you can have a look at bug 17967 to see a better alternative to this marker. Test plan: Generate DUEDGST and DUE notice messages. You should be able to generate the same messages with the TT syntax. Signed-off-by: Marc Véron <veron@veron.ch> Patch rebased! Created attachment 63972 [details] [review] Bug 17965: TT syntax for notices - Prove that DUEDGST is compatible This notice template have the particular feature of using <<count>>. This value is substitued during the process of the notice template. For the TT syntax, all what we need is to send the values to substitute to the template. Note that items.content can also be used in these template, you can have a look at bug 17967 to see a better alternative to this marker. Test plan: Generate DUEDGST and DUE notice messages. You should be able to generate the same messages with the TT syntax. Signed-off-by: Marc Véron <veron@veron.ch> Created attachment 64333 [details] [review] Bug 17965: TT syntax for notices - Prove that DUEDGST is compatible This notice template have the particular feature of using <<count>>. This value is substitued during the process of the notice template. For the TT syntax, all what we need is to send the values to substitute to the template. Note that items.content can also be used in these template, you can have a look at bug 17967 to see a better alternative to this marker. Test plan: Generate DUEDGST and DUE notice messages. You should be able to generate the same messages with the TT syntax. Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Pushed to master for 17.11, thanks to everybody involved! Enhancement not pushed to 17.05.x |