CRM-10859 rename BAO classes that dont follow naming std (at least those for which...
[civicrm-core.git] / CRM / Member / Form / MembershipBlock.php
index 35da0c076e02cceaaf241912be6f9dec7b1de518..f73277a4641ca3cdac9cd674564a6f09d33f46fa 100644 (file)
@@ -67,7 +67,7 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa
       $this->assign('membershipBlockId', $defaults['id']);
     }
     if ($this->_id &&
-      ($priceSetId = CRM_Price_BAO_Set::getFor('civicrm_contribution_page', $this->_id, 3, 1))
+      ($priceSetId = CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $this->_id, 3, 1))
     ) {
       $defaults['member_price_set_id'] = $priceSetId;
       $this->_memPriceSetId = $priceSetId;
@@ -75,12 +75,12 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa
     else {
       // for membership_types
       // if ( isset( $defaults['membership_types'] ) ) {
-      $priceSetId = CRM_Price_BAO_Set::getFor('civicrm_contribution_page', $this->_id, 3);
+      $priceSetId = CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $this->_id, 3);
       $this->assign('isQuick', 1);
       $this->_memPriceSetId = $priceSetId;
       $pFIDs = array();
       if ($priceSetId) {
-        CRM_Core_DAO::commonRetrieveAll('CRM_Price_DAO_Field', 'price_set_id', $priceSetId, $pFIDs, $return = array('html_type', 'name'));
+        CRM_Core_DAO::commonRetrieveAll('CRM_Price_DAO_PriceField', 'price_set_id', $priceSetId, $pFIDs, $return = array('html_type', 'name'));
         foreach ($pFIDs as $pid => $pValue) {
           if ($pValue['html_type'] == 'Radio' && $pValue['name'] == 'membership_amount') {
             $defaults['mem_price_field_id'] = $pValue['id'];
@@ -89,7 +89,7 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa
 
         if (CRM_Utils_Array::value('mem_price_field_id', $defaults)) {
           $options = array();
-          $priceFieldOptions = CRM_Price_BAO_FieldValue::getValues($defaults['mem_price_field_id'], $options, 'id', 1);
+          $priceFieldOptions = CRM_Price_BAO_PriceFieldValue::getValues($defaults['mem_price_field_id'], $options, 'id', 1);
           foreach ($options as $k => $v) {
             $newMembershipType[$v['membership_type_id']] = 1;
             if ( !empty($defaults['auto_renew']) ) {
@@ -166,7 +166,7 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa
 
       $this->addFormRule(array('CRM_Member_Form_MembershipBlock', 'formRule'), $this->_id);
     }
-    $price = CRM_Price_BAO_Set::getAssoc(FALSE, 'CiviMember');
+    $price = CRM_Price_BAO_PriceSet::getAssoc(FALSE, 'CiviMember');
     if (CRM_Utils_System::isNull($price)) {
       $this->assign('price', FALSE);
     }
@@ -211,7 +211,7 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa
 
     if (CRM_Utils_Array::value('member_price_set_id', $params)) {
       //check if this price set has membership type both auto-renew and non-auto-renew memberships.
-      $bothTypes =  CRM_Price_BAO_Set::checkMembershipPriceSet($params['member_price_set_id']);
+      $bothTypes =  CRM_Price_BAO_PriceSet::checkMembershipPriceSet($params['member_price_set_id']);
 
       //check for supporting payment processors
       //if both auto-renew and non-auto-renew memberships
@@ -242,9 +242,9 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa
     if (CRM_Utils_Array::value('member_is_active', $params)) {
 
       // don't allow price set w/ membership signup, CRM-5095
-      if ($contributionPageId && ($setID = CRM_Price_BAO_Set::getFor('civicrm_contribution_page', $contributionPageId, NULL, 1))) {
+      if ($contributionPageId && ($setID = CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $contributionPageId, NULL, 1))) {
 
-        $extends = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $setID, 'extends');
+        $extends = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $setID, 'extends');
         if ($extends != CRM_Core_Component::getComponentID('CiviMember')) {
           $errors['member_is_active'] = ts('You cannot enable both Membership Signup and a Contribution Price Set on the same online contribution page.');
           return $errors;
@@ -330,14 +330,14 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa
       // check for price set.
       $priceSetID = CRM_Utils_Array::value('member_price_set_id', $params);
       if (CRM_Utils_Array::value('member_is_active', $params) && is_array($membershipTypes) && !$priceSetID) {
-        $usedPriceSetId = CRM_Price_BAO_Set::getFor('civicrm_contribution_page', $this->_id, 2);
+        $usedPriceSetId = CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $this->_id, 2);
         if (!CRM_Utils_Array::value('mem_price_field_id', $params) && !$usedPriceSetId) {
           $pageTitle = strtolower(CRM_Utils_String::munge($this->_values['title'], '_', 245));
           $setParams['title'] = $this->_values['title'];
-          if (!CRM_Core_DAO::getFieldValue('CRM_Price_BAO_Set', $pageTitle, 'id', 'name')) {
+          if (!CRM_Core_DAO::getFieldValue('CRM_Price_BAO_PriceSet', $pageTitle, 'id', 'name')) {
             $setParams['name'] = $pageTitle;
           }
-          elseif (!CRM_Core_DAO::getFieldValue('CRM_Price_BAO_Set', $pageTitle . '_' . $this->_id, 'id', 'name')) {
+          elseif (!CRM_Core_DAO::getFieldValue('CRM_Price_BAO_PriceSet', $pageTitle . '_' . $this->_id, 'id', 'name')) {
             $setParams['name'] = $pageTitle . '_' . $this->_id;
           }
           else {
@@ -347,7 +347,7 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa
           $setParams['is_quick_config'] = 1;
           $setParams['extends'] = CRM_Core_Component::getComponentID('CiviMember');
           $setParams['financial_type_id'] = CRM_Utils_Array::value( 'financial_type_id', $this->_values );
-          $priceSet = CRM_Price_BAO_Set::create($setParams);
+          $priceSet = CRM_Price_BAO_PriceSet::create($setParams);
           $priceSetID = $priceSet->id;
           $fieldParams['price_set_id'] = $priceSet->id;
         }
@@ -355,25 +355,25 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa
           $setParams['extends'] = CRM_Core_Component::getComponentID('CiviMember');
           $setParams['financial_type_id'] = CRM_Utils_Array::value( 'financial_type_id', $this->_values );
           $setParams['id'] = $usedPriceSetId;
-          $priceSet = CRM_Price_BAO_Set::create($setParams);
+          $priceSet = CRM_Price_BAO_PriceSet::create($setParams);
           $priceSetID = $priceSet->id;
           $fieldParams['price_set_id'] = $priceSet->id;
         }
         else {
           $fieldParams['id'] = CRM_Utils_Array::value('mem_price_field_id', $params);
-          $priceSetID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Field', CRM_Utils_Array::value('mem_price_field_id', $params), 'price_set_id');
+          $priceSetID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', CRM_Utils_Array::value('mem_price_field_id', $params), 'price_set_id');
         }
         $editedFieldParams = array(
           'price_set_id' => $priceSetID,
           'name' => 'membership_amount',
         );
         $editedResults = array();
-        CRM_Price_BAO_Field::retrieve($editedFieldParams, $editedResults);
+        CRM_Price_BAO_PriceField::retrieve($editedFieldParams, $editedResults);
         if (!CRM_Utils_Array::value('id', $editedResults)) {
           $fieldParams['name'] = strtolower(CRM_Utils_String::munge('Membership Amount', '_', 245));
           $fieldParams['label'] = CRM_Utils_Array::value('new_title', $params) ? $params['new_title'] : ts('Membership');
           if (!CRM_Utils_Array::value('mem_price_field_id', $params)) {
-            CRM_Utils_Weight::updateOtherWeights('CRM_Price_DAO_Field', 0, 1, array('price_set_id' => $priceSetID));
+            CRM_Utils_Weight::updateOtherWeights('CRM_Price_DAO_PriceField', 0, 1, array('price_set_id' => $priceSetID));
           }
           $fieldParams['weight'] = 1;
         }
@@ -388,7 +388,7 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa
         $rowCount = 1;
         $options = array();
         if (CRM_Utils_Array::value('id', $fieldParams)) {
-          CRM_Core_PseudoConstant::populate($options, 'CRM_Price_DAO_FieldValue', TRUE, 'membership_type_id', NULL, " price_field_id = {$fieldParams['id']} ");
+          CRM_Core_PseudoConstant::populate($options, 'CRM_Price_DAO_PriceFieldValue', TRUE, 'membership_type_id', NULL, " price_field_id = {$fieldParams['id']} ");
         }
 
         foreach ($membershipTypes as $memType => $memAutoRenew) {
@@ -409,9 +409,9 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa
           $rowCount++;
         }
         foreach ($options as $priceFieldID => $memType) {
-          CRM_Price_BAO_FieldValue::setIsActive($priceFieldID, '0');
+          CRM_Price_BAO_PriceFieldValue::setIsActive($priceFieldID, '0');
         }
-        $priceField = CRM_Price_BAO_Field::create($fieldParams);
+        $priceField = CRM_Price_BAO_PriceField::create($fieldParams);
       }
       elseif (!$priceSetID){
         $deletePriceSet = 1;
@@ -435,7 +435,7 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa
       $dao->save();
 
       if ($priceSetID && $params['is_active']) {
-        CRM_Price_BAO_Set::addTo('civicrm_contribution_page', $this->_id, $priceSetID);
+        CRM_Price_BAO_PriceSet::addTo('civicrm_contribution_page', $this->_id, $priceSetID);
       }
 
       if ($deletePriceSet || !CRM_Utils_Array::value('member_is_active', $params, FALSE)) {
@@ -448,14 +448,14 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa
             'name' => 'contribution_amount',
           );
 
-          CRM_Core_DAO::commonRetrieve('CRM_Price_DAO_Field', $conditionParams, $pFIDs);
+          CRM_Core_DAO::commonRetrieve('CRM_Price_DAO_PriceField', $conditionParams, $pFIDs);
           if (!CRM_Utils_Array::value('id', $pFIDs)) {
-            CRM_Price_BAO_Set::removeFrom('civicrm_contribution_page', $this->_id);
-            CRM_Price_BAO_Set::setIsQuickConfig($this->_memPriceSetId, '0');
+            CRM_Price_BAO_PriceSet::removeFrom('civicrm_contribution_page', $this->_id);
+            CRM_Price_BAO_PriceSet::setIsQuickConfig($this->_memPriceSetId, '0');
           }
           else {
 
-            CRM_Price_BAO_Field::setIsActive($params['mem_price_field_id'], '0');
+            CRM_Price_BAO_PriceField::setIsActive($params['mem_price_field_id'], '0');
           }
         }
       }