From 8ad23a073215ad851ec4f7e4ab9b74808d7426a6 Mon Sep 17 00:00:00 2001 From: colemanw Date: Sat, 23 Sep 2023 18:44:23 -0400 Subject: [PATCH] ContactSummary - Delete code for old contact notes tab Tab has been replaced by SearchKit. --- CRM/Contact/BAO/Contact.php | 4 +- CRM/Contact/Page/View/Note.php | 311 ------------------ CRM/Contact/Page/View/Summary.php | 7 - CRM/Core/BAO/Note.php | 15 +- CRM/Core/DAO/Note.php | 14 +- CRM/Core/xml/Menu/Contact.xml | 6 - CRM/Core/xml/Menu/Misc.xml | 5 + CRM/Note/Form/Note.php | 37 +-- api/v3/Note.php | 11 +- templates/CRM/Contact/Page/View/Note.tpl | 256 -------------- templates/CRM/Note/Form/Note.tpl | 46 ++- .../CRM/Contact/Page/View/NoteTest.php | 47 --- xml/schema/Core/Note.xml | 6 + 13 files changed, 95 insertions(+), 670 deletions(-) delete mode 100644 CRM/Contact/Page/View/Note.php delete mode 100644 templates/CRM/Contact/Page/View/Note.tpl delete mode 100644 tests/phpunit/CRM/Contact/Page/View/NoteTest.php diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php index b9b83e95d8..634670b32a 100644 --- a/CRM/Contact/BAO/Contact.php +++ b/CRM/Contact/BAO/Contact.php @@ -2925,8 +2925,8 @@ LEFT JOIN civicrm_email ON ( civicrm_contact.id = civicrm_email.contact_id ) 'key' => 'note', 'tab' => 'note', 'class' => 'medium-popup', - 'href' => CRM_Utils_System::url('civicrm/contact/view/note', - 'reset=1&action=add' + 'href' => CRM_Utils_System::url('civicrm/note', + 'reset=1&action=add&entity_table=civicrm_contact&entity_id=' . $contactId ), 'permissions' => ['edit all contacts'], ], diff --git a/CRM/Contact/Page/View/Note.php b/CRM/Contact/Page/View/Note.php deleted file mode 100644 index 8375a27606..0000000000 --- a/CRM/Contact/Page/View/Note.php +++ /dev/null @@ -1,311 +0,0 @@ -addSelect('*', 'privacy:label') - ->addWhere('id', '=', $this->_id) - ->execute() - ->single(); - $note['privacy'] = $note['privacy:label']; - $this->assign('note', $note); - - $comments = CRM_Core_BAO_Note::getNoteTree($this->_id, 1); - $this->assign('comments', $comments); - - // add attachments part - $currentAttachmentInfo = CRM_Core_BAO_File::getEntityFile('civicrm_note', $this->_id); - $this->assign('currentAttachmentInfo', $currentAttachmentInfo); - - } - - /** - * called when action is browse. - */ - public function browse(): void { - $note = new CRM_Core_DAO_Note(); - $note->entity_table = 'civicrm_contact'; - $note->entity_id = $this->getContactID(); - - $note->orderBy('modified_date desc'); - - //CRM-4418, handling edit and delete separately. - $permissions = [$this->_permission]; - if ($this->_permission == CRM_Core_Permission::EDIT) { - //previously delete was subset of edit - //so for consistency lets grant delete also. - $permissions[] = CRM_Core_Permission::DELETE; - } - $mask = CRM_Core_Action::mask($permissions); - - $this->assign('canAddNotes', CRM_Core_Permission::check('add contact notes')); - - $links = self::links(); - $action = array_sum(array_keys($links)) & $mask; - - $note->find(); - while ($note->fetch()) { - if (!CRM_Core_BAO_Note::getNotePrivacyHidden($note)) { - CRM_Core_DAO::storeValues($note, $this->values[$note->id]); - - $this->values[$note->id]['action'] = CRM_Core_Action::formLink($links, - $action, - [ - 'id' => $note->id, - 'cid' => $this->getContactID(), - ], - ts('more'), - FALSE, - 'note.selector.row', - 'Note', - $note->id - ); - if (!empty($note->contact_id)) { - $contact = new CRM_Contact_DAO_Contact(); - $contact->id = $note->contact_id; - $contact->find(); - $contact->fetch(); - $this->values[$note->id]['createdBy'] = $contact->display_name; - } - $this->values[$note->id]['comment_count'] = CRM_Core_BAO_Note::getChildCount($note->id); - - // paper icon view for attachments part - $paperIconAttachmentInfo = CRM_Core_BAO_File::paperIconAttachment('civicrm_note', $note->id); - $this->values[$note->id]['attachment'] = $paperIconAttachmentInfo; - } - } - $this->assign('notes', $this->values); - - $commentLinks = self::commentLinks(); - - $action = array_sum(array_keys($commentLinks)) & $mask; - - $commentAction = CRM_Core_Action::formLink($commentLinks, - $action, - [ - 'id' => $note->id, - 'pid' => $note->entity_id, - 'cid' => $note->entity_id, - ], - ts('more'), - FALSE, - 'note.comment.action', - 'Note', - $note->id - ); - $this->assign('commentAction', $commentAction); - - $this->ajaxResponse['tabCount'] = CRM_Contact_BAO_Contact::getCountComponent('note', $this->getContactID()); - } - - /** - * called when action is update or new. - */ - public function edit() { - $controller = new CRM_Core_Controller_Simple('CRM_Note_Form_Note', ts('Contact Notes'), $this->_action); - $controller->setEmbedded(TRUE); - - // set the userContext stack - $session = CRM_Core_Session::singleton(); - $contactID = $this->getContactID(); - $url = CRM_Utils_System::url('civicrm/contact/view', - 'action=browse&selectedChild=note&cid=' . $contactID - ); - $session->pushUserContext($url); - - if (CRM_Utils_Request::retrieve('confirmed', 'Boolean')) { - $this->delete(); - CRM_Utils_System::redirect($url); - } - - $controller->reset(); - $controller->set('entityTable', 'civicrm_contact'); - $controller->set('entityId', $this->_contactId); - $controller->set('id', $this->_id); - - $controller->process(); - $controller->run(); - } - - public function preProcess() { - $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this); - - if ($this->_id && CRM_Core_BAO_Note::getNotePrivacyHidden($this->_id)) { - CRM_Core_Error::statusBounce(ts('You do not have access to this note.')); - } - - $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE); - $this->assign('contactId', $this->_contactId); - - // check logged in url permission - CRM_Contact_Page_View::checkUserPermission($this); - - $displayName = CRM_Contact_BAO_Contact::displayName($this->_contactId); - CRM_Utils_System::setTitle(ts('Notes for') . ' ' . $displayName); - - $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse'); - $this->assign('action', $this->_action); - } - - /** - * the main function that is called when the page loads, - * it decides the which action has to be taken for the page. - * - * @return null - */ - public function run() { - $this->preProcess(); - - if ($this->_action & CRM_Core_Action::VIEW) { - $this->view(); - } - elseif ($this->_action & CRM_Core_Action::ADD) { - if ( - $this->_permission != CRM_Core_Permission::EDIT && - !CRM_Core_Permission::check('add contact notes') - ) { - CRM_Core_Error::statusBounce(ts('You do not have access to add notes.')); - } - - $this->edit(); - } - elseif ($this->_action & CRM_Core_Action::UPDATE) { - if ($this->_permission != CRM_Core_Permission::EDIT) { - CRM_Core_Error::statusBounce(ts('You do not have access to edit this note.')); - } - - $this->edit(); - } - elseif ($this->_action & CRM_Core_Action::DELETE) { - if ($this->_permission != CRM_Core_Permission::EDIT) { - CRM_Core_Error::statusBounce(ts('You do not have access to delete this note.')); - } - // we use the edit screen the confirm the delete - $this->edit(); - } - - $this->browse(); - return parent::run(); - } - - /** - * Delete the note object from the db and set a status msg. - */ - public function delete() { - CRM_Core_BAO_Note::deleteRecord(['id' => $this->_id]); - $status = ts('Selected Note has been deleted successfully.'); - CRM_Core_Session::setStatus($status, ts('Deleted'), 'success'); - } - - /** - * Get action links. - * - * @return array[] - */ - public static function links() { - return [ - CRM_Core_Action::VIEW => [ - 'name' => ts('View'), - 'url' => 'civicrm/contact/view/note', - 'qs' => 'action=view&reset=1&cid=%%cid%%&id=%%id%%&selectedChild=note', - 'title' => ts('View Note'), - 'weight' => -20, - ], - CRM_Core_Action::UPDATE => [ - 'name' => ts('Edit'), - 'url' => 'civicrm/contact/view/note', - 'qs' => 'action=update&reset=1&cid=%%cid%%&id=%%id%%&selectedChild=note', - 'title' => ts('Edit Note'), - 'weight' => -10, - ], - CRM_Core_Action::ADD => [ - 'name' => ts('Comment'), - 'url' => 'civicrm/contact/view/note', - 'qs' => 'action=add&reset=1&cid=%%cid%%&parentId=%%id%%&selectedChild=note', - 'title' => ts('Add Comment'), - 'weight' => -5, - ], - CRM_Core_Action::DELETE => [ - 'name' => ts('Delete'), - 'url' => 'civicrm/contact/view/note', - 'qs' => 'action=delete&reset=1&cid=%%cid%%&id=%%id%%&selectedChild=note', - 'title' => ts('Delete Note'), - 'weight' => 100, - ], - ]; - } - - /** - * Get action links for comments. - * - * @return array[] - */ - public static function commentLinks(): array { - return [ - CRM_Core_Action::VIEW => [ - 'name' => ts('View'), - 'url' => 'civicrm/contact/view/note', - 'qs' => 'action=view&reset=1&cid=%%cid%%&id={id}&selectedChild=note', - 'title' => ts('View Comment'), - 'weight' => -20, - ], - CRM_Core_Action::UPDATE => [ - 'name' => ts('Edit'), - 'url' => 'civicrm/contact/view/note', - 'qs' => 'action=update&reset=1&cid=%%cid%%&id={id}&parentId=%%pid%%&selectedChild=note', - 'title' => ts('Edit Comment'), - 'weight' => -10, - ], - CRM_Core_Action::DELETE => [ - 'name' => ts('Delete'), - 'url' => 'civicrm/contact/view/note', - 'qs' => 'action=delete&reset=1&cid=%%cid%%&id={id}&selectedChild=note', - 'title' => ts('Delete Comment'), - 'weight' => 100, - ], - ]; - } - - /** - * Get the relevant contact ID. - * - * @api supported to be accessed from outside of core. - * - * @return int - * - * @noinspection PhpUnhandledExceptionInspection - * @noinspection PhpDocMissingThrowsInspection - */ - public function getContactID(): int { - return (int) CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE); - } - -} diff --git a/CRM/Contact/Page/View/Summary.php b/CRM/Contact/Page/View/Summary.php index 585bf193fc..e690767acc 100644 --- a/CRM/Contact/Page/View/Summary.php +++ b/CRM/Contact/Page/View/Summary.php @@ -318,13 +318,6 @@ class CRM_Contact_Page_View_Summary extends CRM_Contact_Page_View { 'weight' => 90, 'icon' => 'crm-i fa-users', ], - [ - 'id' => 'note', - 'title' => ts('Notes'), - 'class' => 'livePage', - 'weight' => 100, - 'icon' => 'crm-i fa-sticky-note-o', - ], [ 'id' => 'tag', 'title' => ts('Tags'), diff --git a/CRM/Core/BAO/Note.php b/CRM/Core/BAO/Note.php index 46e7a9052c..f1e54f06f7 100644 --- a/CRM/Core/BAO/Note.php +++ b/CRM/Core/BAO/Note.php @@ -171,19 +171,19 @@ class CRM_Core_BAO_Note extends CRM_Core_DAO_Note implements \Civi\Core\HookInte $recentOther = []; if ($noteActions) { $recentOther = [ - 'editUrl' => CRM_Utils_System::url('civicrm/contact/view/note', - "reset=1&action=update&cid={$note->entity_id}&id={$note->id}&context=home" + 'editUrl' => CRM_Utils_System::url('civicrm/note', + "reset=1&action=update&id={$note->id}&context=home" ), - 'deleteUrl' => CRM_Utils_System::url('civicrm/contact/view/note', - "reset=1&action=delete&cid={$note->entity_id}&id={$note->id}&context=home" + 'deleteUrl' => CRM_Utils_System::url('civicrm/note', + "reset=1&action=delete&id={$note->id}&context=home" ), ]; } // add the recently created Note CRM_Utils_Recent::add($displayName . ' - ' . $note->subject, - CRM_Utils_System::url('civicrm/contact/view/note', - "reset=1&action=view&cid={$note->entity_id}&id={$note->id}&context=home" + CRM_Utils_System::url('civicrm/note', + "reset=1&action=view&id={$note->id}&context=home" ), $note->id, 'Note', @@ -376,7 +376,7 @@ ORDER BY modified_date desc"; * * @return array * Nested associative array beginning with direct children of given note. - * + * @deprecated only called by deprecated APIv3 */ public static function getNoteTree($parentId, $maxDepth = 0, $snippet = FALSE) { return self::buildNoteTree($parentId, $maxDepth, $snippet); @@ -422,6 +422,7 @@ ORDER BY modified_date desc"; * * @return array * Nested associative array beginning with direct children of given note. + * @deprecated only called by deprecated APIv3 */ private static function buildNoteTree($parentId, $maxDepth = 0, $snippet = FALSE, &$tree = [], $depth = 0) { if ($maxDepth && $depth > $maxDepth) { diff --git a/CRM/Core/DAO/Note.php b/CRM/Core/DAO/Note.php index dff8197327..5fa11086ca 100644 --- a/CRM/Core/DAO/Note.php +++ b/CRM/Core/DAO/Note.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/Note.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:c04c2c1404af638e1adf973fe845d0ac) + * (GenCodeChecksum:9036c8c92bb1abbbd67b08f5c06f7ea3) */ /** @@ -37,6 +37,18 @@ class CRM_Core_DAO_Note extends CRM_Core_DAO { */ public static $_log = TRUE; + /** + * Paths for accessing this entity in the UI. + * + * @var string[] + */ + protected static $_paths = [ + 'add' => 'civicrm/note?reset=1&action=add&entity_table=[entity_table]&entity_id=[entity_id]', + 'view' => 'civicrm/note?reset=1&action=view&id=[id]', + 'update' => 'civicrm/note?reset=1&action=update&id=[id]', + 'delete' => 'civicrm/note?reset=1&action=delete&id=[id]', + ]; + /** * Note ID * diff --git a/CRM/Core/xml/Menu/Contact.xml b/CRM/Core/xml/Menu/Contact.xml index ed81f2bc82..adae098257 100644 --- a/CRM/Core/xml/Menu/Contact.xml +++ b/CRM/Core/xml/Menu/Contact.xml @@ -176,12 +176,6 @@ Smart Groups CRM_Contact_Page_View_ContactSmartGroup - - civicrm/contact/view/note - cid=%%cid%% - Notes - CRM_Contact_Page_View_Note - civicrm/contact/view/tag cid=%%cid%% diff --git a/CRM/Core/xml/Menu/Misc.xml b/CRM/Core/xml/Menu/Misc.xml index 222e7ece8f..396e13c6b4 100644 --- a/CRM/Core/xml/Menu/Misc.xml +++ b/CRM/Core/xml/Menu/Misc.xml @@ -286,4 +286,9 @@ CRM_Activity_Form_Activity access CiviCRM + + civicrm/note + CRM_Note_Form_Note + access CiviCRM + diff --git a/CRM/Note/Form/Note.php b/CRM/Note/Form/Note.php index 33addb0e37..cd86161e69 100644 --- a/CRM/Note/Form/Note.php +++ b/CRM/Note/Form/Note.php @@ -41,26 +41,15 @@ class CRM_Note_Form_Note extends CRM_Core_Form { */ protected $_entityId; - /** - * The parent note id, used when adding a comment to a note - * - * @var int - */ - protected $_parentId; - public function preProcess() { - $this->_entityTable = $this->get('entityTable'); - $this->_entityId = $this->get('entityId'); - $this->_id = $this->get('id'); - $this->_parentId = CRM_Utils_Array::value('parentId', $_GET, 0); - if ($this->_parentId) { - $this->assign('parentId', $this->_parentId); - } + $this->_id = CRM_Utils_Request::retrieve('id', 'Integer', $this); + $this->_entityTable = CRM_Utils_Request::retrieve('entity_table', 'String', $this); + $this->_entityId = CRM_Utils_Request::retrieve('entity_id', 'Integer', $this); if ($this->_id && CRM_Core_BAO_Note::getNotePrivacyHidden($this->_id)) { CRM_Core_Error::statusBounce(ts('You do not have access to this note.')); } - $this->setPageTitle($this->_parentId ? ts('Comment') : ts('Note')); + $this->setPageTitle($this->_entityTable === 'civicrm_note' ? ts('Comment') : ts('Note')); } /** @@ -78,15 +67,11 @@ class CRM_Note_Form_Note extends CRM_Core_Form { $params['id'] = $this->_id; CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_Note', $params, $defaults); } - if ($defaults['entity_table'] == 'civicrm_note') { - $defaults['parent_id'] = $defaults['entity_id']; - } } elseif ($this->_action & CRM_Core_Action::ADD) { $defaults['note_date'] = date('Y-m-d H:i:s'); - if ($this->_parentId) { - $defaults['parent_id'] = $this->_parentId; - $defaults['subject'] = 'Re: ' . CRM_Core_BAO_Note::getNoteSubject($this->_parentId); + if ($this->_entityTable === 'civicrm_note') { + $defaults['subject'] = ts('Re: %1', [1 => CRM_Core_BAO_Note::getNoteSubject($this->_entityId)]); } } return $defaults; @@ -131,7 +116,6 @@ class CRM_Note_Form_Note extends CRM_Core_Form { $this->addField('note_date', [], TRUE, FALSE); $this->addField('note', [], TRUE); $this->addField('privacy'); - $this->add('hidden', 'parent_id'); // add attachments part CRM_Core_BAO_File::buildAttachment($this, 'civicrm_note', $this->_id, NULL, TRUE); @@ -161,11 +145,7 @@ class CRM_Note_Form_Note extends CRM_Core_Form { $session = CRM_Core_Session::singleton(); $params['contact_id'] = $session->get('userID'); - if (!empty($params['parent_id'])) { - $params['entity_table'] = 'civicrm_note'; - $params['entity_id'] = $params['parent_id']; - } - else { + if ($this->_action & CRM_Core_Action::ADD) { $params['entity_table'] = $this->_entityTable; $params['entity_id'] = $this->_entityId; } @@ -185,8 +165,7 @@ class CRM_Note_Form_Note extends CRM_Core_Form { // add attachments as needed CRM_Core_BAO_File::formatAttachment($params, $params, 'civicrm_note', $params['id']); - $ids = []; - $note = CRM_Core_BAO_Note::add($params, $ids); + $note = CRM_Core_BAO_Note::add($params); // Required for postProcess hooks $this->setEntityId($note->id); diff --git a/api/v3/Note.php b/api/v3/Note.php index e1866d1196..c8e1493e88 100644 --- a/api/v3/Note.php +++ b/api/v3/Note.php @@ -92,7 +92,7 @@ function _civicrm_api3_note_get_spec(&$params) { * * @param array $params * array; only required 'id' parameter is used. - * + * @deprecated * @return array * Nested associative array beginning with direct children of given note. */ @@ -111,3 +111,12 @@ function civicrm_api3_note_tree_get($params) { $noteTree = CRM_Core_BAO_Note::getNoteTree($params['id'], $params['max_depth'], $params['snippet']); return civicrm_api3_create_success($noteTree, $params); } + +/** + * Declare deprecated api functions. + * + * @return array + */ +function _civicrm_api3_note_deprecation() { + return ['tree_get' => 'Unused api action.']; +} diff --git a/templates/CRM/Contact/Page/View/Note.tpl b/templates/CRM/Contact/Page/View/Note.tpl deleted file mode 100644 index e817001265..0000000000 --- a/templates/CRM/Contact/Page/View/Note.tpl +++ /dev/null @@ -1,256 +0,0 @@ -{* - +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC. All rights reserved. | - | | - | This work is published under the GNU AGPLv3 license with some | - | permitted exceptions and without any warranty. For full license | - | and copyright information, see https://civicrm.org/licensing | - +--------------------------------------------------------------------+ -*} -
-{if $action eq 4}{* when action is view *} - {if $notes} -
- - - - - - - - {if $currentAttachmentInfo} - {include file="CRM/Form/attachment.tpl"} - {/if} -
{ts}Subject{/ts}{$note.subject}
{ts}Date:{/ts}{$note.note_date|crmDate}
{ts}Modified Date:{/ts}{$note.modified_date|crmDate}
{ts}Privacy:{/ts}{$note.privacy}
{ts}Note:{/ts}{$note.note|nl2br}
-
- {crmButton class="cancel" icon="times" p='civicrm/contact/view' q="selectedChild=note&reset=1&cid=`$contactId`"}{ts}Done{/ts}{/crmButton} -
- - {if $comments} -
- {ts}Comments{/ts} - - - - - {foreach from=$comments item=comment} - - {/foreach} -
{ts}Comment{/ts}{ts}Created By{/ts}{ts}Date{/ts}{ts}Modified Date{/ts}
{$comment.note}{$comment.createdBy}{$comment.note_date}{$comment.modified_date}
-
- {/if} - -
- {/if} -{elseif $action eq 1 or $action eq 2} {* action is add or update *} -
- - - - - - - - - - - - - - - - - - - - -
{$form.subject.label} - {$form.subject.html} -
{$form.note_date.label}{$form.note_date.html}
{$form.privacy.label} - {$form.privacy.html} -
{$form.note.label} - {$form.note.html} -
- {include file="CRM/Form/attachment.tpl"} -
- -
-
{include file="CRM/common/formButtons.tpl" location="bottom"}
-
-
-
-{/if} -{if ($action eq 8)} -
{ts 1=$notes.$id.note}Are you sure you want to delete the note '%1'?{/ts}
-
{include file="CRM/common/formButtons.tpl" location=''}
- -{/if} - -{if ($permission EQ 'edit' OR $canAddNotes) AND ($action eq 16)} - -
-{/if} -
- -{if $notes and $action eq 16} - - - -
-{* show browse table for any action *} -
- {strip} - - - - - - - - - - - - - - - {foreach from=$notes item=note} - - - - - - - - - - - {/foreach} -
{ts}Note{/ts}{ts}Subject{/ts}{ts}Date{/ts}{ts}Modified Date{/ts}{ts}Created By{/ts}{ts}Attachment(s){/ts}
- {if $note.comment_count} - - - - - - {else} - - {/if} - - {$note.note|mb_truncate:80:"...":false|nl2br} - {* Include '(more)' link to view entire note if it has been truncated *} - {assign var="noteSize" value=$note.note|crmCountCharacters:true} - {if $noteSize GT 80} - {ts}(more){/ts} - {/if} - {$note.subject}{$note.note_date|crmDate}{$note.modified_date|crmDate} - {$note.createdBy} - - {foreach from=$note.attachment item=fileinfo} - {$fileinfo} - {/foreach} - {$note.action|replace:'xx':$note.id}
- {/strip} -
-
-{elseif ($action eq 16)} -
- {icon icon="fa-info-circle"}{/icon} - {ts}There are no Notes for this contact.{/ts} -
-{/if} -
-
diff --git a/templates/CRM/Note/Form/Note.tpl b/templates/CRM/Note/Form/Note.tpl index 84de483b2d..d458d25a95 100644 --- a/templates/CRM/Note/Form/Note.tpl +++ b/templates/CRM/Note/Form/Note.tpl @@ -7,6 +7,46 @@ | and copyright information, see https://civicrm.org/licensing | +--------------------------------------------------------------------+ *} -{* This tpl is empty. Since notes is a simple form, the tpl is embedded within the parent tpl *} -{* This might change in the future *} -{include file="CRM/Contact/Page/View/Note.tpl"} +{* Delete action *} +{if ($action eq 8)} +
{ts}Are you sure you want to delete this note?{/ts}
+
{include file="CRM/common/formButtons.tpl" location=''}
+{* Create/Update actions *} +{else} +
+ + + + + + + + + + + + + + + + + + + + +
{$form.subject.label} + {$form.subject.html} +
{$form.note_date.label}{$form.note_date.html}
{$form.privacy.label} + {$form.privacy.html} +
{$form.note.label} + {$form.note.html} +
+ {include file="CRM/Form/attachment.tpl"} +
+ +
+
{include file="CRM/common/formButtons.tpl" location="bottom"}
+
+
+
+{/if} diff --git a/tests/phpunit/CRM/Contact/Page/View/NoteTest.php b/tests/phpunit/CRM/Contact/Page/View/NoteTest.php deleted file mode 100644 index 7b90d97000..0000000000 --- a/tests/phpunit/CRM/Contact/Page/View/NoteTest.php +++ /dev/null @@ -1,47 +0,0 @@ -individualCreate(); - foreach ([1, 2, 3, 4, 5] as $noteID) { - $note = new CRM_Core_DAO_Note(); - $note->entity_id = $contactID; - $note->subject = 'Test Note ' . $noteID; - $note->note = 'Test Note from Tests'; - $note->entity_table = 'civicrm_contact'; - if ($noteID === 5) { - $note->contact_id = $contactID; - } - $note->save(); - } - $_REQUEST['cid'] = $contactID; - $page = new CRM_Contact_Page_View_Note(); - $page->_permission = CRM_Core_Permission::EDIT; - $page->browse(); - $this->assertCount(5, $page->values); - foreach ($page->values as $note) { - $this->assertEquals($note['entity_id'], $contactID); - if ((int) $note['id'] === 5) { - $this->assertEquals('Mr. Anthony Anderson II', $note['createdBy']); - } - } - } - -} diff --git a/xml/schema/Core/Note.xml b/xml/schema/Core/Note.xml index 66ac6f2342..8846769b73 100644 --- a/xml/schema/Core/Note.xml +++ b/xml/schema/Core/Note.xml @@ -8,6 +8,12 @@ 1.1 true fa-sticky-note + + civicrm/note?reset=1&action=add&entity_table=[entity_table]&entity_id=[entity_id] + civicrm/note?reset=1&action=view&id=[id] + civicrm/note?reset=1&action=update&id=[id] + civicrm/note?reset=1&action=delete&id=[id] + id Note ID -- 2.25.1