[Bug 44095] New: Deduplicate 'Convert to print' handling in members/notices.pl and tools/notices.pl
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44095 Bug ID: 44095 Summary: Deduplicate 'Convert to print' handling in members/notices.pl and tools/notices.pl Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: minor Priority: P5 - low Component: Notices Assignee: koha-bugs@lists.koha-community.org Reporter: martin.renvoize@openfifth.co.uk QA Contact: testopia@bugs.koha-community.org CC: martin.renvoize@openfifth.co.uk Depends on: 33260 Target Milestone: --- Follow-up to bug 33260, reported by Pedro Amorim. The 'Convert to print' handling is duplicated. members/notices.pl and tools/notices.pl both have the same 'cud-convert_to_print' block: it calls $message->convert_to_print in a try/catch and turns the exceptions (Koha::Exceptions::Notice::NoConversionTemplate, Koha::Exceptions::Notice::ConversionTemplateError, anything else) into the same 'no_template' / 'template_error' / 'failed' result. members/notices.tt and tools/notices.tt then repeat the same alerts for each of those results. This should be refactored into a single shared implementation (and a shared template include for the alerts). No behaviour change is expected. Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33260 [Bug 33260] Show message queue on staff interface and make notices printable -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44095 --- Comment #1 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- 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 <noreply@anthropic.com> -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44095 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Depends on| |44089 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44089 [Bug 44089] Notices management: conversion link in delivery note is lost -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44095 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on|33260 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33260 [Bug 33260] Show message queue on staff interface and make notices printable -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44095 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |martin.renvoize@openfifth.c |ity.org |o.uk -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44095 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com --- Comment #2 from David Nind <david@davidnind.com> --- Everything works as expected, apart from Step 5 of the test plan - which I'm having trouble with. If I: 1. Delete the CONVERTED_TO_PRINT notice 2. Send the welcome message 3. Process the message queue ==> There is no "Covert to print" action button However, if I: 1. DON'T delete the welcome message (note: I created a new CONVERTED_TO_PRINT notice) 2. Send the welcome message 3. Process the message queue 4. "Covert to print" to is shown in the actions column 5. Delete the CONVERTED_TO_PRINT notice 6. Click the "Convert to print" (I didn't refresh the notices page) ==> I get the expected message: "The notice cannot be converted to a print notice because the CONVERTED_TO_PRINT notice does not exist. Create it in Notices and slips, as a print notice of the Patrons module." -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org