Bug 29997 - Allow to send email notification when a serial issue is late
Summary: Allow to send email notification when a serial issue is late
Status: Patch doesn't apply
Alias: None
Product: Koha
Classification: Unclassified
Component: Serials (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Julian Maurice
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 30096
  Show dependency treegraph
 
Reported: 2022-02-01 15:47 UTC by Julian Maurice
Modified: 2024-01-09 13:18 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 29997: Allow to send email notification when a serial issue is late (33.79 KB, patch)
2022-02-01 15:48 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 29997: Allow to send email notification when a serial issue is late (32.99 KB, patch)
2022-11-10 11:02 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 29997: Allow to send email notification when a serial issue is late (33.04 KB, patch)
2023-10-10 13:28 UTC, Julian Maurice
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Julian Maurice 2022-02-01 15:47:04 UTC

    
Comment 1 Julian Maurice 2022-02-01 15:48:47 UTC
Created attachment 130048 [details] [review]
Bug 29997: Allow to send email notification when a serial issue is late

This patch adds the ability to define, for each subscription, a letter
that will be sent whenever an issue is automatically marked as late by
the script misc/cronjobs/serialsUpdate.pl.
If no letter is defined for a subscription, then no letter will be sent.

The letter will be sent to the subscription's manager (the staff
member who created or last modified the subscription).

Test plan:
1. Create a letter in Tools › Notices & slips for module "Serials". Fill
   the Email template.
2. Create a new subscription, with a grace period of 1 day, and set the
   new field "Late issue notification" to the letter you just created.
   Set the first issue publication date and subscription start date to
   two days ago
3. Run `misc/cronjobs/serialsUpdate.pl -v -c`.
4. The first serial issue of your subscription should have been
   automatically marked as late. Now verify that the table message_queue
   contains a new message corresponding to this serial issue. The
   message's contents should be what you defined in step 1.
   The message should be addressed to the subscription's manager (you)

Technical note:
   The "subscription" table contained a column named "librarian", which
   contained the userid of the patron who created or last modified the
   subscription, but there was no foreign key constraint referencing the
   borrowers table. So this patch also adds a new column "manager_id"
   which contains the borrowernumber of the patron who created or last
   modified the subscription, and it also adds the foreign key
   constraint.  The atomicupdate script tries to fill the new
   "manager_id" column by searching patrons by their "userid", which
   might fail, so it's normal to have some NULL values in "manager_id"
   at the end. The "librarian" column is removed at the end of the
   script
Comment 2 Julian Maurice 2022-11-10 11:02:39 UTC
Created attachment 143637 [details] [review]
Bug 29997: Allow to send email notification when a serial issue is late

This patch adds the ability to define, for each subscription, a letter
that will be sent whenever an issue is automatically marked as late by
the script misc/cronjobs/serialsUpdate.pl.
If no letter is defined for a subscription, then no letter will be sent.

The letter will be sent to the subscription's manager (the staff
member who created or last modified the subscription).

Test plan:
1. Run updatedatabase.pl and update_dbix_class_files.pl
2. Create a letter in Tools › Notices & slips for module "Serials". Fill
   the Email template.
3. Create a new subscription, with a grace period of 1 day, and set the
   new field "Late issue notification" to the letter you just created.
   Set the first issue publication date and subscription start date to
   two days ago
4. Run `misc/cronjobs/serialsUpdate.pl -v -c`.
5. The first serial issue of your subscription should have been
   automatically marked as late. Now verify that the table message_queue
   contains a new message corresponding to this serial issue. The
   message's contents should be what you defined in step 1.
   The message should be addressed to the subscription's manager (you)

Technical note:
   The "subscription" table contained a column named "librarian", which
   contained the userid of the patron who created or last modified the
   subscription, but there was no foreign key constraint referencing the
   borrowers table. So this patch also adds a new column "manager_id"
   which contains the borrowernumber of the patron who created or last
   modified the subscription, and it also adds the foreign key
   constraint.  The atomicupdate script tries to fill the new
   "manager_id" column by searching patrons by their "userid", which
   might fail, so it's normal to have some NULL values in "manager_id"
   at the end. The "librarian" column is removed at the end of the
   script
Comment 3 Julian Maurice 2022-11-10 11:03:25 UTC
Patch rebased on master + fixed a bug (hardcoded letter code)
Comment 4 Julian Maurice 2023-10-10 13:28:50 UTC
Created attachment 156796 [details] [review]
Bug 29997: Allow to send email notification when a serial issue is late

This patch adds the ability to define, for each subscription, a letter
that will be sent whenever an issue is automatically marked as late by
the script misc/cronjobs/serialsUpdate.pl.
If no letter is defined for a subscription, then no letter will be sent.

The letter will be sent to the subscription's manager (the staff
member who created or last modified the subscription).

Test plan:
1. Run updatedatabase.pl and update_dbix_class_files.pl
2. Create a letter in Tools › Notices & slips for module "Serials". Fill
   the Email template.
3. Create a new subscription, with a grace period of 1 day, and set the
   new field "Late issue notification" to the letter you just created.
   Set the first issue publication date and subscription start date to
   two days ago
4. Run `misc/cronjobs/serialsUpdate.pl -v -c`.
5. The first serial issue of your subscription should have been
   automatically marked as late. Now verify that the table message_queue
   contains a new message corresponding to this serial issue. The
   message's contents should be what you defined in step 1.
   The message should be addressed to the subscription's manager (you)

Technical note:
   The "subscription" table contained a column named "librarian", which
   contained the userid of the patron who created or last modified the
   subscription, but there was no foreign key constraint referencing the
   borrowers table. So this patch also adds a new column "manager_id"
   which contains the borrowernumber of the patron who created or last
   modified the subscription, and it also adds the foreign key
   constraint.  The atomicupdate script tries to fill the new
   "manager_id" column by searching patrons by their "userid", which
   might fail, so it's normal to have some NULL values in "manager_id"
   at the end. The "librarian" column is removed at the end of the
   script
Comment 5 Julian Maurice 2023-10-10 13:29:01 UTC
Patch rebased on master
Comment 6 Matthias Le Gac 2024-01-09 13:18:17 UTC
Could you fixed the bug. 

Applying: Bug 29997: Allow to send email notification when a serial issue is late
error: sha1 information is lacking or useless (C4/Serials.pm).
error: could not build fake ancestor
Patch failed at 0001 Bug 29997: Allow to send email notification when a serial issue is late

Thanks