https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44095
--- Comment #1 from Martin Renvoize (ashimema) <[email protected]> --- Created attachment 211737 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211737&action=edit Bug 44095: Deduplicate the 'Convert to print' handling of the notices pages The 'cud-convert_to_print' block of members/notices.pl and tools/notices.pl was the same: call $message->convert_to_print in a try/catch, and turn the exceptions (NoConversionTemplate, ConversionTemplateError, anything else) into the same 'no_template', 'template_error' or 'failed' result. members/notices.tt and tools/notices.tt then repeated the same alerts for each of those results. * Add Koha::Notice::Message->try_convert_to_print, which returns the result: 'converted', 'no_template', 'template_error' or 'failed'. The two scripts use it * Move the alerts to an include, notice-conversion-alert.inc, used by the two templates There is no change in behaviour. To test: 1. Run: prove t/db_dependent/Koha/Notice/Message.t 2. Run: yarn cypress run --spec t/cypress/integration/Tools/NoticesManagement_spec.ts 3. Set 'NoticesManagement' to 'Enable' and send a welcome notice to a patron with an email address, then run perl misc/cronjobs/process_message_queue.pl (the notice is 'failed') 4. In Notices management, and in the Notices tab of the patron, click 'Convert to print': the alert says the notice was converted to a print notice, which is waiting to be printed 5. Delete the 'CONVERTED_TO_PRINT' notice in Notices and slips (Patrons module, print), send another welcome notice, and try again: the alert says that the notice does not exist, with a link to Notices and slips 6. Create it with an error (for example '[% IF 1 %]'): the alert says that the notice has an error. Both pages give the same results Co-Authored-By: Claude Sonnet 5.5 <[email protected]> -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes. _______________________________________________ Koha-bugs mailing list -- [email protected] To unsubscribe send an email to [email protected] website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
