Skip to content

Commit

Permalink
CRM-20892 Add in modified_date column to civicrm_mailing to assist in…
Browse files Browse the repository at this point in the history
… preventing cross edit of mailings
  • Loading branch information
seamuslee001 committed Sep 10, 2017
1 parent b448aa6 commit 619d330
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
24 changes: 23 additions & 1 deletion CRM/Mailing/DAO/Mailing.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*
* Generated from xml/schema/CRM/Mailing/Mailing.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:9a7cf33adcdee2e83d5fe1b5a28186cb)
* (GenCodeChecksum:7f90165e5c470ceb7e4644a5ab0660d1)
*/
require_once 'CRM/Core/DAO.php';
require_once 'CRM/Utils/Type.php';
Expand Down Expand Up @@ -299,6 +299,12 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO {
* @var string
*/
public $language;
/**
* When was the mailing (or closely related entity) was created or modified or deleted.
*
* @var timestamp
*/
public $modified_date;
/**
* Class constructor.
*/
Expand Down Expand Up @@ -908,6 +914,22 @@ static function &fields() {
'optionEditPath' => 'civicrm/admin/options/languages',
)
) ,
'mailing_modified_date' => array(
'name' => 'modified_date',
'type' => CRM_Utils_Type::T_TIMESTAMP,
'title' => ts('Modified Date') ,
'description' => 'When was the mailing (or closely related entity) was created or modified or deleted.',
'required' => false,
'export' => true,
'where' => 'civicrm_mailing.modified_date',
'headerPattern' => '',
'dataPattern' => '',
'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
'table_name' => 'civicrm_mailing',
'entity' => 'Mailing',
'bao' => 'CRM_Mailing_BAO_Mailing',
'localizable' => 0,
) ,
);
CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
}
Expand Down
10 changes: 10 additions & 0 deletions CRM/Upgrade/Incremental/php/FourSeven.php
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,16 @@ public function upgrade_4_7_25($rev) {
'civicrm_case', 'modified_date', "timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'When was the case (or closely related entity) was created or modified or deleted.'");
}

/**
* Upgrade function.
*
* @param string $rev
*/
public function upgrade_4_7_26($rev) {
$this->addTask('CRM-20892 - Add modified_date to civicrm_mailing', 'addColumn',
'civicrm_mailing', 'modified_date', "timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'When was the mailing (or closely related entity) was created or modified or deleted.'");
$this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'runSql', $rev);
}

/*
* Important! All upgrade functions MUST add a 'runSql' task.
Expand Down
10 changes: 10 additions & 0 deletions xml/schema/Mailing/Mailing.xml
Original file line number Diff line number Diff line change
Expand Up @@ -487,4 +487,14 @@
<type>Select</type>
</html>
</field>
<field>
<name>modified_date</name>
<uniqueName>mailing_modified_date</uniqueName>
<type>timestamp</type>
<comment>When was the mailing (or closely related entity) was created or modified or deleted.</comment>
<required>false</required>
<export>true</export>
<default>CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP</default>
<add>4.7</add>
</field>
</table>

0 comments on commit 619d330

Please sign in to comment.