Koha/misc/cronjobs
Magnus Enger 6d1890fc8e
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>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-14 08:49:31 -03:00
..
holds Bug 32518: (QA follow-up) Fix alignment 2023-03-02 14:46:17 -03:00
recalls Bug 31203: Alter other cronjobs that currenlty use cronlogaction 2022-10-05 16:12:59 -03:00
rss Bug 17600: Fix POSIX imports 2021-07-29 14:37:26 +02:00
social_data
thirdparty Bug 31356: Use hold expiration date instead of adding days to the waiting date 2022-08-31 14:30:26 -03:00
advance_notices.pl Bug 29100: (QA follow-up) Rename issue(s) keys to checkout(s) 2023-02-07 15:36:21 -03:00
archive_purchase_suggestions.pl Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
automatic_checkin.pl Bug 31203: Alter other cronjobs that currenlty use cronlogaction 2022-10-05 16:12:59 -03:00
automatic_item_modification_by_age.pl Bug 31203: Alter other cronjobs that currenlty use cronlogaction 2022-10-05 16:12:59 -03:00
automatic_renewals.pl Bug 30642: (QA follow-up) Do not rely on script names in modules, add unit test 2023-02-10 11:07:59 -03:00
backup.sh
batch_anonymise.pl Bug 31203: Alter other cronjobs that currenlty use cronlogaction 2022-10-05 16:12:59 -03:00
build_browser_and_cloud.pl Bug 31203: Alter other cronjobs that currenlty use cronlogaction 2022-10-05 16:12:59 -03:00
cart_to_shelf.pl Bug 31203: Alter other cronjobs that currenlty use cronlogaction 2022-10-05 16:12:59 -03:00
check-url-quick.pl Bug 29697: Replace GetMarcBiblio occurrences with $biblio->metadata->record 2022-07-22 15:24:11 -03:00
cleanup_database.pl Bug 30069: (QA follow-up) Use pure DBIC for select and delete with single query 2023-03-02 12:00:22 -03:00
cloud-kw.pl Bug 31203: Alter other cronjobs that currenlty use cronlogaction 2022-10-05 16:12:59 -03:00
cloud-sample.conf
CONFIGURE.gmail
create_koc_db.pl Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
crontab.example Bug 19532: (QA follow-up) Add the cron jobs to the cron files 2022-03-14 22:45:52 -10:00
delete_items.pl Bug 32922: Remove space in shebang 2023-02-20 09:44:06 -03:00
delete_patrons.pl Bug 31854: (QA follow-up) Terminology: loans > checkouts 2022-11-03 10:04:27 -03:00
delete_records_via_leader.pl Bug 32656: Script delete_records_via_leader.pl no longer deletes items 2023-01-20 13:53:09 +00:00
edi_cron.pl Bug 16258: (QA follow-up) Capitalise EDIFACT 2022-04-13 15:55:39 +02:00
fines.pl Bug 27259: Add HomeOrHoldingBranch checks where it was missing from 2022-11-04 19:04:18 -03:00
gather_print_notices.pl Bug 31203: Alter other cronjobs that currenlty use cronlogaction 2022-10-05 16:12:59 -03:00
import_webservice_batch.pl Bug 15869: Change framework on overlay 2023-02-07 10:32:22 -03:00
longoverdue.pl Bug 31203: Alter other cronjobs that currenlty use cronlogaction 2022-10-05 16:12:59 -03:00
membership_expiry.pl Bug 31203: Alter other cronjobs that currenlty use cronlogaction 2022-10-05 16:12:59 -03:00
merge_authorities.pl Bug 17600: Fix missing C4::AuthoritiesMARC import 2021-07-29 15:34:25 +02:00
notice_unprocessed_suggestions.pl Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
overdue_notices.pl Bug 29354: Make overdue_notices.pl send .html 2023-03-14 08:49:31 -03:00
patron_emailer.pl Bug 31203: Alter other cronjobs that currenlty use cronlogaction 2022-10-05 16:12:59 -03:00
plugins_nightly.pl Bug 31203: Alter other cronjobs that currenlty use cronlogaction 2022-10-05 16:12:59 -03:00
printoverdues.sh
process_message_queue.pl Bug 31453: Add ability to filter messages to process using process_message_queue.pl via a command line parameter 2023-03-02 09:37:44 -03:00
purge_suggestions.pl Bug 31203: Alter other cronjobs that currenlty use cronlogaction 2022-10-05 16:12:59 -03:00
reconcile_balances.pl Bug 31203: Alter other cronjobs that currenlty use cronlogaction 2022-10-05 16:12:59 -03:00
remove_temporary_edifiles.pl
runreport.pl Bug 32012: runreport.pl should use binmode UTF-8 2022-11-02 19:15:48 -03:00
serialsUpdate.pl Bug 28950: Mark serial late when past grace period 2022-10-11 10:42:26 -03:00
share_usage_with_koha_community.pl Bug 31203: Alter other cronjobs that currenlty use cronlogaction 2022-10-05 16:12:59 -03:00
sitemap.pl Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
staticfines.pl Bug 27259: Add HomeOrHoldingBranch checks where it was missing from 2022-11-04 19:04:18 -03:00
stockrotation.pl Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
update_patrons_category.pl Bug 31249: Use cronlogaction on update_patrons_category.pl 2022-08-05 11:53:15 -03:00
update_totalissues.pl Bug 31203: Alter other cronjobs that currenlty use cronlogaction 2022-10-05 16:12:59 -03:00
writeoff_debts.pl Bug 28994: Fix logical errors with amount vs amoutoutstanding 2021-11-15 12:38:39 +01:00