[Bug 29354] New: overdue_notices.pl should be able to send an attachment as HTML
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29354 Bug ID: 29354 Summary: overdue_notices.pl should be able to send an attachment as HTML Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Notices Assignee: koha-bugs@lists.koha-community.org Reporter: lucas@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org overdue_notices.pl can output HTML data to a specified directory as an .html file but there is no way to send the overdues to the library admin email address as an attachment.html file. The file can only send as an attachment.txt. It would be nice if we could deliver those print overdoes to librarians as .html via email. -- 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=29354 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |m.de.rooy@rijksmuseum.nl See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=31075 -- 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=29354 --- Comment #1 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- I opened bug 31075 for a wider scope -- 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=29354 --- Comment #2 from Lucas Gass <lucas@bywatersolutions.com> --- (In reply to Marcel de Rooy from comment #1)
I opened bug 31075 for a wider scope
Thanks Marcel, in that case should we mark this one as a duplicate of Bug 31075? -- 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=29354 --- Comment #3 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- (In reply to Lucas Gass from comment #2)
(In reply to Marcel de Rooy from comment #1)
I opened bug 31075 for a wider scope
Thanks Marcel, in that case should we mark this one as a duplicate of Bug 31075?
I would wait a while :) -- 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=29354 Magnus Enger <magnus@libriotech.no> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |magnus@libriotech.no Assignee|koha-bugs@lists.koha-commun |magnus@libriotech.no |ity.org | Severity|enhancement |normal --- Comment #4 from Magnus Enger <magnus@libriotech.no> --- I'm reclassifying this as a "normal" bug, not an enh. If you have - the syspref EmailOverduesNoEmail = Send and - specify "--html somedir" you will be sent a file called attachment.txt, which contains partial HTML, without html, head and body elements. This file will be pretty useless. I will try to provide a patch to fix this situation in a minimal way. This will not be the larger rewrite proposed in Bug 31075. -- 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=29354 Magnus Enger <magnus@libriotech.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|overdue_notices.pl should |Make overdue_notices.pl |be able to send an |send HTML attachment as |attachment as HTML |.html -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29354 Magnus Enger <magnus@libriotech.no> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=14347 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29354 Magnus Enger <magnus@libriotech.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Small patch Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29354 --- Comment #5 from Magnus Enger <magnus@libriotech.no> --- Created attachment 144534 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=144534&action=edit Bug 29354: Make overdue_notices.pl send .html If you have EmailOverduesNoEmail = Send and specify "--html somedir", overdue_notices.pl will send a file by email that contains partial HTML, as a file called attachment.txt. This patch fixes that. To reproduce in koha-testing-docker: - EmailOverduesNoEmail = Send - Make sure you have a loan that was due yesterday, by backdating the due date - Set up an overdue action to send "Overdue Notice" (ODUE) to the category you made the loan to above, when a loan is one day overdue - Run this command: $ sudo koha-shell -c "perl misc/cronjobs/overdue_notices.pl -v -t -html /tmp/" kohadev - Look at the file /tmp/notices-<DATE>.html and make sure it is a full HTML document, with <html>, <head>, <body> etc. - Create a report like this: SELECT message_id, letter_id, borrowernumber, subject, CONCAT( '<pre>', content, '</pre>' ) AS content, metadata, letter_code, message_transport_type, time_queued, updated_on, to_address, content_type, failure_code FROM message_queue WHERE subject = 'Overdue Notices' ORDER BY message_id DESC - Run the report and verify there is a line like this in the "content" of the newest message: Content-Type: text/plain; name=attachment.txt - A part of the "content" will be a block of several lines of gibberish (base64) that look something like "RGVhciAga29oYSwNCg0KQWN...". Copy this block of text to somewhere like base64decode.org and decode the text. You should see a fragment of HTML, without <html>, <head>, <body> etc. To test: - Apply the patch - Run overdue_notices.pl again, with the same arguments as above - Make sure /tmp/notices-<DATE>.html is still a full HTML document - Re-run the report, and make sure you now have this in the "content": Content-Type: text/html; name=attachment.html - Decode the base64 and make sure it is now a full HTML document, with <html>, <head>, <body> etc. - Re-run overdue_notices.pl as above, but replace "-html /tmp/" with "-csv /tmp/test.csv" - Make sure /tmp/test.csv and the decoded base64 from the report contains CSV data - Re-run overdue_notices.pl as above, but replace "-html /tmp/" with "-text /tmp/" - Make sure /tmp/notices-<DATE>.txt and the decoded base64 from the report contains no HTML Note: - The actual text from the different messages will be enclosed in <pre>-tags - If you have HTML in your ODUE message template and run with -v, you will have warnings saying "The following terms were not matched and replaced" These are due to Bug 14347, and are not adressed by the current patch. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29354 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29354 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #144534|0 |1 is obsolete| | --- Comment #6 from Lucas Gass <lucas@bywatersolutions.com> --- Created attachment 144544 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=144544&action=edit Bug 29354: Make overdue_notices.pl send .html If you have EmailOverduesNoEmail = Send and specify "--html somedir", overdue_notices.pl will send a file by email that contains partial HTML, as a file called attachment.txt. This patch fixes that. To reproduce in koha-testing-docker: - EmailOverduesNoEmail = Send - Make sure you have a loan that was due yesterday, by backdating the due date - Set up an overdue action to send "Overdue Notice" (ODUE) to the category you made the loan to above, when a loan is one day overdue - Run this command: $ sudo koha-shell -c "perl misc/cronjobs/overdue_notices.pl -v -t -html /tmp/" kohadev - Look at the file /tmp/notices-<DATE>.html and make sure it is a full HTML document, with <html>, <head>, <body> etc. - Create a report like this: SELECT message_id, letter_id, borrowernumber, subject, CONCAT( '<pre>', content, '</pre>' ) AS content, metadata, letter_code, message_transport_type, time_queued, updated_on, to_address, content_type, failure_code FROM message_queue WHERE subject = 'Overdue Notices' ORDER BY message_id DESC - Run the report and verify there is a line like this in the "content" of the newest message: Content-Type: text/plain; name=attachment.txt - A part of the "content" will be a block of several lines of gibberish (base64) that look something like "RGVhciAga29oYSwNCg0KQWN...". Copy this block of text to somewhere like base64decode.org and decode the text. You should see a fragment of HTML, without <html>, <head>, <body> etc. To test: - Apply the patch - Run overdue_notices.pl again, with the same arguments as above - Make sure /tmp/notices-<DATE>.html is still a full HTML document - Re-run the report, and make sure you now have this in the "content": Content-Type: text/html; name=attachment.html - Decode the base64 and make sure it is now a full HTML document, with <html>, <head>, <body> etc. - Re-run overdue_notices.pl as above, but replace "-html /tmp/" with "-csv /tmp/test.csv" - Make sure /tmp/test.csv and the decoded base64 from the report contains CSV data - Re-run overdue_notices.pl as above, but replace "-html /tmp/" with "-text /tmp/" - Make sure /tmp/notices-<DATE>.txt and the decoded base64 from the report contains no HTML Note: - The actual text from the different messages will be enclosed in <pre>-tags - If you have HTML in your ODUE message template and run with -v, you will have warnings saying "The following terms were not matched and replaced" These are due to Bug 14347, and are not adressed by the current patch. Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29354 --- Comment #7 from Lucas Gass <lucas@bywatersolutions.com> --- Works as described, thanks Magnus! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29354 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29354 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #144544|0 |1 is obsolete| | --- Comment #8 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 146510 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=146510&action=edit Bug 29354: Make overdue_notices.pl send .html If you have EmailOverduesNoEmail = Send and specify "--html somedir", overdue_notices.pl will send a file by email that contains partial HTML, as a file called attachment.txt. This patch fixes that. To reproduce in koha-testing-docker: - EmailOverduesNoEmail = Send - Make sure you have a loan that was due yesterday, by backdating the due date - Set up an overdue action to send "Overdue Notice" (ODUE) to the category you made the loan to above, when a loan is one day overdue - Run this command: $ sudo koha-shell -c "perl misc/cronjobs/overdue_notices.pl -v -t -html /tmp/" kohadev - Look at the file /tmp/notices-<DATE>.html and make sure it is a full HTML document, with <html>, <head>, <body> etc. - Create a report like this: SELECT message_id, letter_id, borrowernumber, subject, CONCAT( '<pre>', content, '</pre>' ) AS content, metadata, letter_code, message_transport_type, time_queued, updated_on, to_address, content_type, failure_code FROM message_queue WHERE subject = 'Overdue Notices' ORDER BY message_id DESC - Run the report and verify there is a line like this in the "content" of the newest message: Content-Type: text/plain; name=attachment.txt - A part of the "content" will be a block of several lines of gibberish (base64) that look something like "RGVhciAga29oYSwNCg0KQWN...". Copy this block of text to somewhere like base64decode.org and decode the text. You should see a fragment of HTML, without <html>, <head>, <body> etc. To test: - Apply the patch - Run overdue_notices.pl again, with the same arguments as above - Make sure /tmp/notices-<DATE>.html is still a full HTML document - Re-run the report, and make sure you now have this in the "content": Content-Type: text/html; name=attachment.html - Decode the base64 and make sure it is now a full HTML document, with <html>, <head>, <body> etc. - Re-run overdue_notices.pl as above, but replace "-html /tmp/" with "-csv /tmp/test.csv" - Make sure /tmp/test.csv and the decoded base64 from the report contains CSV data - Re-run overdue_notices.pl as above, but replace "-html /tmp/" with "-text /tmp/" - Make sure /tmp/notices-<DATE>.txt and the decoded base64 from the report contains no HTML Note: - The actual text from the different messages will be enclosed in <pre>-tags - If you have HTML in your ODUE message template and run with -v, you will have warnings saying "The following terms were not matched and replaced" These are due to Bug 14347, and are not adressed by the current patch. Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29354 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kyle@bywatersolutions.com --- Comment #9 from Kyle M Hall <kyle@bywatersolutions.com> --- The file remains untouched so I don't think that requires a new command line switch. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29354 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master Version(s)| |23.05.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29354 --- Comment #10 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Pushed to master for 23.05. Nice work everyone, thanks! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29354 Jacob O'Mara <jacob.omara@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to master |Pushed to stable Version(s)|23.05.00 |23.05.00,22.11.04 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29354 --- Comment #11 from Jacob O'Mara <jacob.omara@ptfs-europe.com> --- Nice work, thanks everyone! Pushed to 22.11.x for the next release. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29354 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to stable |Needs documenting --- Comment #12 from Lucas Gass <lucas@bywatersolutions.com> --- This patchset doesn't apply cleanly in 22.05, no backport. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29354 Michaela Sieber <michaela.sieber@kit.edu> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |michaela.sieber@kit.edu -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29354 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |barton@bywatersolutions.com --- Comment #13 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- *** Bug 14347 has been marked as a duplicate of this bug. *** -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29354 Rebecca Coert <rcoert@arlingtonva.us> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rcoert@arlingtonva.us -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org