-- location_type_id should have default NULL, not invalid id 0
ALTER TABLE civicrm_mailing CHANGE `location_type_id` `location_type_id` int(10) unsigned DEFAULT NULL COMMENT 'With email_selection_method, determines which email address to use';
+
+
+-- CRM-15970 - Track authorship of of A/B tests
+ALTER TABLE civicrm_mailing_abtest
+ ADD COLUMN `created_id` int unsigned COMMENT 'FK to Contact ID',
+ ADD COLUMN `created_date` datetime COMMENT 'When was this item created',
+ ADD CONSTRAINT FK_civicrm_mailing_abtest_created_id FOREIGN KEY (`created_id`) REFERENCES `civicrm_contact`(`id`) ON DELETE SET NULL;
* @package CiviCRM_APIv3
*/
+/**
+ * @param array $spec
+ */
+function _civicrm_api3_mailing_a_b_create_spec(&$spec) {
+ $spec['created_date']['api.default'] = 'now';
+ $spec['created_id']['api.required'] = 1;
+ $spec['created_id']['api.default'] = 'user_contact_id';
+}
+
/**
* Handle a create mailing ab testing.
*
public function setUp() {
parent::setUp();
$this->useTransaction(TRUE);
+ $this->createLoggedInUser();
$this->_mailingID_A = $this->createMailing();
$this->_mailingID_B = $this->createMailing();
$this->_mailingID_C = $this->createMailing();
<title>Group Percentage</title>
<add>4.6</add>
</field>
-
+ <field>
+ <name>created_id</name>
+ <title>AB Test Created By</title>
+ <type>int unsigned</type>
+ <comment>FK to Contact ID</comment>
+ <add>4.6</add>
+ </field>
+ <foreignKey>
+ <name>created_id</name>
+ <table>civicrm_contact</table>
+ <key>id</key>
+ <add>4.6</add>
+ <onDelete>SET NULL</onDelete>
+ </foreignKey>
+ <field>
+ <name>created_date</name>
+ <title>AB Test Created Date</title>
+ <type>datetime</type>
+ <comment>When was this item created</comment>
+ <add>4.6</add>
+ <html>
+ <type>Select Date</type>
+ </html>
+ </field>
</table>