Select "Enable multiple bulk email address for a contact", "hold_date" can not be updated
I have reported the bug at https://issues.civicrm.org/jira/browse/CRM-20189, and now I'll explain why the error occours only if you assign true to the variable civimail_multiple_bulk_emails.
( $result = civicrm_api3('Setting', 'create', array( 'civimail_multiple_bulk_emails' => 1, ));)
If civimail_multiple_bulk_emails is true, you have three options to select for "On Hold?" in your email edit block, see the file ".../CRM/Contact/Form/Edit/Email.php". If you chose the "- select -", the value is "0", which data type String is, and in the function "holdEmail" (.../CRM/Core/BAO/Email.php) the condition "elseif ($email->on_hold == 'null')..." will not be filled, because a string '0' is not 'null'!
Steps to reproduce:
- Open the page „Administer CiviCRM“ --> “CiviMail Component Settings”, and select the option “Enable multiple bulk email address for a contact”
- Open a contact and set “on hold” to the email (i.g. select “On Hold Opt Out”), and check the hold_date with api, ), in my test the “hold_date” is “2017-02-22 09:27:56”, and “on_hold=2
- On the page of contact, reset the “On Hold” and save it, and check the value with api, and the value of “on_hold” is 0, BUT the “hold_date” IS NOT CHANGED! The “hold_date” should be deleted, and set the current time for “reset_date”!
- As a following error: the “hold_date” is the old one, not changed, if you set “on hold” to the email again (i.g. select “On Hold Bounce”). In my test the “hold_date” is still “2017-02-22 09:27:56”, and “on_hold=1