From bcb8cc8406b794a3f71688858b28b943df544e9e Mon Sep 17 00:00:00 2001 From: monishdeb Date: Fri, 4 Sep 2015 10:38:47 +0530 Subject: [PATCH] refactoring phase1 --- CRM/Contact/Form/ProfileContact.php | 348 ++++-------------- CRM/Contribute/Form/Contribution/Main.php | 11 +- CRM/Contribute/Form/ContributionBase.php | 123 +++++++ CRM/Core/xml/Menu/Contact.xml | 7 + templates/CRM/Contact/Form/ProfileContact.tpl | 195 ++++++++++ .../CRM/Contribute/Form/Contribution/Main.tpl | 23 +- .../Form/Contribution/OnBehalfOf.tpl | 231 ------------ 7 files changed, 406 insertions(+), 532 deletions(-) create mode 100644 templates/CRM/Contact/Form/ProfileContact.tpl delete mode 100644 templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl diff --git a/CRM/Contact/Form/ProfileContact.php b/CRM/Contact/Form/ProfileContact.php index 59b9d279fd..5fc1a7eb78 100644 --- a/CRM/Contact/Form/ProfileContact.php +++ b/CRM/Contact/Form/ProfileContact.php @@ -30,181 +30,26 @@ * @package CRM * @copyright CiviCRM LLC (c) 2004-2015 */ -class CRM_Contact_Form_ProfileContact { +class CRM_Contact_Form_ProfileContact extends CRM_Core_Form { - protected $_mode; + protected $_profileId; + + protected $_prefix; /** * Set variables up before form is built. * * @param CRM_Core_Form $form */ - public static function preProcess(&$form) { - $contactID = $form->_contactID; - - foreach (array('soft_credit', 'on_behalf') as $module) { - $ufJoinParams = array( - 'module' => $module, - 'entity_table' => 'civicrm_contribution_page', - 'entity_id' => $form->_id, - ); - - $ufJoin = new CRM_Core_DAO_UFJoin(); - $ufJoin->copyValues($ufJoinParams); - $ufJoin->find(TRUE); - if (!$ufJoin->is_active) { - continue; - } - - if ($module == 'soft_credit') { - $form->_honoreeProfileId = $ufJoin->uf_group_id; - $form->_honor_block_is_active = $ufJoin->is_active; - - if (!$form->_honoreeProfileId || - !CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $form->_honoreeProfileId, 'is_active') - ) { - CRM_Core_Error::fatal(ts('This contribution page has been configured for contribution on behalf of honoree and the selected honoree profile is either disabled or not found.')); - } - - $profileContactType = CRM_Core_BAO_UFGroup::getContactType($form->_honoreeProfileId); - $requiredProfileFields = array( - 'Individual' => array('first_name', 'last_name'), - 'Organization' => array('organization_name', 'email'), - 'Household' => array('household_name', 'email'), - ); - $validProfile = CRM_Core_BAO_UFGroup::checkValidProfile($form->_honoreeProfileId, $requiredProfileFields[$profileContactType]); - if (!$validProfile) { - CRM_Core_Error::fatal(ts('This contribution page has been configured for contribution on behalf of honoree and the required fields of the selected honoree profile are disabled or doesn\'t exist.')); - } - } - else { - $form->_onbehalf = FALSE; - $params = CRM_Contribute_BAO_ContributionPage::formatModuleData($ufJoin->module_data, TRUE, 'on_behalf'); - $form->_values = array_merge($params, $form->_values); - if (CRM_Utils_Array::value('is_for_organization', $params)) { - if ($params['is_for_organization'] == 2) { - $form->_onBehalfRequired = TRUE; - } - // Add organization profile if 1 of the following are true: - // If the org profile is required - if ($form->_onBehalfRequired || - // Or we are building the form for the first time - empty($_POST) || - // Or the user has submitted the form and checked the "On Behalf" checkbox - !empty($_POST['is_for_organization']) - ) { - $form->_onbehalf = TRUE; - $form->_onBehalfProfileId = $ufJoin->uf_group_id; - - if (!$form->_onBehalfProfileId || - !CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $form->_onBehalfProfileId, 'is_active') - ) { - CRM_Core_Error::fatal(ts('This contribution page has been configured for contribution on behalf of an organization and the selected onbehalf profile is either disabled or not found.')); - } - - $requiredProfileFields = array('organization_name', 'email'); - $validProfile = CRM_Core_BAO_UFGroup::checkValidProfile($form->_onBehalfProfileId, $requiredProfileFields); - if (!$validProfile) { - CRM_Core_Error::fatal(ts('This contribution page has been configured for contribution on behalf of an organization and the required fields of the selected onbehalf profile are disabled.')); - } - - //CRM-5001,CRM-15787 - $member = CRM_Member_BAO_Membership::getMembershipBlock($form->_id); - if (empty($member['is_active'])) { - $msg = ts('Mixed profile not allowed for on behalf of registration/sign up.'); - $onBehalfProfile = CRM_Core_BAO_UFGroup::profileGroups($form->_onBehalfProfileId); - foreach (array( - 'Individual', - 'Organization', - 'Household', - ) as $contactType) { - if (in_array($contactType, $onBehalfProfile) && - (in_array('Membership', $onBehalfProfile) || - in_array('Contribution', $onBehalfProfile) - ) - ) { - CRM_Core_Error::fatal($msg); - } - } - - if ($postID = CRM_Utils_Array::value('custom_post_id', $form->_values)) { - $postProfile = CRM_Core_BAO_UFGroup::profileGroups($postID); - foreach (array( - 'Individual', - 'Organization', - 'Household', - ) as $contactType) { - if (in_array($contactType, $postProfile) && - (in_array('Membership', $postProfile) || - in_array('Contribution', $postProfile) - ) - ) { - CRM_Core_Error::fatal($msg); - } - } - } - } - - $form->assign('profileId', $form->_onBehalfProfileId); - $form->assign('mode', $form->_mode); - - if ($contactID) { - $form->_employers = CRM_Contact_BAO_Relationship::getPermissionedEmployer($contactID); - - if (!empty($form->_membershipContactID) && $contactID != $form->_membershipContactID) { - // renewal case - membership being renewed may or may not be for organization - if (!empty($form->_employers) && array_key_exists($form->_membershipContactID, $form->_employers)) { - // if _membershipContactID belongs to employers list, we can say: - $form->_relatedOrganizationFound = TRUE; - } - } - elseif (!empty($form->_employers)) { - // not a renewal case and _employers list is not empty - $form->_relatedOrganizationFound = TRUE; - } + public function preProcess() { + parent::preProcess(); - if ($form->_relatedOrganizationFound) { - // Related org url - pass checksum if needed - $args = array('cid' => ''); - if (!empty($_GET['cs'])) { - $args = array( - 'uid' => $form->_contactID, - 'cs' => $_GET['cs'], - 'cid' => '', - ); - } - $locDataURL = CRM_Utils_System::url('civicrm/ajax/permlocation', $args, FALSE, NULL, FALSE); - $form->assign('locDataURL', $locDataURL); + $this->_profileId = CRM_Utils_Request::retrieve('id', 'Positive', $this, NULL, FALSE, NULL, 'GET'); + $this->_prefix = CRM_Utils_Request::retrieve('prefix', 'String', $this, NULL, FALSE, NULL, 'GET'); - if (!empty($form->_submitValues['onbehalf'])) { - if (!empty($form->_submitValues['onbehalfof_id'])) { - $form->assign('submittedOnBehalf', $form->_submitValues['onbehalfof_id']); - } - $form->assign('submittedOnBehalfInfo', json_encode($form->_submitValues['onbehalf'])); - } - } - - if ($params['is_for_organization'] != 2) { - $form->assign('relatedOrganizationFound', $form->_relatedOrganizationFound); - } - else { - $form->assign('onBehalfRequired', $form->_onBehalfRequired); - } - - if (count($form->_employers) == 1) { - foreach ($form->_employers as $id => $value) { - $form->_organizationName = $value['name']; - $orgId = $id; - } - $form->assign('orgId', $orgId); - $form->assign('organizationName', $form->_organizationName); - } - } - } - } - $form->assign('onBehalfRequired', $form->_onBehalfRequired); - } - } + $this->assign('suppressForm', TRUE); + $this->assign('snippet', TRUE); + $this->controller->_generateQFKey = FALSE; } /** @@ -213,118 +58,81 @@ class CRM_Contact_Form_ProfileContact { * @param CRM_Core_Form $form * */ - public static function buildQuickForm(&$form) { - if (!empty($form->_honor_block_is_active)) { - self::buildHonorBlock($form); - } - - if (!empty($form->_onbehalf)) { - self::buildOnBehalfBlock($form); - } - } - - /** - * @param $form - */ - public static function postProcess($form) { - } - - public static function buildHonorBlock(&$form) { - $form->assign('honor_block_is_active', TRUE); + public function buildQuickForm() { + $contactID = $this->getContactID(); + + if ($this->_prefix == 'onbehalf') { + $this->assign('fieldSetTitle', ts('Organization Details')); + $this->assign('profileId', $this->_profileId); + + if ($contactID) { + $employer = CRM_Contact_BAO_Relationship::getPermissionedEmployer($contactID); + + if (count($employer)) { + // Related org url - pass checksum if needed + $args = array('cid' => ''); + if (!empty($_GET['cs'])) { + $args = array( + 'uid' => $this->_contactID, + 'cs' => $_GET['cs'], + 'cid' => '', + ); + } + $locDataURL = CRM_Utils_System::url('civicrm/ajax/permlocation', $args, FALSE, NULL, FALSE); + $this->assign('locDataURL', $locDataURL); + } + if (count($employer) > 1) { + $this->add('text', 'organization_id', ts('Select an existing related Organization OR enter a new one')); + $this->add('select', 'onbehalfof_id', '', CRM_Utils_Array::collect('name', $employer)); + + $orgOptions = array( + 0 => ts('Select an existing organization'), + 1 => ts('Enter a new organization'), + ); + $this->addRadio('org_option', ts('options'), $orgOptions); + $this->setDefaults(array('org_option' => 0)); + } + elseif (count($employer) == 1) { + foreach ($form->_employers as $id => $value) { + $form->assign('orgId', $id); + $form->assign('organizationName', $value['name']); + } + } + } - //build soft-credit section - CRM_Contribute_Form_SoftCredit::buildQuickForm($form); + $profileFields = CRM_Core_BAO_UFGroup::getFields($this->_profileId, FALSE, CRM_Core_Action::VIEW, NULL, + NULL, FALSE, NULL, FALSE, NULL, + CRM_Core_Permission::CREATE, NULL + ); + $this->assign('onBehalfOfFields', $profileFields); + $this->addElement('hidden', 'onbehalf_profile_id', $this->_profileId); + + $fieldTypes = array('Contact', 'Organization'); + $contactSubType = CRM_Contact_BAO_ContactType::subTypes('Organization'); + $fieldTypes = array_merge($fieldTypes, $contactSubType); + + foreach ($profileFields as $name => $field) { + if (in_array($field['field_type'], $fieldTypes)) { + list($prefixName, $index) = CRM_Utils_System::explode('-', $name, 2); + if (in_array($prefixName, array('organization_name', 'email')) && empty($field['is_required'])) { + $field['is_required'] = 1; + } - $ufGroup = new CRM_Core_DAO_UFGroup(); - $ufGroup->id = $form->_honoreeProfileId; - if (!$ufGroup->find(TRUE)) { - CRM_Core_Error::fatal(ts('Chosen honoree profile for this contribution is disabled')); + CRM_Core_BAO_UFGroup::buildProfile($this, $field, NULL, NULL, FALSE, $this->_prefix, NULL, $this->_prefix); + } + } } - $prefix = 'honor'; - $honoreeProfileFields = CRM_Core_BAO_UFGroup::getFields($form->_honoreeProfileId, FALSE, NULL, +/*$prefix = 'honor'; + + $honoreeProfileFields = CRM_Core_BAO_UFGroup::getFields(9, FALSE, NULL, NULL, NULL, FALSE, NULL, TRUE, NULL, CRM_Core_Permission::CREATE ); - $form->addElement('hidden', 'honoree_profile_id', $form->_honoreeProfileId); - $form->assign('honoreeProfileFields', $honoreeProfileFields); - - // add the form elements - foreach ($honoreeProfileFields as $name => $field) { - // If soft credit type is not chosen then make omit requiredness from honoree profile fields - if (count($form->_submitValues) && empty($form->_submitValues['soft_credit_type_id']) && !empty($field['is_required'])) { - $field['is_required'] = FALSE; - } - CRM_Core_BAO_UFGroup::buildProfile($form, $field, CRM_Profile_Form::MODE_CREATE, NULL, FALSE, FALSE, NULL, $prefix); - } - } - - public static function buildOnBehalfBlock(&$form) { - $form->assign('buildOnBehalfForm', TRUE); - $form->assign('fieldSetTitle', ts('Organization Details')); - - $contactID = $form->_contactID; - - if ($form->_membershipContactID) { - $entityBlock = array('contact_id' => $form->_membershipContactID); - //CRM_Core_BAO_Location::getValues($entityBlock, $form->_defaults); - } - - if (!$form->_onBehalfRequired) { - $form->addElement('checkbox', 'is_for_organization', - $form->_values['for_organization'], - NULL, array('onclick' => "showOnBehalf( );") - ); - } - - $form->assign('is_for_organization', TRUE); - $form->assign('urlPath', 'civicrm/contribute/transact'); - - if ($contactID && count($form->_employers) >= 1) { - $form->add('text', 'organization_id', ts('Select an existing related Organization OR enter a new one')); - - $form->add('select', 'onbehalfof_id', '', CRM_Utils_Array::collect('name', $form->_employers)); - - $orgOptions = array( - 0 => ts('Select an existing organization'), - 1 => ts('Enter a new organization'), - ); - - $form->addRadio('org_option', ts('options'), $orgOptions); - $form->setDefaults(array('org_option' => 0)); - $form->add('checkbox', 'mode', ''); - } - - $prefix = 'onbehalf'; - $profileFields = CRM_Core_BAO_UFGroup::getFields($form->_onBehalfProfileId, FALSE, CRM_Core_Action::VIEW, NULL, - NULL, FALSE, NULL, FALSE, NULL, - CRM_Core_Permission::CREATE, NULL - ); - $fieldTypes = array('Contact', 'Organization'); - $contactSubType = CRM_Contact_BAO_ContactType::subTypes('Organization'); - $fieldTypes = array_merge($fieldTypes, $contactSubType); - - if (is_array($form->_membershipBlock) && !empty($form->_membershipBlock)) { - $fieldTypes = array_merge($fieldTypes, array('Membership')); - } - else { - $fieldTypes = array_merge($fieldTypes, array('Contribution')); - } - - foreach ($profileFields as $name => $field) { - if (in_array($field['field_type'], $fieldTypes)) { - list($prefixName, $index) = CRM_Utils_System::explode('-', $name, 2); - if (in_array($prefixName, array('organization_name', 'email')) && empty($field['is_required'])) { - $field['is_required'] = 1; - } - - CRM_Core_BAO_UFGroup::buildProfile($form, $field, NULL, NULL, FALSE, $prefix, NULL, $prefix); - } - } - - $form->assign('onBehalfOfFields', $profileFields); - $form->addElement('hidden', 'onbehalf_profile_id', $form->_onBehalfProfileId); + $this->addElement('hidden', 'honoree_profile_id', 9); + $this->assign('honoreeProfileFields', $honoreeProfileFields); +*/ } } diff --git a/CRM/Contribute/Form/Contribution/Main.php b/CRM/Contribute/Form/Contribution/Main.php index 1f32a03635..ce7a0d5ef9 100644 --- a/CRM/Contribute/Form/Contribution/Main.php +++ b/CRM/Contribute/Form/Contribution/Main.php @@ -78,13 +78,6 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $this->assign('mainDisplay', CRM_Utils_Request::retrieve('_qf_Main_display', 'Boolean', CRM_Core_DAO::$_nullObject)); - CRM_Contact_Form_ProfileContact::preprocess($this); - - if ($this->_snippet) { - $this->assign('isOnBehalfCallback', CRM_Utils_Array::value('onbehalf', $_GET, FALSE)); - return; - } - if (!empty($this->_pcpInfo['id']) && !empty($this->_pcpInfo['intro_text'])) { $this->assign('intro_text', $this->_pcpInfo['intro_text']); } @@ -293,6 +286,8 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $this->buildCustom($this->_values['custom_pre_id'], 'customPre'); $this->buildCustom($this->_values['custom_post_id'], 'customPost'); + $this->buildComponentForm($this->_id, $this); + if (!empty($this->_fields) && !empty($this->_values['custom_pre_id'])) { $profileAddressFields = array(); foreach ($this->_fields as $key => $value) { @@ -314,8 +309,6 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $this->assign('display_name', CRM_Contact_BAO_Contact::displayName($contactID)); } - CRM_Contact_Form_ProfileContact::buildQuickForm($this); - // Return if we are in an ajax callback if ($this->_onbehalf && $this->_snippet) { return; diff --git a/CRM/Contribute/Form/ContributionBase.php b/CRM/Contribute/Form/ContributionBase.php index e4db6f63fc..6f6e2bd0bd 100644 --- a/CRM/Contribute/Form/ContributionBase.php +++ b/CRM/Contribute/Form/ContributionBase.php @@ -710,6 +710,129 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { } } + + public function buildComponentForm($id, $form) { + if (empty($id)) { + return; + } + + $contactID = $this->getContactID(); + + foreach (array('soft_credit', 'on_behalf') as $module) { + $ufJoinParams = array( + 'module' => $module, + 'entity_table' => 'civicrm_contribution_page', + 'entity_id' => $id, + ); + + $ufJoin = new CRM_Core_DAO_UFJoin(); + $ufJoin->copyValues($ufJoinParams); + $ufJoin->find(TRUE); + if (!$ufJoin->is_active) { + continue; + } + + if ($module == 'soft_credit') { + $form->_honoreeProfileId = $ufJoin->uf_group_id; + $form->_honor_block_is_active = $ufJoin->is_active; + + if (!$form->_honoreeProfileId || + !CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $form->_honoreeProfileId, 'is_active') + ) { + CRM_Core_Error::fatal(ts('This contribution page has been configured for contribution on behalf of honoree and the selected honoree profile is either disabled or not found.')); + } + + $profileContactType = CRM_Core_BAO_UFGroup::getContactType($form->_honoreeProfileId); + $requiredProfileFields = array( + 'Individual' => array('first_name', 'last_name'), + 'Organization' => array('organization_name', 'email'), + 'Household' => array('household_name', 'email'), + ); + $validProfile = CRM_Core_BAO_UFGroup::checkValidProfile($form->_honoreeProfileId, $requiredProfileFields[$profileContactType]); + if (!$validProfile) { + CRM_Core_Error::fatal(ts('This contribution page has been configured for contribution on behalf of honoree and the required fields of the selected honoree profile are disabled or doesn\'t exist.')); + } + + //build soft-credit section + CRM_Contribute_Form_SoftCredit::buildQuickForm($form); + } + else { + $params = CRM_Contribute_BAO_ContributionPage::formatModuleData($ufJoin->module_data, TRUE, 'on_behalf'); + $form->_values = array_merge($params, $form->_values); + + $onBehalfProfileId = $ufJoin->uf_group_id; + + if (!$onBehalfProfileId || + !CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $onBehalfProfileId, 'is_active') + ) { + CRM_Core_Error::fatal(ts('This contribution page has been configured for contribution on behalf of an organization and the selected onbehalf profile is either disabled or not found.')); + } + + $member = CRM_Member_BAO_Membership::getMembershipBlock($form->_id); + if (empty($member['is_active'])) { + $msg = ts('Mixed profile not allowed for on behalf of registration/sign up.'); + $onBehalfProfile = CRM_Core_BAO_UFGroup::profileGroups($onBehalfProfileId); + foreach (array( + 'Individual', + 'Organization', + 'Household', + ) as $contactType) { + if (in_array($contactType, $onBehalfProfile) && + (in_array('Membership', $onBehalfProfile) || + in_array('Contribution', $onBehalfProfile) + ) + ) { + CRM_Core_Error::fatal($msg); + } + } + } + + if ($contactID) { + $form->_employers = CRM_Contact_BAO_Relationship::getPermissionedEmployer($contactID); + + if (!empty($form->_membershipContactID) && $contactID != $form->_membershipContactID) { + // renewal case - membership being renewed may or may not be for organization + if (!empty($form->_employers) && array_key_exists($form->_membershipContactID, $form->_employers)) { + // if _membershipContactID belongs to employers list, we can say: + $form->_relatedOrganizationFound = TRUE; + } + } + elseif (!empty($form->_employers)) { + // not a renewal case and _employers list is not empty + $form->_relatedOrganizationFound = TRUE; + } + + if ($params['is_for_organization'] != 2) { + $form->assign('relatedOrganizationFound', $form->_relatedOrganizationFound); + } + else { + $form->assign('onBehalfRequired', $form->_onBehalfRequired); + } + + if (count($form->_employers) == 1) { + foreach ($form->_employers as $id => $value) { + $form->_organizationName = $value['name']; + } + } + } + + if (CRM_Utils_Array::value('is_for_organization', $params)) { + if ($params['is_for_organization'] == 2) { + $this->assign('onBehalfRequired', TRUE); + } + else { + $form->addElement('checkbox', 'is_for_organization', + $form->_values['for_organization'], + NULL + ); + } + } + $form->assign('onBehalfprofileId', $onBehalfProfileId); + } + } + + } + /** * Check template file exists. * diff --git a/CRM/Core/xml/Menu/Contact.xml b/CRM/Core/xml/Menu/Contact.xml index 7f1ac88b2a..58987ab372 100644 --- a/CRM/Core/xml/Menu/Contact.xml +++ b/CRM/Core/xml/Menu/Contact.xml @@ -400,6 +400,13 @@ CRM_Contact_Page_AJAX::flipDupePairs merge duplicate contacts + + civicrm/profileContact/form + 1 + CRM_Contact_Form_ProfileContact + true + 0 + civicrm/activity/sms/add action=add diff --git a/templates/CRM/Contact/Form/ProfileContact.tpl b/templates/CRM/Contact/Form/ProfileContact.tpl new file mode 100644 index 0000000000..9c983a29b3 --- /dev/null +++ b/templates/CRM/Contact/Form/ProfileContact.tpl @@ -0,0 +1,195 @@ +{* + +--------------------------------------------------------------------+ + | CiviCRM version 4.6 | + +--------------------------------------------------------------------+ + | Copyright CiviCRM LLC (c) 2004-2015 | + +--------------------------------------------------------------------+ + | This file is a part of CiviCRM. | + | | + | CiviCRM is free software; you can copy, modify, and distribute it | + | under the terms of the GNU Affero General Public License | + | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | + | | + | CiviCRM is distributed in the hope that it will be useful, but | + | WITHOUT ANY WARRANTY; without even the implied warranty of | + | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | + | See the GNU Affero General Public License for more details. | + | | + | You should have received a copy of the GNU Affero General Public | + | License and the CiviCRM Licensing Exception along | + | with this program; if not, contact CiviCRM LLC | + | at info[AT]civicrm[DOT]org. If you have questions about the | + | GNU Affero General Public License or the licensing of CiviCRM, | + | see the CiviCRM license FAQ at http://civicrm.org/licensing | + +--------------------------------------------------------------------+ +*} +{** + * This file provides the HTML for the on-behalf-of form. + * Also used for related contact edit form. + * FIXME: This is way more complex than it needs to be + * FIXME: Why are we not just using the dynamic form tpl to display this profile? + *} +{if $form.is_for_organization} +
+
 
+
+ {$form.is_for_organization.html} {$form.is_for_organization.label} +
+
+
+{/if} + +
+ {crmRegion name="onbehalf-block"} + {if $onBehalfOfFields|@count} +
+ {$fieldSetTitle} + {if $form.org_option} +
+
+ {$form.org_option.html} +
+
+ {/if} + {include file="CRM/UF/Form/Block.tpl" fields=$onBehalfOfFields mode=8 prefix='onbehalf'} +
+ {/if} + {/crmRegion} +
+ +{literal} + +{/literal} diff --git a/templates/CRM/Contribute/Form/Contribution/Main.tpl b/templates/CRM/Contribute/Form/Contribution/Main.tpl index cb6642f865..90e280be2e 100644 --- a/templates/CRM/Contribute/Form/Contribution/Main.tpl +++ b/templates/CRM/Contribute/Form/Contribution/Main.tpl @@ -160,19 +160,7 @@
- {if $form.is_for_organization} -
-
 
-
- {$form.is_for_organization.html} {$form.is_for_organization.label} -
-
-
- {/if} - - {if $is_for_organization} - {include file="CRM/Contribute/Form/Contribution/OnBehalfOf.tpl"} - {/if} + {include file="CRM/Contact/Form/ProfileContact.tpl"} {* User account registration option. Displays if enabled for one of the profiles on this page. *} {include file="CRM/common/CMSUser.tpl"} @@ -318,15 +306,6 @@ } } - {/literal} - {if $relatedOrganizationFound and $reset} - cj( "#is_for_organization" ).prop('checked', true ); - showOnBehalf(false); - {elseif $onBehalfRequired} - showOnBehalf(true); - {/if} - {literal} - cj('input[name="soft_credit_type_id"]').on('change', function() { enableHonorType(); }); diff --git a/templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl b/templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl deleted file mode 100644 index e58bb75ac3..0000000000 --- a/templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl +++ /dev/null @@ -1,231 +0,0 @@ -{* - +--------------------------------------------------------------------+ - | CiviCRM version 4.7 | - +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2015 | - +--------------------------------------------------------------------+ - | This file is a part of CiviCRM. | - | | - | CiviCRM is free software; you can copy, modify, and distribute it | - | under the terms of the GNU Affero General Public License | - | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | - | | - | CiviCRM is distributed in the hope that it will be useful, but | - | WITHOUT ANY WARRANTY; without even the implied warranty of | - | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | - | See the GNU Affero General Public License for more details. | - | | - | You should have received a copy of the GNU Affero General Public | - | License and the CiviCRM Licensing Exception along | - | with this program; if not, contact CiviCRM LLC | - | at info[AT]civicrm[DOT]org. If you have questions about the | - | GNU Affero General Public License or the licensing of CiviCRM, | - | see the CiviCRM license FAQ at http://civicrm.org/licensing | - +--------------------------------------------------------------------+ -*} -{** - * This file provides the HTML for the on-behalf-of form. - * Also used for related contact edit form. - * FIXME: This is way more complex than it needs to be - * FIXME: Why are we not just using the dynamic form tpl to display this profile? - *} - -{if $buildOnBehalfForm or $onBehalfRequired} - {if !empty($context)} -
- {$fieldSetTitle} - {if ( $relatedOrganizationFound or $onBehalfRequired ) and !$organizationName and $form.org_option.html} -
-
- {$form.org_option.html} -
-
- {/if} - {/if} -
- {include file="CRM/UF/Form/Block.tpl" fields=$onBehalfOfFields mode=8 prefix='onbehalf'} -
- -
{$form.mode.html}
- {if !empty($context)} -
- {/if} -{/if} -{literal} - -- 2.25.1