Bug 19855: Move getalert, addalert and delalert to Koha::Subscription
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 20 Dec 2017 20:01:08 +0000 (17:01 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 23 Apr 2018 17:22:15 +0000 (14:22 -0300)
commit5c7ff786d5e755ff2452ec41c4385150b93d3ea9
tree64a705709d91dde523787d465a321713dae0d220
parent0bd1f30c8c4f151eaed1a6e1e56a8c78d28c0b4b
Bug 19855: Move getalert, addalert and delalert to Koha::Subscription

This patch removes 3 subroutines from C4::Letters:
- getalert
- addalert
- delalert

And add 3 methods to Koha::Subscription:
- subscribers
- add_subscriber
- remove_subscriber

It makes the code cleaner for future cleanup.
TODO - we should remove alert.alertid and alert.type, and rename
alert.externalid with alert.subscriptionid
That way alert will be renamed borrowers_subscriptions (or similar) and
will become a simple join table between borrowers and subscriptions.
We will need to deal with FK that could not be satisfied.
Let's do that after this patch is pushed.

Test plan:
Subscribe and unsubscribe to email notifications sent when a new issues
is available.
Make sure everything works as before and you receive the emails.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
12 files changed:
C4/Letters.pm
Koha/Subscription.pm
koha-tmpl/intranet-tmpl/prog/en/modules/serials/viewalerts.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-alert-subscribe.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-serial-issues.tt
opac/opac-alert-subscribe.pl
opac/opac-detail.pl
opac/opac-serial-issues.pl
serials/viewalerts.pl
t/db_dependent/Koha/Subscription.t
t/db_dependent/Letters.t