<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.4 |
+ | CiviCRM version 4.5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013 |
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
* $Id$
*
*/
public function setDefaultValues() {
$defaults = parent::setDefaultValues();
- // get the member org display name
- if ( $this->_id && !empty($defaults['member_of_contact_id'])) {
- $this->assign('member_org_id', $defaults['member_of_contact_id']);
- }
-
//finding default weight to be put
if (!isset($defaults['weight']) || (!$defaults['weight'])) {
$defaults['weight'] = CRM_Utils_Weight::getDefaultWeight('CRM_Member_DAO_MembershipType');
);
$this->addRule('minimum_fee', ts('Please enter a monetary value for the Minimum Fee.'), 'money');
- $this->addElement('select', 'duration_unit', ts('Duration'), CRM_Core_SelectValues::unitList('duration'));
+ $this->addSelect('duration_unit', array(), TRUE);
//period type
- $this->addElement('select', 'period_type', ts('Period Type'), CRM_Core_SelectValues::periodType());
+ $this->addSelect('period_type', array(), TRUE);
$this->add('text', 'duration_interval', ts('Duration Interval'),
CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipType', 'duration_interval')
);
- $dataUrl = CRM_Utils_System::url(
- "civicrm/ajax/rest",
- "className=CRM_Contact_Page_AJAX&fnName=getContactList&json=1&context=membershipType&reset=1&org=1",
- FALSE, NULL, FALSE
- );
- $this->assign('dataUrl', $dataUrl);
-
- $memberOrg = &$this->add('text', 'member_of_contact', ts('Membership Organization'), NULL, TRUE);
- $this->add('hidden', 'member_of_contact_id', '', array('id' => 'member_of_contact_id'));
- if ($memberOrg->getValue()) {
- $this->assign('member_org', $memberOrg->getValue());
- }
+ $props = array('api' => array('params' => array('contact_type' => 'Organization')));
+ $this->addEntityRef('member_of_contact_id', ts('Membership Organization'), $props, TRUE);
//start day
$this->add('date', 'fixed_period_start_day', ts('Fixed Period Start Day'),
);
$this->add('select', 'financial_type_id', ts( 'Financial Type' ),
- array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::financialType()
+ array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::financialType(), TRUE, array('class' => 'crm-select2')
);
$relTypeInd = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, NULL, NULL, NULL, TRUE);
array('' => ts('- select -')) + $relTypeInd);
$memberRel->setMultiple(TRUE);
- $this->add('select', 'visibility', ts('Visibility'), CRM_Core_SelectValues::memberVisibility());
+ $this->addSelect('visibility', array('placeholder' => NULL, 'option_url' => NULL));
+
$this->add('text', 'weight', ts('Order'),
CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipType', 'weight')
);
$errors['name'] = ts('Please enter a membership type name.');
}
- if ($params['member_of_contact'] && !is_numeric($params['member_of_contact_id'])) {
- $errors['member_of_contact'] = ts('Please select valid organization contact.');
- }
-
- if (empty( $params['financial_type_id'] ) ) {
- $errors['financial_type_id'] = ts('Please enter a financial type.');
- }
-
if (($params['minimum_fee'] > 0 ) && !$params['financial_type_id'] ) {
$errors['financial_type_id'] = ts('Please enter the financial type.');
}
- if (empty($params['duration_unit'])) {
- $errors['duration_unit'] = ts('Please enter a duration unit.');
- }
-
if (empty($params['duration_interval']) and $params['duration_unit'] != 'lifetime') {
$errors['duration_interval'] = ts('Please enter a duration interval.');
}
}
}
- if (empty($params['period_type'])) {
- $errors['period_type'] = ts('Please select a period type.');
- }
-
if ($params['period_type'] == 'fixed' &&
$params['duration_unit'] == 'day'
) {
}
}
+ /**
+ * @param $previousID
+ * @param $priceSetId
+ * @param $membershipTypeId
+ * @param $optionsIds
+ */
public static function checkPreviousPriceField($previousID, $priceSetId, $membershipTypeId, &$optionsIds) {
if ($previousID) {
$editedFieldParams = array(