Bug 20755: Add separate email configuration for acquisition and serial emails

This patch allows every library to define the From and Reply-to email addresses for acquisition and serial emails (orders and claims) sent by Koha.
Especially in large libraries with dedicated acquisition departments we need a way that vendors/booksellers can reply directly to the acquisition team and not to the library default email. The library email in the library configuration can then be used for circulation purposes only.

1) Apply patch, run database update
2) Make sure you have set up Koha to send up email (SMTP server, KohaAdminEmailAdress, etc.)
3) Make sure you have a vendor set up with a valid email address.
4) Check that you have four new system preferences:
  - AcquisitionsDefaultEMailAddress
  - SerialsDefaultEMailAddress
  - AcquisitionsDefaultReplyTo
  - SerialsDefaultReplyTo
5) Check that there is no change in behaviour if the four new system preferences are left empty:
All acquisition and serial emails are sent from the library email (or KohaAdminEmailAddress if no library email is set)
6) Create an order with at least one order line. Send the order to your vendor by email.
7) Create an acquisition claim notice and send it to your vendor.
8) Create a subscription linked to your vendor and with at least one late issue. Claim the issue.
9) There should be no change in behaviour: emails should be sent from library email (or KohaAdminEmailAddress if nothing is set on library level)
10) Configure different email addresses for system preferences:
  - First email address: AcquisitionsDefaultEMailAddress, SerialsDefaultEMailAddress
  - Second email address: AcquisitionsDefaultReplyTo, SerialsDefaultReplyTo
11) Repeat steps 6-8
12) Verify that the library specific acquisition and serial email addresses are used as From and Reply-to.

Sponsored-by: Karlsruhe Institute of Technology (KIT)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Raphael Straub 2023-09-29 08:48:31 +00:00 committed by Tomas Cohen Arazi
parent ffd4eedd0f
commit 55b9db4a1a
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
4 changed files with 83 additions and 2 deletions

View file

@ -493,8 +493,23 @@ sub SendAlerts {
? ( bcc => $userenv->{emailaddress} )
: ()
),
from => $library->branchemail
|| C4::Context->preference('KohaAdminEmailAddress'),
from => (
$type eq 'claimissues'
? C4::Context->preference('SerialsDefaultEMailAddress')
: C4::Context->preference('AcquisitionsDefaultEMailAddress')
)
|| $library->branchemail
|| C4::Context->preference('KohaAdminEmailAddress'),
(
$type eq 'claimissues' && C4::Context->preference('SerialsDefaultReplyTo')
? ( reply_to => C4::Context->preference('SerialsDefaultReplyTo') )
: (
( $type eq 'claimacquisition' || $type eq 'orderacquisition' )
&& C4::Context->preference('AcquisitionsDefaultReplyTo')
? ( reply_to => C4::Context->preference('AcquisitionsDefaultReplyTo') )
: ()
)
),
subject => "" . $letter->{title},
}
);

View file

@ -0,0 +1,38 @@
use Modern::Perl;
return {
bug_number => "20755",
description => "Add sysprefs for email addresses in acquisitions and serials",
up => sub {
my ($args) = @_;
my ( $dbh, $out ) = @$args{qw(dbh out)};
$dbh->do(
q{
INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) VALUES ('AcquisitionsDefaultEMailAddress', '', NULL, NULL, NULL);
}
);
say $out "Added new system preference 'AcquisitionsDefaultEMailAddress'";
$dbh->do(
q{
INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) VALUES ('AcquisitionsDefaultReplyTo', '', NULL, NULL, NULL);
}
);
say $out "Added new system preference 'AcquisitionsDefaultReplyTo'";
$dbh->do(
q{
INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) VALUES ('SerialsDefaultEMailAddress', '', NULL, NULL, NULL);
}
);
say $out "Added new system preference 'SerialsDefaultEMailAddress'";
$dbh->do(
q{
INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) VALUES ('SerialsDefaultReplyTo', '', NULL, NULL, NULL);
}
);
say $out "Added new system preference 'SerialsDefaultReplyTo'";
},
};

View file

@ -7,6 +7,8 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('AcqItemSetSubfieldsWhenReceived','','','Upon receiving items, update their subfields if they were created when placing an order (e.g. o=5|a="foo bar")','Free'),
('AcquisitionDetails', '1', '', 'Hide/Show acquisition details on the biblio detail page.', 'YesNo'),
('AcquisitionLog','0',NULL,'If ON, log acquisitions activity','YesNo'),
('AcquisitionsDefaultEMailAddress', '', NULL, NULL, NULL),
('AcquisitionsDefaultReplyTo', '', NULL, NULL, NULL),
('AcqViewBaskets','user','user|branch|all','Define which baskets a user is allowed to view: their own only, any within their branch, or all','Choice'),
('AcqWarnOnDuplicateInvoice','0','','Warn librarians when they try to create a duplicate invoice','YesNo'),
('ActionLogsTraceDepth', '0', '', 'Sets the maximum depth of the action logs stack trace', 'Integer'),
@ -676,6 +678,8 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('SeparateHoldings','0',NULL,'Separate current branch holdings from other holdings','YesNo'),
('SeparateHoldingsBranch','homebranch','homebranch|holdingbranch','Branch used to separate holdings','Choice'),
('SerialsSearchResultsLimit', NULL, NULL, 'Serials search results limit', 'integer'),
('SerialsDefaultEMailAddress', '', NULL, NULL, NULL),
('SerialsDefaultReplyTo', '', NULL, NULL, NULL),
('SessionRestrictionByIP','1','Check for change in remote IP address for session security. Disable only when remote IP address changes frequently.','','YesNo'),
('SessionStorage','mysql','mysql|Pg|tmp','Use database or a temporary file for storing session data','Choice'),
('ShelfBrowserUsesCcode','1','0','Use the item collection code when finding items for the shelf browser.','YesNo'),

View file

@ -125,6 +125,30 @@ Acquisitions:
- '<br>If you choose <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=EmailAddressForSuggestions">EmailAddressForSuggestions</a> you have to enter a valid email address:'
- pref: EmailAddressForSuggestions
class: email
-
- Use the from email address
- pref: AcquisitionsDefaultEMailAddress
class: email
- 'when sending acquisitions order and claim notices.'
- '<br>If left empty, it will fall back to the first defined address in the following list: Library Email, <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=KohaAdminEmailAddress">KohaAdminEmailAddress</a>.'
-
- Use the from email address
- pref: SerialsDefaultEMailAddress
class: email
- 'when sending serial claim notices.'
- '<br>If left empty, it will fall back to the first defined address in the following list: Library Email, <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=KohaAdminEmailAddress">KohaAdminEmailAddress</a>.'
-
- Use the reply-to email address
- pref: AcquisitionsDefaultReplyTo
class: email
- 'when sending acquisitions order and claim notices.'
- '<br>If left empty, it will fall back to the first defined address in the following list: Library ReplyTo, Library Email, <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=ReplytoDefault">ReplytoDefault</a>, <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=KohaAdminEmailAddress">KohaAdminEmailAddress</a>.'
-
- Use the reply-to email address
- pref: SerialsDefaultReplyTo
class: email
- 'when sending serial claim notices.'
- '<br>If left empty, it will fall back to the first defined address in the following list: Library ReplyTo, Library Email, <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=ReplytoDefault">ReplytoDefault</a>, <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=KohaAdminEmailAddress">KohaAdminEmailAddress</a>.'
Printing:
-
- Use the