From c1a6d6ac51345b0b0d0cd66139efd184ada7ead4 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Sun, 22 Apr 2018 17:29:05 +1000 Subject: [PATCH] dev/core#65 Fix issue where source for participant could be entered which is longer than allowable in the databse Update files to use metadata approach as per monish and Eileen --- CRM/Event/DAO/Participant.php | 5 ++++- CRM/Event/Form/Participant.php | 9 ++++++++- xml/schema/Event/Participant.xml | 3 +++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CRM/Event/DAO/Participant.php b/CRM/Event/DAO/Participant.php index 0b7a3c25ef..a25c71bb82 100644 --- a/CRM/Event/DAO/Participant.php +++ b/CRM/Event/DAO/Participant.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Event/Participant.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:444d0ee69773ce242341f8544e192087) + * (GenCodeChecksum:2fe76154a50c0317faace43c47c3456a) */ /** @@ -333,6 +333,9 @@ class CRM_Event_DAO_Participant extends CRM_Core_DAO { 'entity' => 'Participant', 'bao' => 'CRM_Event_BAO_Participant', 'localizable' => 0, + 'html' => [ + 'type' => 'Text', + ], ], 'participant_fee_level' => [ 'name' => 'fee_level', diff --git a/CRM/Event/Form/Participant.php b/CRM/Event/Form/Participant.php index 342ed6c674..0de0114de4 100644 --- a/CRM/Event/Form/Participant.php +++ b/CRM/Event/Form/Participant.php @@ -202,6 +202,13 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment return 'Participant'; } + /** + * Default form context used as part of addField() + */ + public function getDefaultContext() { + return 'create'; + } + /** * Set variables up before form is built. * @@ -733,7 +740,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment $this->addElement('checkbox', 'is_notify', ts('Send Notification'), NULL); - $this->add('text', 'source', ts('Event Source')); + $this->addField('source', array('entity' => 'Participant', 'name' => 'source')); $noteAttributes = CRM_Core_DAO::getAttribute('CRM_Core_DAO_Note'); $this->add('textarea', 'note', ts('Notes'), $noteAttributes['note']); diff --git a/xml/schema/Event/Participant.xml b/xml/schema/Event/Participant.xml index 5d341014f2..30f9a31720 100644 --- a/xml/schema/Event/Participant.xml +++ b/xml/schema/Event/Participant.xml @@ -135,6 +135,9 @@ varchar 128 Source of this event registration. + + Text + 1.7 -- 2.25.1