@@ -, +, @@ and serial emails - AcquisitionsDefaultEMailAddress - SerialsDefaultEMailAddress - AcquisitionsDefaultReplyTo - SerialsDefaultReplyTo - First email address: AcquisitionsDefaultEMailAddress, SerialsDefaultEMailAddress - Second email address: AcquisitionsDefaultReplyTo, SerialsDefaultReplyTo --- C4/Letters.pm | 19 +++++++++- ...acquisitionsdefaultemailaddress_syspref.pl | 38 +++++++++++++++++++ installer/data/mysql/mandatory/sysprefs.sql | 4 ++ .../admin/preferences/acquisitions.pref | 24 ++++++++++++ 4 files changed, 83 insertions(+), 2 deletions(-) create mode 100755 installer/data/mysql/atomicupdate/bug_20755-add_acquisitionsdefaultemailaddress_syspref.pl --- a/C4/Letters.pm +++ a/C4/Letters.pm @@ -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}, } ); --- a/installer/data/mysql/atomicupdate/bug_20755-add_acquisitionsdefaultemailaddress_syspref.pl +++ a/installer/data/mysql/atomicupdate/bug_20755-add_acquisitionsdefaultemailaddress_syspref.pl @@ -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'"; + }, +}; --- a/installer/data/mysql/mandatory/sysprefs.sql +++ a/installer/data/mysql/mandatory/sysprefs.sql @@ -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'), @@ -675,6 +677,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'), --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref @@ -125,6 +125,30 @@ Acquisitions: - '
If you choose EmailAddressForSuggestions 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.' + - '
If left empty, it will fall back to the first defined address in the following list: Library Email, KohaAdminEmailAddress.' + - + - Use the from email address + - pref: SerialsDefaultEMailAddress + class: email + - 'when sending serial claim notices.' + - '
If left empty, it will fall back to the first defined address in the following list: Library Email, KohaAdminEmailAddress.' + - + - Use the reply-to email address + - pref: AcquisitionsDefaultReplyTo + class: email + - 'when sending acquisitions order and claim notices.' + - '
If left empty, it will fall back to the first defined address in the following list: Library ReplyTo, Library Email, ReplytoDefault, KohaAdminEmailAddress.' + - + - Use the reply-to email address + - pref: SerialsDefaultReplyTo + class: email + - 'when sending serial claim notices.' + - '
If left empty, it will fall back to the first defined address in the following list: Library ReplyTo, Library Email, ReplytoDefault, KohaAdminEmailAddress.' Printing: - - Use the --