Bug 7371

Summary: AutoEmailPrimaryAddress set to 'OFF' in new installs
Product: Koha Reporter: Nicole C. Engard <nengard>
Component: DatabaseAssignee: Katrin Fischer <katrin.fischer>
Status: CLOSED FIXED QA Contact: Ian Walls <koha.sekjal>
Severity: normal    
Priority: P5 - low CC: chris, katrin.fischer, paul.poulain
Version: 3.6   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 7371: Add 'cardnumber' as option for AutoEmailPrimaryAddress
Bug 7371: Add 'cardnumber' as option for AutoEmailPrimaryAddress

Description Nicole C. Engard 2011-12-20 16:34:32 UTC
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AutoEmailPrimaryAddress','OFF','Defines the default email address where \'Account Details\' emails are sent.','email|emailpro|B_email|cardnumber|OFF','Choice');


This preference should be set to one of the choices - and OFF shouldn't be a choice - OFF seems to map to 'alternate'
Comment 1 Nicole C. Engard 2011-12-20 16:44:28 UTC
Also, doesn't first_valid make the most sense as the default value since it's the most broad?
Comment 2 Katrin Fischer 2012-04-12 05:50:22 UTC
Hi Nicole, 

I checked this bug and it seems that OFF is mapping to 'first valid' which makes the default setting like you wanted it :)

     -
         - "Use"
         - pref: AutoEmailPrimaryAddress
           default: "OFF"
           choices:
               email: home
               emailpro: work
               B_email: alternate
               "OFF": first valid
         - "patron email address for sending out emails."
     -

This also matches the code:
 909         if ($which_address eq 'OFF') {
 910             $to_address = GetFirstValidEmailAddress( $message->{'borrowernumber'} );

But there is one option 'cardnumber' that is not reflected in the pref file and can not be selected. I am going to add it.

INSERT INTO `systempreferences` VALUES ('AutoEmailPrimaryAddress','OFF','email|emailpro|B_email|cardnumber|OFF','Defines the default email address where Account Details emails are sent.','Choice')"
Comment 3 Katrin Fischer 2012-04-12 05:56:28 UTC Comment hidden (obsolete)
Comment 4 Chris Cormack 2012-04-13 02:57:57 UTC
Created attachment 9162 [details] [review]
Bug 7371: Add 'cardnumber' as option for AutoEmailPrimaryAddress

The systempref.sql file had one more option 'cardnumber' that was not
visible from the system preference editor. This patch adds the setting.

To test:
- Check new setting cardnumber is available for AutoEmailPrimaryAddress
- Use setting with a patron that has an email address as cardnumber and
verify email is sent out correctly.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Comment 5 Ian Walls 2012-04-13 17:29:28 UTC
Safely adds 'cardnumber' option to syspref editor.  Marking Passed QA.
Comment 6 Jared Camins-Esakov 2012-12-31 00:53:44 UTC
There have been no further reports of problems so I am marking this bug resolved.