Skip to content

Commit

Permalink
Convert civicrm_note.modified_date to timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwire committed Feb 10, 2020
1 parent e9ada0a commit 5377e6c
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 13 deletions.
1 change: 0 additions & 1 deletion CRM/Contribute/BAO/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,6 @@ public static function create(&$params, $ids = []) {
'note' => $params['note'],
'entity_id' => $contribution->id,
'contact_id' => $session->get('userID'),
'modified_date' => date('Ymd'),
];
if (!$noteParams['contact_id']) {
$noteParams['contact_id'] = $params['contact_id'];
Expand Down
1 change: 0 additions & 1 deletion CRM/Contribute/Form/Contribution/Confirm.php
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,6 @@ public static function processFormContribution(
'note' => $params['contribution_note'],
'entity_id' => $contribution->id,
'contact_id' => $contribution->contact_id,
'modified_date' => date('Ymd'),
];

CRM_Core_BAO_Note::add($noteParams, []);
Expand Down
4 changes: 0 additions & 4 deletions CRM/Core/BAO/Note.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,6 @@ public static function add(&$params, $ids = array()) {

$note = new CRM_Core_BAO_Note();

if (!isset($params['modified_date'])) {
$params['modified_date'] = date("Ymd");
}

if (!isset($params['privacy'])) {
$params['privacy'] = 0;
}
Expand Down
7 changes: 4 additions & 3 deletions CRM/Core/DAO/Note.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Generated from xml/schema/CRM/Core/Note.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:1a545c1e601969ae689d9577a3c14389)
* (GenCodeChecksum:7a58bb39022811ac55bfaed58c241487)
*/

/**
Expand Down Expand Up @@ -66,7 +66,7 @@ class CRM_Core_DAO_Note extends CRM_Core_DAO {
/**
* When was this note last modified/edited
*
* @var date
* @var timestamp
*/
public $modified_date;

Expand Down Expand Up @@ -191,10 +191,11 @@ public static function &fields() {
],
'modified_date' => [
'name' => 'modified_date',
'type' => CRM_Utils_Type::T_DATE,
'type' => CRM_Utils_Type::T_TIMESTAMP,
'title' => ts('Note Modified By'),
'description' => ts('When was this note last modified/edited'),
'where' => 'civicrm_note.modified_date',
'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
'table_name' => 'civicrm_note',
'entity' => 'Note',
'bao' => 'CRM_Core_BAO_Note',
Expand Down
1 change: 0 additions & 1 deletion CRM/Event/BAO/Participant.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ public static function create(&$params) {
'note' => $noteValue,
'entity_id' => $participant->id,
'contact_id' => $id,
'modified_date' => date('Ymd'),
];
$noteIDs = [];
if ($noteId) {
Expand Down
1 change: 0 additions & 1 deletion CRM/Event/Form/ParticipantFeeSelection.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ public function postProcess() {
'note' => $params['note'],
'entity_id' => $this->_participantId,
'contact_id' => $this->_contactId,
'modified_date' => date('Ymd'),
];
CRM_Core_BAO_Note::add($noteParams);
}
Expand Down
1 change: 0 additions & 1 deletion CRM/Grant/BAO/Grant.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ public static function create(&$params, &$ids) {
'note' => $params['note'] = $params['note'] ? $params['note'] : "null",
'entity_id' => $grant->id,
'contact_id' => $id,
'modified_date' => date('Ymd'),
];

CRM_Core_BAO_Note::add($noteParams, (array) CRM_Utils_Array::value('note', $ids));
Expand Down
3 changes: 3 additions & 0 deletions CRM/Upgrade/Incremental/sql/5.24.alpha1.mysql.tpl
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
{* file to handle db changes in 5.24.alpha1 during upgrade *}

{* #16338 Convert civicrm_note.modified_date to timestamp *}
ALTER TABLE civicrm_note MODIFY COLUMN modified_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'When was this note last modified/edited';
3 changes: 2 additions & 1 deletion xml/schema/Core/Note.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@
<field>
<name>modified_date</name>
<title>Note Modified By</title>
<type>date</type>
<type>timestamp</type>
<comment>When was this note last modified/edited</comment>
<default>CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP</default>
<add>1.1</add>
</field>
<field>
Expand Down

0 comments on commit 5377e6c

Please sign in to comment.