From 9da8dc8cb8dbb7d17ea61adb52b735b1887fa8d7 Mon Sep 17 00:00:00 2001 From: eileen Date: Sun, 14 Jul 2013 12:25:09 +1200 Subject: [PATCH] CRM-10859 rename BAO classes that dont follow naming std (at least those for which API tests exist :-) --- CRM/Admin/Page/AJAX.php | 8 +-- CRM/Batch/Form/Entry.php | 16 ++--- CRM/Contact/Form/Search/Custom/PriceSet.php | 2 +- CRM/Contribute/BAO/Contribution.php | 6 +- CRM/Contribute/BAO/ContributionPage.php | 2 +- CRM/Contribute/Form/Contribution.php | 22 +++--- CRM/Contribute/Form/Contribution/Confirm.php | 18 ++--- CRM/Contribute/Form/Contribution/Main.php | 26 +++---- CRM/Contribute/Form/Contribution/ThankYou.php | 2 +- CRM/Contribute/Form/ContributionBase.php | 2 +- CRM/Contribute/Form/ContributionPage.php | 2 +- .../Form/ContributionPage/Amount.php | 68 +++++++++---------- .../Form/ContributionPage/Delete.php | 2 +- CRM/Core/Page/AJAX.php | 4 +- CRM/Core/Payment/BaseIPN.php | 2 +- CRM/Event/BAO/Event.php | 6 +- CRM/Event/BAO/Participant.php | 2 +- CRM/Event/BAO/Query.php | 2 +- .../Form/Checkout/ParticipantsAndPrices.php | 10 +-- CRM/Event/Cart/Form/Checkout/Payment.php | 6 +- CRM/Event/Form/EventFees.php | 4 +- CRM/Event/Form/ManageEvent/Fee.php | 60 ++++++++-------- CRM/Event/Form/Participant.php | 6 +- CRM/Event/Form/Registration.php | 8 +-- .../Registration/AdditionalParticipant.php | 8 +-- CRM/Event/Form/Registration/Confirm.php | 4 +- CRM/Event/Form/Registration/Register.php | 6 +- CRM/Event/Form/Registration/ThankYou.php | 4 +- CRM/Event/Page/EventInfo.php | 4 +- CRM/Mailing/BAO/Mailing.php | 18 ++--- CRM/Mailing/BAO/{Job.php => MailingJob.php} | 32 ++++----- CRM/Mailing/BAO/Spool.php | 4 +- CRM/Mailing/Event/BAO/Bounce.php | 4 +- CRM/Mailing/Event/BAO/Delivered.php | 4 +- CRM/Mailing/Event/BAO/Forward.php | 6 +- CRM/Mailing/Event/BAO/Opened.php | 6 +- CRM/Mailing/Event/BAO/Queue.php | 6 +- CRM/Mailing/Event/BAO/Reply.php | 6 +- CRM/Mailing/Event/BAO/Resubscribe.php | 4 +- CRM/Mailing/Event/BAO/TrackableURLOpen.php | 8 +-- CRM/Mailing/Event/BAO/Unsubscribe.php | 8 +-- CRM/Mailing/Form/Approve.php | 2 +- CRM/Mailing/Form/Browse.php | 2 +- CRM/Mailing/Form/Test.php | 4 +- CRM/Mailing/Page/Browse.php | 8 +-- CRM/Mailing/Selector/Browse.php | 6 +- CRM/Mailing/Selector/Event.php | 2 +- CRM/Member/BAO/Membership.php | 10 +-- CRM/Member/BAO/MembershipType.php | 10 +-- CRM/Member/Form/Membership.php | 24 +++---- CRM/Member/Form/MembershipBlock.php | 48 ++++++------- CRM/Member/Form/MembershipRenewal.php | 2 +- CRM/Member/Form/MembershipType.php | 4 +- CRM/Price/BAO/LineItem.php | 12 ++-- CRM/Price/BAO/{Field.php => PriceField.php} | 36 +++++----- .../{FieldValue.php => PriceFieldValue.php} | 26 +++---- CRM/Price/BAO/{Set.php => PriceSet.php} | 62 ++++++++--------- CRM/Price/Form/DeleteField.php | 4 +- CRM/Price/Form/DeleteSet.php | 4 +- CRM/Price/Form/Field.php | 30 ++++---- CRM/Price/Form/Option.php | 28 ++++---- CRM/Price/Form/Preview.php | 8 +-- CRM/Price/Form/Set.php | 18 ++--- CRM/Price/Page/Field.php | 22 +++--- CRM/Price/Page/Option.php | 22 +++--- CRM/Price/Page/Set.php | 16 ++--- CRM/Report/Form/Extended.php | 4 +- CRM/Upgrade/Incremental/php/FourTwo.php | 2 +- CRM/Upgrade/Incremental/php/ThreeThree.php | 4 +- CRM/Utils/VersionCheck.php | 2 +- api/v3/PriceFieldValue.php | 2 +- api/v3/PriceSet.php | 4 +- api/v3/examples/ActivityTypeCreate.php | 6 +- api/v3/examples/ActivityTypeDelete.php | 2 +- api/v3/examples/ContributionRecurCreate.php | 2 +- api/v3/examples/ContributionRecurGet.php | 2 +- api/v3/examples/PriceSetCreate.php | 6 +- api/v3/examples/PriceSetDelete.php | 2 +- api/v3/examples/PriceSetSet.php | 6 +- api/v3/utils.php | 18 ++--- sql/GenerateMailing.php | 2 +- tests/phpunit/CRM/Core/PseudoConstantTest.php | 2 +- .../phpunit/CRM/Event/BAO/ParticipantTest.php | 16 ++--- .../civimail-spooler/civimail-spooler.php | 4 +- .../Mailing/{Job.xml => MailingJob.xml} | 2 +- xml/schema/Mailing/files.xml | 2 +- .../Price/{Field.xml => PriceField.xml} | 2 +- .../{FieldValue.xml => PriceFieldValue.xml} | 2 +- xml/schema/Price/{Set.xml => PriceSet.xml} | 2 +- .../{SetEntity.xml => PriceSetEntity.xml} | 2 +- xml/schema/Price/files.xml | 8 +-- 91 files changed, 462 insertions(+), 472 deletions(-) rename CRM/Mailing/BAO/{Job.php => MailingJob.php} (96%) rename CRM/Price/BAO/{Field.php => PriceField.php} (94%) rename CRM/Price/BAO/{FieldValue.php => PriceFieldValue.php} (86%) rename CRM/Price/BAO/{Set.php => PriceSet.php} (95%) rename xml/schema/Mailing/{Job.xml => MailingJob.xml} (98%) rename xml/schema/Price/{Field.xml => PriceField.xml} (99%) rename xml/schema/Price/{FieldValue.xml => PriceFieldValue.xml} (99%) rename xml/schema/Price/{Set.xml => PriceSet.xml} (99%) rename xml/schema/Price/{SetEntity.xml => PriceSetEntity.xml} (97%) diff --git a/CRM/Admin/Page/AJAX.php b/CRM/Admin/Page/AJAX.php index d2e5e2cf26..32ed8c6d78 100644 --- a/CRM/Admin/Page/AJAX.php +++ b/CRM/Admin/Page/AJAX.php @@ -82,10 +82,10 @@ class CRM_Admin_Page_AJAX { } break; - case 'CRM_Price_BAO_Set': + case 'CRM_Price_BAO_PriceSet': require_once (str_replace('_', DIRECTORY_SEPARATOR, $recordBAO) . '.php'); - $usedBy = CRM_Price_BAO_Set::getUsedBy($recordID); - $priceSet = CRM_Price_BAO_Set::getTitle($recordID); + $usedBy = CRM_Price_BAO_PriceSet::getUsedBy($recordID); + $priceSet = CRM_Price_BAO_PriceSet::getTitle($recordID); if (!CRM_Utils_System::isNull($usedBy)) { $template = CRM_Core_Smarty::singleton(); @@ -191,7 +191,7 @@ class CRM_Admin_Page_AJAX { $status = ts('Are you sure you want to disable this membership status rule?'); break; - case 'CRM_Price_BAO_Field': + case 'CRM_Price_BAO_PriceField': $status = ts('Are you sure you want to disable this price field?'); break; diff --git a/CRM/Batch/Form/Entry.php b/CRM/Batch/Form/Entry.php index b3663b8665..b4cde294b5 100644 --- a/CRM/Batch/Form/Entry.php +++ b/CRM/Batch/Form/Entry.php @@ -371,8 +371,8 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { ); // get the price set associated with offline contribution record. - $priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', 'default_contribution_amount', 'id', 'name'); - $this->_priceSet = current(CRM_Price_BAO_Set::getSetDetail($priceSetId)); + $priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', 'default_contribution_amount', 'id', 'name'); + $this->_priceSet = current(CRM_Price_BAO_PriceSet::getSetDetail($priceSetId)); $fieldID = key($this->_priceSet['fields']); if (isset($params['field'])) { @@ -439,7 +439,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { $value['price_'.$fieldID] = 1; $lineItem = array(); - CRM_Price_BAO_Set::processAmount($this->_priceSet['fields'], $value, $lineItem[$priceSetId]); + CRM_Price_BAO_PriceSet::processAmount($this->_priceSet['fields'], $value, $lineItem[$priceSetId]); //unset amount level since we always use quick config price set unset($value['amount_level']); @@ -519,8 +519,8 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { ); // get the price set associated with offline memebership - $priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', 'default_membership_type_amount', 'id', 'name'); - $this->_priceSet = $priceSets = current(CRM_Price_BAO_Set::getSetDetail($priceSetId)); + $priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', 'default_membership_type_amount', 'id', 'name'); + $this->_priceSet = $priceSets = current(CRM_Price_BAO_PriceSet::getSetDetail($priceSetId)); if (isset($params['field'])) { $customFields = array(); @@ -627,7 +627,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { ); $editedResults = array(); - CRM_Price_BAO_Field::retrieve($editedFieldParams, $editedResults); + CRM_Price_BAO_PriceField::retrieve($editedFieldParams, $editedResults); if (!empty($editedResults)) { unset($this->_priceSet['fields']); @@ -640,7 +640,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { ); $editedResults = array(); - CRM_Price_BAO_FieldValue::retrieve($editedFieldParams, $editedResults); + CRM_Price_BAO_PriceFieldValue::retrieve($editedFieldParams, $editedResults); $this->_priceSet['fields'][$fid]['options'][$editedResults['id']] = $priceSets['fields'][$fid]['options'][$editedResults['id']]; if (CRM_Utils_Array::value('total_amount', $value)) { $this->_priceSet['fields'][$fid]['options'][$editedResults['id']]['amount'] = $value['total_amount']; @@ -650,7 +650,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { $value['price_' . $fieldID] = $editedResults['id']; $lineItem = array(); - CRM_Price_BAO_Set::processAmount($this->_priceSet['fields'], + CRM_Price_BAO_PriceSet::processAmount($this->_priceSet['fields'], $value, $lineItem[$priceSetId] ); diff --git a/CRM/Contact/Form/Search/Custom/PriceSet.php b/CRM/Contact/Form/Search/Custom/PriceSet.php index cf3141ba4e..ac074a3739 100644 --- a/CRM/Contact/Form/Search/Custom/PriceSet.php +++ b/CRM/Contact/Form/Search/Custom/PriceSet.php @@ -230,7 +230,7 @@ AND p.entity_id = e.id } // get all the fields and all the option values associated with it - $priceSet = CRM_Price_BAO_Set::getSetDetail($dao->price_set_id); + $priceSet = CRM_Price_BAO_PriceSet::getSetDetail($dao->price_set_id); if (is_array($priceSet[$dao->price_set_id])) { foreach ($priceSet[$dao->price_set_id]['fields'] as $key => $value) { if (is_array($value['options'])) { diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index 81aec9c479..04b035808c 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -671,8 +671,8 @@ INNER JOIN civicrm_contact contact ON ( contact.id = civicrm_contribution.conta CRM_Pledge_BAO_PledgePayment::resetPledgePayment($id); // remove entry from civicrm_price_set_entity, CRM-5095 - if (CRM_Price_BAO_Set::getFor('civicrm_contribution', $id)) { - CRM_Price_BAO_Set::removeFrom('civicrm_contribution', $id); + if (CRM_Price_BAO_PriceSet::getFor('civicrm_contribution', $id)) { + CRM_Price_BAO_PriceSet::removeFrom('civicrm_contribution', $id); } // cleanup line items. $participantId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', $id, 'participant_id', 'contribution_id'); @@ -2172,7 +2172,7 @@ WHERE contribution_id = %1 "; } } $values['lineItem'][0] = $lineItem; - $values['priceSetID'] = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Field', $lineItem[$itemId]['price_field_id'], 'price_set_id'); + $values['priceSetID'] = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $lineItem[$itemId]['price_field_id'], 'price_set_id'); } } diff --git a/CRM/Contribute/BAO/ContributionPage.php b/CRM/Contribute/BAO/ContributionPage.php index 61717fa294..b6dc5c984b 100644 --- a/CRM/Contribute/BAO/ContributionPage.php +++ b/CRM/Contribute/BAO/ContributionPage.php @@ -608,7 +608,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio )); //copy price sets - CRM_Price_BAO_Set::copyPriceSet('civicrm_contribution_page', $id, $copy->id); + CRM_Price_BAO_PriceSet::copyPriceSet('civicrm_contribution_page', $id, $copy->id); $copyTellFriend = &CRM_Core_DAO::copyGeneric('CRM_Friend_DAO_Friend', array( 'entity_id' => $id, diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php index 04b0cf0ef8..e96d0e3d92 100644 --- a/CRM/Contribute/Form/Contribution.php +++ b/CRM/Contribute/Form/Contribution.php @@ -485,7 +485,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP } $this->set('priceSetId', $this->_priceSetId); - CRM_Price_BAO_Set::buildPriceSet($this); + CRM_Price_BAO_PriceSet::buildPriceSet($this); // get only price set form elements. if ($getOnlyPriceSetElements) { @@ -772,7 +772,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP $totalAmount = NULL; if (empty($this->_lineItems)) { $buildPriceSet = FALSE; - $priceSets = CRM_Price_BAO_Set::getAssoc(FALSE, 'CiviContribute'); + $priceSets = CRM_Price_BAO_PriceSet::getAssoc(FALSE, 'CiviContribute'); if (!empty($priceSets) && !$this->_ppID) { $buildPriceSet = TRUE; } @@ -936,7 +936,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP // do the amount validations. if (!CRM_Utils_Array::value('total_amount', $fields) && empty($self->_lineItems)) { if ($priceSetId = CRM_Utils_Array::value('price_set_id', $fields)) { - CRM_Price_BAO_Field::priceSetValidation($priceSetId, $fields, $errors); + CRM_Price_BAO_PriceField::priceSetValidation($priceSetId, $fields, $errors); } } @@ -993,8 +993,8 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP if (CRM_Utils_Array::value('price_set_id', $submittedValues) && $this->_action & CRM_Core_Action::UPDATE) { $line = CRM_Price_BAO_LineItem::getLineItems($this->_id, 'contribution'); $lineID = key($line); - $priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Field', CRM_Utils_Array::value('price_field_id', $line[$lineID]), 'price_set_id'); - $quickConfig = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $priceSetId, 'is_quick_config'); + $priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', CRM_Utils_Array::value('price_field_id', $line[$lineID]), 'price_set_id'); + $quickConfig = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $priceSetId, 'is_quick_config'); if ($quickConfig) { CRM_Price_BAO_LineItem::deleteLineItems($this->_id, 'civicrm_contribution'); } @@ -1005,8 +1005,8 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP $priceSetId = $pId = NULL; $priceSetId = CRM_Utils_Array::value('price_set_id', $submittedValues); if (empty($priceSetId) && !$this->_id) { - $this->_priceSetId = $priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', 'default_contribution_amount', 'id', 'name'); - $this->_priceSet = current(CRM_Price_BAO_Set::getSetDetail($priceSetId)); + $this->_priceSetId = $priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', 'default_contribution_amount', 'id', 'name'); + $this->_priceSet = current(CRM_Price_BAO_PriceSet::getSetDetail($priceSetId)); $fieldID = key($this->_priceSet['fields']); $fieldValueId = key($this->_priceSet['fields'][$fieldID]['options']); $this->_priceSet['fields'][$fieldID]['options'][$fieldValueId]['amount'] = $submittedValues['total_amount']; @@ -1014,7 +1014,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP } if ($priceSetId) { - CRM_Price_BAO_Set::processAmount($this->_priceSet['fields'], + CRM_Price_BAO_PriceSet::processAmount($this->_priceSet['fields'], $submittedValues, $lineItem[$priceSetId]); $submittedValues['total_amount'] = CRM_Utils_Array::value('amount', $submittedValues); @@ -1046,16 +1046,16 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP $itemId = key($lineItems); $fieldType = NULL; if ($itemId && CRM_Utils_Array::value('price_field_id', $lineItems[$itemId])) { - $fieldType = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Field', $lineItems[$itemId]['price_field_id'], 'html_type'); + $fieldType = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $lineItems[$itemId]['price_field_id'], 'html_type'); } $lineItems[$itemId]['unit_price'] = $lineItems[$itemId]['line_total'] = CRM_Utils_Rule::cleanMoney(CRM_Utils_Array::value('total_amount', $submittedValues)); $lineItems[$itemId]['id'] = $itemId; // 10117 update th line items for participants - $this->_priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Field', $lineItems[$itemId]['price_field_id'], 'price_set_id'); + $this->_priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $lineItems[$itemId]['price_field_id'], 'price_set_id'); $lineItem[$this->_priceSetId] = $lineItems; } $isQuickConfig = 0; - if ($this->_priceSetId && CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $this->_priceSetId, 'is_quick_config')) { + if ($this->_priceSetId && CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config')) { $isQuickConfig = 1; } //CRM-11529 for quick config backoffice transactions diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index 890581a510..e914a9354b 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -151,23 +151,23 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $this->_useForMember = $this->get('useForMember'); if (isset($this->_params['amount'])) { - $priceField = new CRM_Price_DAO_Field(); + $priceField = new CRM_Price_DAO_PriceField(); $priceField->price_set_id = $this->_params['priceSetId']; $priceField->orderBy('weight'); $priceField->find(); $contriPriceId = NULL; - $isQuickConfig = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $this->_params['priceSetId'], 'is_quick_config'); + $isQuickConfig = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_params['priceSetId'], 'is_quick_config'); while ($priceField->fetch()) { if ($priceField->name == "contribution_amount") { $contriPriceId = $priceField->id; } if ($isQuickConfig && !empty($this->_params["price_{$priceField->id}"])) { if ($this->_values['fee'][$priceField->id]['html_type'] != 'Text') { - $this->_params['amount_level'] = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_FieldValue', + $this->_params['amount_level'] = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $this->_params["price_{$priceField->id}"], 'label'); } if ($priceField->name == "membership_amount") { - $this->_params['selectMembership'] = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_FieldValue', + $this->_params['selectMembership'] = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $this->_params["price_{$priceField->id}"], 'membership_type_id'); } } // if seperate payment we set contribution amount to be null, so that it will not show contribution amount same as membership amount. @@ -337,7 +337,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $this->_params['is_recur'] = $this->_values['is_recur'] = 1; // check if price set is not quick config if (CRM_Utils_Array::value('priceSetId', $this->_params) && !$isQuickConfig) { - list($this->_params['frequency_interval'], $this->_params['frequency_unit']) = CRM_Price_BAO_Set::getRecurDetails($this->_params['priceSetId']); + list($this->_params['frequency_interval'], $this->_params['frequency_unit']) = CRM_Price_BAO_PriceSet::getRecurDetails($this->_params['priceSetId']); } else { // FIXME: set interval and unit based on selected membership type @@ -452,7 +452,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $this->_separateMembershipPayment = $this->get('separateMembershipPayment'); $this->assign('is_separate_payment', $this->_separateMembershipPayment); - if ($this->_priceSetId && !CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $this->_priceSetId, 'is_quick_config')) { + if ($this->_priceSetId && !CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config')) { $this->assign('lineItem', $this->_lineItem); } else { $this->assign('is_quick_config', 1); @@ -901,15 +901,15 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $priceFieldIds = $this->get('memberPriceFieldIDS'); if (!empty($priceFieldIds)) { - $contributionTypeID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $priceFieldIds['id'], 'financial_type_id'); + $contributionTypeID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $priceFieldIds['id'], 'financial_type_id'); unset($priceFieldIds['id']); $membershipTypeIds = array(); $membershipTypeTerms = array(); foreach ($priceFieldIds as $priceFieldId) { - if ($id = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_FieldValue', $priceFieldId, 'membership_type_id')) { + if ($id = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $priceFieldId, 'membership_type_id')) { $membershipTypeIds[] = $id; $term = 1; - if ($term = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_FieldValue', $priceFieldId, 'membership_num_terms')) { + if ($term = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $priceFieldId, 'membership_num_terms')) { $membershipTypeTerms[$id] = ($term > 1) ? $term : 1; } else { diff --git a/CRM/Contribute/Form/Contribution/Main.php b/CRM/Contribute/Form/Contribution/Main.php index 1c7b1bcbdc..3a4e138a54 100644 --- a/CRM/Contribute/Form/Contribution/Main.php +++ b/CRM/Contribute/Form/Contribution/Main.php @@ -343,7 +343,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu } } else { - CRM_Price_BAO_Set::setDefaultPriceSet($this, $this->_defaults); + CRM_Price_BAO_PriceSet::setDefaultPriceSet($this, $this->_defaults); } } @@ -459,7 +459,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $this->add('hidden', 'priceSetId', $this->_priceSetId); // build price set form. $this->set('priceSetId', $this->_priceSetId); - CRM_Price_BAO_Set::buildPriceSet($this); + CRM_Price_BAO_PriceSet::buildPriceSet($this); if ($this->_values['is_monetary'] && $this->_values['is_recur'] && !CRM_Utils_Array::value('pledge_id', $this->_values) ) { @@ -468,7 +468,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu } if ($this->_priceSetId) { - $is_quick_config = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $this->_priceSetId, 'is_quick_config'); + $is_quick_config = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config'); if ($is_quick_config) { $this->_useForMember = 0; $this->set('useForMember', $this->_useForMember); @@ -745,7 +745,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu //check for atleast one pricefields should be selected if (CRM_Utils_Array::value('priceSetId', $fields)) { - $priceField = new CRM_Price_DAO_Field(); + $priceField = new CRM_Price_DAO_PriceField(); $priceField->price_set_id = $fields['priceSetId']; $priceField->orderBy('weight'); $priceField->find(); @@ -859,7 +859,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu if (!empty($lifeMember)) { foreach ($priceFieldIDS as $priceFieldId) { - if (($id = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_FieldValue', $priceFieldId, 'membership_type_id')) && + if (($id = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $priceFieldId, 'membership_type_id')) && in_array($membershipOrgDetails[$id], $unallowedOrgs) ) { $errors['_qf_default'] = ts('You already have a lifetime membership and cannot select a membership with a shorter term.'); @@ -873,7 +873,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $priceFieldIDS['id'] = $fields['priceSetId']; $self->set('memberPriceFieldIDS', $priceFieldIDS); - $count = CRM_Price_BAO_Set::getMembershipCount($ids); + $count = CRM_Price_BAO_PriceSet::getMembershipCount($ids); foreach ($count as $id => $occurance) { if ($occurance > 1) { $errors['_qf_default'] = ts('You have selected multiple memberships for the same organization or entity. Please review your selections and choose only one membership per entity. Contact the site administrator if you need assistance.'); @@ -886,7 +886,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu } } - CRM_Price_BAO_Set::processAmount($self->_values['fee'], + CRM_Price_BAO_PriceSet::processAmount($self->_values['fee'], $fields, $lineItem ); @@ -1098,10 +1098,10 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu // get the submitted form values. $params = $this->controller->exportValues($this->_name); if (CRM_Utils_Array::value('priceSetId', $params)) { - $is_quick_config = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $this->_priceSetId, 'is_quick_config'); + $is_quick_config = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config'); $formValue = array(); if ($is_quick_config) { - $priceField = new CRM_Price_DAO_Field(); + $priceField = new CRM_Price_DAO_PriceField(); $priceField->price_set_id = $params['priceSetId']; $priceField->orderBy('weight'); $priceField->find(); @@ -1109,7 +1109,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $check = array(); $otherAmount = FALSE; while ($priceField->fetch()) { - CRM_Price_BAO_FieldValue::getValues($priceField->id, $values); + CRM_Price_BAO_PriceFieldValue::getValues($priceField->id, $values); if ($priceField->name == 'membership_amount') { if ($priceFiledID = CRM_Utils_Array::value("price_{$priceField->id}", $params)) { $this->_params['selectMembership'] = $params['selectMembership'] = CRM_Utils_Array::value('membership_type_id', $values[$priceFiledID]); @@ -1188,7 +1188,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $fieldId = $memPresent = $membershipLabel = $fieldOption = $is_quick_config = NULL; $proceFieldAmount = 0; if ($this->_separateMembershipPayment == 0) { - $is_quick_config = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $this->_priceSetId, 'is_quick_config'); + $is_quick_config = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config'); if ($is_quick_config) { foreach ($this->_priceSet['fields'] as $fieldKey => $fieldVal) { if ($fieldVal['name'] == 'membership_amount' && CRM_Utils_Array::value('price_' . $fieldKey , $params)) { @@ -1220,7 +1220,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu if ($priceSetId = CRM_Utils_Array::value('priceSetId', $params)) { $lineItem = array(); - $is_quick_config = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $priceSetId, 'is_quick_config' ); + $is_quick_config = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $priceSetId, 'is_quick_config' ); if ( $is_quick_config ) { foreach ( $this->_values['fee'] as $key => & $val ) { if ( $val['name'] == 'other_amount' && $val['html_type'] == 'Text' && array_key_exists( 'price_'.$key, $params ) && $params['price_'.$key] != 0 ) { @@ -1238,7 +1238,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu if ($this->_membershipBlock) { $component = 'membership'; } - CRM_Price_BAO_Set::processAmount($this->_values['fee'], $params, $lineItem[$priceSetId], $component); + CRM_Price_BAO_PriceSet::processAmount($this->_values['fee'], $params, $lineItem[$priceSetId], $component); if ($proceFieldAmount) { $lineItem[$params['priceSetId']][$fieldOption]['line_total'] = $proceFieldAmount; diff --git a/CRM/Contribute/Form/Contribution/ThankYou.php b/CRM/Contribute/Form/Contribution/ThankYou.php index d1483a6c5a..8ff020b5c1 100644 --- a/CRM/Contribute/Form/Contribution/ThankYou.php +++ b/CRM/Contribute/Form/Contribution/ThankYou.php @@ -106,7 +106,7 @@ class CRM_Contribute_Form_Contribution_ThankYou extends CRM_Contribute_Form_Cont if ($productID) { CRM_Contribute_BAO_Premium::buildPremiumBlock($this, $this->_id, FALSE, $productID, $option); } - if ($this->_priceSetId && !CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $this->_priceSetId, 'is_quick_config')) { + if ($this->_priceSetId && !CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config')) { $this->assign('lineItem', $this->_lineItem); } else { if (is_array($membershipTypeID)) { diff --git a/CRM/Contribute/Form/ContributionBase.php b/CRM/Contribute/Form/ContributionBase.php index 6cad74dc36..c686032401 100644 --- a/CRM/Contribute/Form/ContributionBase.php +++ b/CRM/Contribute/Form/ContributionBase.php @@ -330,7 +330,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { // get price info // CRM-5095 - CRM_Price_BAO_Set::initSet($this, $this->_id, 'civicrm_contribution_page'); + CRM_Price_BAO_PriceSet::initSet($this, $this->_id, 'civicrm_contribution_page'); // this avoids getting E_NOTICE errors in php $setNullFields = array( diff --git a/CRM/Contribute/Form/ContributionPage.php b/CRM/Contribute/Form/ContributionPage.php index 8cb79069e2..e01e0dabb2 100644 --- a/CRM/Contribute/Form/ContributionPage.php +++ b/CRM/Contribute/Form/ContributionPage.php @@ -267,7 +267,7 @@ class CRM_Contribute_Form_ContributionPage extends CRM_Core_Form { // get price set of type contributions //this is the value for stored in db if price set extends contribution $usedFor = 2; - $this->_priceSetID = CRM_Price_BAO_Set::getFor('civicrm_contribution_page', $this->_id, $usedFor, 1); + $this->_priceSetID = CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $this->_id, $usedFor, 1); if ($this->_priceSetID) { $defaults['price_set_id'] = $this->_priceSetID; } diff --git a/CRM/Contribute/Form/ContributionPage/Amount.php b/CRM/Contribute/Form/ContributionPage/Amount.php index 6a4638f11e..cbf1d244ad 100644 --- a/CRM/Contribute/Form/ContributionPage/Amount.php +++ b/CRM/Contribute/Form/ContributionPage/Amount.php @@ -142,7 +142,7 @@ SELECT id //add partial payment options // add price set fields - $price = CRM_Price_BAO_Set::getAssoc(FALSE, 'CiviContribute'); + $price = CRM_Price_BAO_PriceSet::getAssoc(FALSE, 'CiviContribute'); if (CRM_Utils_System::isNull($price)) { $this->assign('price', FALSE); } @@ -199,17 +199,17 @@ SELECT id if (CRM_Utils_Array::value('amount_block_is_active', $defaults)) { - if ($priceSetId = CRM_Price_BAO_Set::getFor('civicrm_contribution_page', $this->_id, NULL)) { - if ($isQuick = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $priceSetId, 'is_quick_config')) { + if ($priceSetId = CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $this->_id, NULL)) { + if ($isQuick = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $priceSetId, 'is_quick_config')) { $this->assign('isQuick', $isQuick); - //$priceField = CRM_Core_DAO::getFieldValue( 'CRM_Price_DAO_Field', $priceSetId, 'id', 'price_set_id' ); + //$priceField = CRM_Core_DAO::getFieldValue( 'CRM_Price_DAO_PriceField', $priceSetId, 'id', 'price_set_id' ); $options = $pFIDs = array(); $priceFieldParams = array('price_set_id' => $priceSetId); - $priceFields = CRM_Core_DAO::commonRetrieveAll('CRM_Price_DAO_Field', 'price_set_id', $priceSetId, $pFIDs, $return = array('html_type', 'name', 'is_active')); + $priceFields = CRM_Core_DAO::commonRetrieveAll('CRM_Price_DAO_PriceField', 'price_set_id', $priceSetId, $pFIDs, $return = array('html_type', 'name', 'is_active')); foreach ($priceFields as $priceField) { if ($priceField['id'] && $priceField['html_type'] == 'Radio' && $priceField['name'] == 'contribution_amount') { $defaults['price_field_id'] = $priceField['id']; - $priceFieldOptions = CRM_Price_BAO_FieldValue::getValues($priceField['id'], $options, 'id', 1); + $priceFieldOptions = CRM_Price_BAO_PriceFieldValue::getValues($priceField['id'], $options, 'id', 1); $countRow = 0; foreach ($options as $optionId => $optionValue) { $countRow++; @@ -282,9 +282,9 @@ SELECT id $hasMembershipBlk = FALSE; if ($membershipBlock->find(TRUE)) { if (CRM_Utils_Array::value('amount_block_is_active', $fields) && - ($setID = CRM_Price_BAO_Set::getFor('civicrm_contribution_page', $self->_id, NULL, 1)) + ($setID = CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $self->_id, 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 && $extends == CRM_Core_Component::getComponentID('CiviMember')) { $errors['amount_block_is_active'] = ts('You cannot use a Membership Price Set when the Contribution Amounts section is enabled. Click the Memberships tab above, and select your Membership Price Set on that form. Membership Price Sets may include additional fields for non-membership options that require an additional fee (e.g. magazine subscription) or an additional voluntary contribution.'); return $errors; @@ -482,7 +482,7 @@ SELECT id $deleteAmountBlk = TRUE; } - CRM_Price_BAO_Set::addTo('civicrm_contribution_page', $contributionPageID, $priceSetID); + CRM_Price_BAO_PriceSet::addTo('civicrm_contribution_page', $contributionPageID, $priceSetID); } else { @@ -511,14 +511,14 @@ SELECT id if (!empty($options) || CRM_Utils_Array::value('is_allow_other_amount', $params)) { $fieldParams['is_quick_config'] = 1; $noContriAmount = NULL; - $usedPriceSetId = CRM_Price_BAO_Set::getFor('civicrm_contribution_page', $this->_id, 3); + $usedPriceSetId = CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $this->_id, 3); if (!(CRM_Utils_Array::value('price_field_id', $params) || CRM_Utils_Array::value('price_field_other', $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 { @@ -527,7 +527,7 @@ SELECT id } $setParams['is_quick_config'] = 1; $setParams['extends'] = CRM_Core_Component::getComponentID('CiviContribute'); - $priceSet = CRM_Price_BAO_Set::create($setParams); + $priceSet = CRM_Price_BAO_PriceSet::create($setParams); $priceSetId = $priceSet->id; } elseif ($usedPriceSetId && !CRM_Utils_Array::value('price_field_id', $params)) { @@ -537,7 +537,7 @@ SELECT id if ($priceFieldId = CRM_Utils_Array::value('price_field_id', $params)) { foreach ($params['price_field_value'] as $arrayID => $fieldValueID) { if (empty($params['label'][$arrayID]) && empty($params['value'][$arrayID]) && !empty($fieldValueID)) { - CRM_Price_BAO_FieldValue::setIsActive($fieldValueID, '0'); + CRM_Price_BAO_PriceFieldValue::setIsActive($fieldValueID, '0'); unset($params['price_field_value'][$arrayID]); } } @@ -547,13 +547,13 @@ SELECT id } else { $noContriAmount = 0; - CRM_Price_BAO_Field::setIsActive($priceFieldId, '0'); + CRM_Price_BAO_PriceField::setIsActive($priceFieldId, '0'); } } else $priceFieldId = CRM_Utils_Array::value('price_field_other', $params); - $priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Field', $priceFieldId, 'price_set_id'); + $priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $priceFieldId, 'price_set_id'); } - CRM_Price_BAO_Set::addTo('civicrm_contribution_page', $this->_id, $priceSetId); + CRM_Price_BAO_PriceSet::addTo('civicrm_contribution_page', $this->_id, $priceSetId); if (!empty($options)) { $editedFieldParams = array( 'price_set_id' => $priceSetId, @@ -561,7 +561,7 @@ SELECT id ); $editedResults = array(); $noContriAmount = 1; - 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("Contribution Amount", '_', 245)); $fieldParams['label'] = "Contribution Amount"; @@ -588,7 +588,7 @@ SELECT id $fieldParams['option_weight'][$value['weight']] = $value['weight']; } $fieldParams['default_option'] = $params['default']; - $priceField = CRM_Price_BAO_Field::create($fieldParams); + $priceField = CRM_Price_BAO_PriceField::create($fieldParams); } if (CRM_Utils_Array::value('is_allow_other_amount', $params) && !CRM_Utils_Array::value('price_field_other', $params)) { $editedFieldParams = array( @@ -597,7 +597,7 @@ SELECT id ); $editedResults = array(); - CRM_Price_BAO_Field::retrieve($editedFieldParams, $editedResults); + CRM_Price_BAO_PriceField::retrieve($editedFieldParams, $editedResults); if (!$priceFieldID = CRM_Utils_Array::value('id', $editedResults)) { $fieldParams = array( @@ -619,22 +619,22 @@ SELECT id $fieldParams['option_label'][1] = 'Other Amount'; } - $priceField = CRM_Price_BAO_Field::create($fieldParams); + $priceField = CRM_Price_BAO_PriceField::create($fieldParams); } else { if (!CRM_Utils_Array::value('is_active', $editedResults)) { - CRM_Price_BAO_Field::setIsActive($priceFieldID, '1'); + CRM_Price_BAO_PriceField::setIsActive($priceFieldID, '1'); } } } elseif (!CRM_Utils_Array::value('is_allow_other_amount', $params) && CRM_Utils_Array::value('price_field_other', $params)) { - CRM_Price_BAO_Field::setIsActive($params['price_field_other'], '0'); + CRM_Price_BAO_PriceField::setIsActive($params['price_field_other'], '0'); } elseif ($priceFieldID = CRM_Utils_Array::value('price_field_other', $params)) { - $priceFieldValueID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_FieldValue', $priceFieldID, 'id', 'price_field_id' ); + $priceFieldValueID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $priceFieldID, 'id', 'price_field_id' ); if (!$noContriAmount) { - CRM_Core_DAO::setFieldValue('CRM_Price_DAO_Field', $priceFieldID, 'is_required', 1); - CRM_Core_DAO::setFieldValue('CRM_Price_DAO_FieldValue', $priceFieldValueID, 'label', 'Contribution Amount' ); + CRM_Core_DAO::setFieldValue('CRM_Price_DAO_PriceField', $priceFieldID, 'is_required', 1); + CRM_Core_DAO::setFieldValue('CRM_Price_DAO_PriceFieldValue', $priceFieldValueID, 'label', 'Contribution Amount' ); } else { - CRM_Core_DAO::setFieldValue('CRM_Price_DAO_Field', $priceFieldID, 'is_required', 0 ); - CRM_Core_DAO::setFieldValue('CRM_Price_DAO_FieldValue', $priceFieldValueID, 'label', 'Other Amount' ); + CRM_Core_DAO::setFieldValue('CRM_Price_DAO_PriceField', $priceFieldID, 'is_required', 0 ); + CRM_Core_DAO::setFieldValue('CRM_Price_DAO_PriceFieldValue', $priceFieldValueID, 'label', 'Other Amount' ); } } } @@ -665,13 +665,13 @@ SELECT id } else { if (CRM_Utils_Array::value('price_field_id', $params) || CRM_Utils_Array::value('price_field_other', $params)) { - $usedPriceSetId = CRM_Price_BAO_Set::getFor('civicrm_contribution_page', $this->_id, 3); + $usedPriceSetId = CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $this->_id, 3); if ($usedPriceSetId) { if (CRM_Utils_Array::value('price_field_id', $params)) { - CRM_Price_BAO_Field::setIsActive($params['price_field_id'], '0'); + CRM_Price_BAO_PriceField::setIsActive($params['price_field_id'], '0'); } if (CRM_Utils_Array::value('price_field_other', $params)) { - CRM_Price_BAO_Field::setIsActive($params['price_field_other'], '0'); + CRM_Price_BAO_PriceField::setIsActive($params['price_field_other'], '0'); } } else { @@ -688,14 +688,14 @@ SELECT id // delete previous price set. if ($deletePriceSet) { - CRM_Price_BAO_Set::removeFrom('civicrm_contribution_page', $contributionPageID); + CRM_Price_BAO_PriceSet::removeFrom('civicrm_contribution_page', $contributionPageID); } if ($deleteAmountBlk ) { $priceField = CRM_Utils_Array::value('price_field_id', $params)?$params['price_field_id']:CRM_Utils_Array::value('price_field_other', $params); if ($priceField) { - $priceSetID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Field', $priceField, 'price_set_id'); - CRM_Price_BAO_Set::setIsQuickConfig($priceSetID,0); + $priceSetID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $priceField, 'price_set_id'); + CRM_Price_BAO_PriceSet::setIsQuickConfig($priceSetID,0); } } } diff --git a/CRM/Contribute/Form/ContributionPage/Delete.php b/CRM/Contribute/Form/ContributionPage/Delete.php index 28c1962391..77cf67b949 100644 --- a/CRM/Contribute/Form/ContributionPage/Delete.php +++ b/CRM/Contribute/Form/ContributionPage/Delete.php @@ -141,7 +141,7 @@ class CRM_Contribute_Form_ContributionPage_Delete extends CRM_Contribute_Form_Co CRM_Contribute_BAO_Premium::deletePremium($this->_id); // price set cleanup, CRM-5527 - CRM_Price_BAO_Set::removeFrom('civicrm_contribution_page', $this->_id); + CRM_Price_BAO_PriceSet::removeFrom('civicrm_contribution_page', $this->_id); // finally delete the contribution page $dao = new CRM_Contribute_DAO_ContributionPage(); diff --git a/CRM/Core/Page/AJAX.php b/CRM/Core/Page/AJAX.php index 1dfd2ecb9b..4848c5d995 100644 --- a/CRM/Core/Page/AJAX.php +++ b/CRM/Core/Page/AJAX.php @@ -109,9 +109,9 @@ class CRM_Core_Page_AJAX { if (!$id || !in_array($context, array('civicrm_event', 'civicrm_contribution_page'))) { return false; } - $priceSetId = CRM_Price_BAO_Set::getFor($context, $id, NULL); + $priceSetId = CRM_Price_BAO_PriceSet::getFor($context, $id, NULL); if ($priceSetId) { - $result = CRM_Price_BAO_Set::setIsQuickConfig($priceSetId, 0); + $result = CRM_Price_BAO_PriceSet::setIsQuickConfig($priceSetId, 0); if ($context == 'civicrm_event') { $sql = "UPDATE civicrm_price_set cps diff --git a/CRM/Core/Payment/BaseIPN.php b/CRM/Core/Payment/BaseIPN.php index 91813fefbc..18d224cadb 100644 --- a/CRM/Core/Payment/BaseIPN.php +++ b/CRM/Core/Payment/BaseIPN.php @@ -796,7 +796,7 @@ LIMIT 1;"; $lineItems = CRM_Price_BAO_LineItem::getLineItems($contriID, 'contribution'); if (!empty($lineItems)) { foreach ($lineItems as $key => $value) { - $pricesetID = new CRM_Price_DAO_Field(); + $pricesetID = new CRM_Price_DAO_PriceField(); $pricesetID->id = $value['price_field_id']; $pricesetID->find(TRUE); $lineSets[$pricesetID->price_set_id][] = $value; diff --git a/CRM/Event/BAO/Event.php b/CRM/Event/BAO/Event.php index 5f852a9dbc..30d72b81e2 100644 --- a/CRM/Event/BAO/Event.php +++ b/CRM/Event/BAO/Event.php @@ -200,7 +200,7 @@ class CRM_Event_BAO_Event extends CRM_Event_DAO_Event { } // price set cleanup, CRM-5527 - CRM_Price_BAO_Set::removeFrom('civicrm_event', $id); + CRM_Price_BAO_PriceSet::removeFrom('civicrm_event', $id); $event = new CRM_Event_DAO_Event(); $event->id = $id; @@ -871,7 +871,7 @@ WHERE civicrm_event.is_active = 1 $fieldsFix ); } - CRM_Price_BAO_Set::copyPriceSet('civicrm_event', $id, $copyEvent->id); + CRM_Price_BAO_PriceSet::copyPriceSet('civicrm_event', $id, $copyEvent->id); $copyUF = &CRM_Core_DAO::copyGeneric('CRM_Core_DAO_UFJoin', array( 'entity_id' => $id, @@ -972,7 +972,7 @@ WHERE civicrm_event.is_active = 1 static function usesPriceSet($id) { static $usesPriceSet = array(); if (!array_key_exists($id, $usesPriceSet)) { - $usesPriceSet[$id] = CRM_Price_BAO_Set::getFor('civicrm_event', $id); + $usesPriceSet[$id] = CRM_Price_BAO_PriceSet::getFor('civicrm_event', $id); } return $usesPriceSet[$id]; } diff --git a/CRM/Event/BAO/Participant.php b/CRM/Event/BAO/Participant.php index 134e56e3e8..bfe12d28b0 100644 --- a/CRM/Event/BAO/Participant.php +++ b/CRM/Event/BAO/Participant.php @@ -1738,7 +1738,7 @@ WHERE civicrm_participant.contact_id = {$contactID} AND $checkDiscount = CRM_Core_BAO_Discount::findSet($eventID,'civicrm_event'); if (!empty($checkDiscount)) { $feeLevel = current($feeLevel); - $priceSetId = CRM_Price_BAO_Set::getFor('civicrm_event', $eventID, NULL); + $priceSetId = CRM_Price_BAO_PriceSet::getFor('civicrm_event', $eventID, NULL); $query = "SELECT cpfv.amount FROM `civicrm_price_field_value` cpfv LEFT JOIN civicrm_price_field cpf ON cpfv.price_field_id = cpf.id WHERE cpf.price_set_id = %1 AND cpfv.label LIKE %2"; diff --git a/CRM/Event/BAO/Query.php b/CRM/Event/BAO/Query.php index 4cf1e334ba..93a463fa9f 100644 --- a/CRM/Event/BAO/Query.php +++ b/CRM/Event/BAO/Query.php @@ -272,7 +272,7 @@ class CRM_Event_BAO_Query { return; case 'participant_fee_id': - $feeLabel = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_FieldValue', $value, 'label'); + $feeLabel = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $value, 'label'); $feeLabel = CRM_Core_DAO::escapeString(trim($feeLabel)); if ($value) { $query->_where[$grouping][] = "civicrm_participant.fee_level $op '$feeLabel'"; diff --git a/CRM/Event/Cart/Form/Checkout/ParticipantsAndPrices.php b/CRM/Event/Cart/Form/Checkout/ParticipantsAndPrices.php index 9404e8453c..9391cd2c54 100644 --- a/CRM/Event/Cart/Form/Checkout/ParticipantsAndPrices.php +++ b/CRM/Event/Cart/Form/Checkout/ParticipantsAndPrices.php @@ -59,15 +59,15 @@ class CRM_Event_Cart_Form_Checkout_ParticipantsAndPrices extends CRM_Event_Cart_ function build_price_options($event) { $price_fields_for_event = array(); $base_field_name = "event_{$event->id}_amount"; - $price_set_id = CRM_Price_BAO_Set::getFor('civicrm_event', $event->id); + $price_set_id = CRM_Price_BAO_PriceSet::getFor('civicrm_event', $event->id); if ($price_set_id) { - $price_sets = CRM_Price_BAO_Set::getSetDetail($price_set_id, TRUE, TRUE); + $price_sets = CRM_Price_BAO_PriceSet::getSetDetail($price_set_id, TRUE, TRUE); $price_set = $price_sets[$price_set_id]; $index = -1; foreach ($price_set['fields'] as $field) { $index++; $field_name = "event_{$event->id}_price_{$field['id']}"; - CRM_Price_BAO_Field::addQuickFormElement($this, $field_name, $field['id'], FALSE); + CRM_Price_BAO_PriceField::addQuickFormElement($this, $field_name, $field['id'], FALSE); $price_fields_for_event[] = $field_name; } } @@ -85,7 +85,7 @@ class CRM_Event_Cart_Form_Checkout_ParticipantsAndPrices extends CRM_Event_Cart_ foreach ($this->cart->get_main_events_in_carts() as $event_in_cart) { $price_set_id = CRM_Event_BAO_Event::usesPriceSet($event_in_cart->event_id); if ($price_set_id) { - $priceField = new CRM_Price_DAO_Field(); + $priceField = new CRM_Price_DAO_PriceField(); $priceField->price_set_id = $price_set_id; $priceField->find(); @@ -104,7 +104,7 @@ class CRM_Event_Cart_Form_Checkout_ParticipantsAndPrices extends CRM_Event_Cart_ $lineItem = array(); if (is_array($this->_values['fee']['fields'])) { - CRM_Price_BAO_Set::processAmount($this->_values['fee']['fields'], $fields, $lineItem); + CRM_Price_BAO_PriceSet::processAmount($this->_values['fee']['fields'], $fields, $lineItem); //XXX total... if ($fields['amount'] < 0) { $this->_errors['_qf_default'] = ts("Price Levels can not be less than zero. Please select the options accordingly"); diff --git a/CRM/Event/Cart/Form/Checkout/Payment.php b/CRM/Event/Cart/Form/Checkout/Payment.php index f8f4ba536a..fe4c26e99c 100644 --- a/CRM/Event/Cart/Form/Checkout/Payment.php +++ b/CRM/Event/Cart/Form/Checkout/Payment.php @@ -226,7 +226,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart { function process_event_line_item(&$event_in_cart, $class = NULL) { $cost = 0; - $price_set_id = CRM_Price_BAO_Set::getFor("civicrm_event", $event_in_cart->event_id); + $price_set_id = CRM_Price_BAO_PriceSet::getFor("civicrm_event", $event_in_cart->event_id); $amount_level = NULL; if ($price_set_id) { $event_price_values = array(); @@ -235,10 +235,10 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart { $event_price_values[$matches[1]] = $value; } } - $price_sets = CRM_Price_BAO_Set::getSetDetail($price_set_id, TRUE); + $price_sets = CRM_Price_BAO_PriceSet::getSetDetail($price_set_id, TRUE); $price_set = $price_sets[$price_set_id]; $price_set_amount = array(); - CRM_Price_BAO_Set::processAmount($price_set['fields'], $event_price_values, $price_set_amount); + CRM_Price_BAO_PriceSet::processAmount($price_set['fields'], $event_price_values, $price_set_amount); $cost = $event_price_values['amount']; $amount_level = $event_price_values['amount_level']; } diff --git a/CRM/Event/Form/EventFees.php b/CRM/Event/Form/EventFees.php index ac04f9bdf7..303933f8b8 100644 --- a/CRM/Event/Form/EventFees.php +++ b/CRM/Event/Form/EventFees.php @@ -198,7 +198,7 @@ class CRM_Event_Form_EventFees { $priceSetId = CRM_Core_DAO::getFieldValue('CRM_Core_BAO_Discount', $discountId, 'price_set_id'); } else { - $priceSetId = CRM_Price_BAO_Set::getFor('civicrm_event', $form->_eventId); + $priceSetId = CRM_Price_BAO_PriceSet::getFor('civicrm_event', $form->_eventId); } if (($form->_action == CRM_Core_Action::ADD) && $form->_eventId && $discountId) { @@ -291,7 +291,7 @@ class CRM_Event_Form_EventFees { } // get price set ID. - $priceSetID = CRM_Price_BAO_Set::getFor('civicrm_event', $eventID); + $priceSetID = CRM_Price_BAO_PriceSet::getFor('civicrm_event', $eventID); if (!$priceSetID) { return $defaults; } diff --git a/CRM/Event/Form/ManageEvent/Fee.php b/CRM/Event/Form/ManageEvent/Fee.php index d9732e2948..15b14f811a 100644 --- a/CRM/Event/Form/ManageEvent/Fee.php +++ b/CRM/Event/Form/ManageEvent/Fee.php @@ -90,19 +90,19 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { CRM_Event_BAO_Event::retrieve($params, $defaults); if (isset($eventId)) { - $price_set_id = CRM_Price_BAO_Set::getFor('civicrm_event', $eventId, NULL, 1); + $price_set_id = CRM_Price_BAO_PriceSet::getFor('civicrm_event', $eventId, NULL, 1); if ($price_set_id) { $defaults['price_set_id'] = $price_set_id; } else { - $priceSetId = CRM_Price_BAO_Set::getFor('civicrm_event', $eventId, NULL); + $priceSetId = CRM_Price_BAO_PriceSet::getFor('civicrm_event', $eventId, NULL); if ($priceSetId) { - if ($isQuick = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $priceSetId, 'is_quick_config')) { + if ($isQuick = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $priceSetId, 'is_quick_config')) { $this->assign('isQuick', $isQuick); - $priceField = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Field', $priceSetId, 'id', 'price_set_id'); + $priceField = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $priceSetId, 'id', 'price_set_id'); $options = array(); - $priceFieldOptions = CRM_Price_BAO_FieldValue::getValues($priceField, $options, 'weight', true); + $priceFieldOptions = CRM_Price_BAO_PriceFieldValue::getValues($priceField, $options, 'weight', true); $defaults['price_field_id'] = $priceField; $countRow = 0; foreach ($options as $optionId => $optionValue) { @@ -128,7 +128,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { $totalLables = $maxSize = $defaultDiscounts = array(); foreach ($discountedEvent as $optionGroupId) { $defaults['discount_price_set'][] = $optionGroupId; - $name = $defaults["discount_name[$i]"] = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $optionGroupId, 'title'); + $name = $defaults["discount_name[$i]"] = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $optionGroupId, 'title'); list($defaults["discount_start_date[$i]"]) = CRM_Utils_Date::setDateDefaults(CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Discount', $optionGroupId, 'start_date', 'price_set_id' @@ -136,7 +136,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { list($defaults["discount_end_date[$i]"]) = CRM_Utils_Date::setDateDefaults(CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Discount', $optionGroupId, 'end_date', 'price_set_id' )); - $defaultDiscounts[] = CRM_Price_BAO_Set::getSetDetail($optionGroupId); + $defaultDiscounts[] = CRM_Price_BAO_PriceSet::getSetDetail($optionGroupId); $i++; } @@ -275,7 +275,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { $this->add('text', 'fee_label', ts('Fee Label')); - $price = CRM_Price_BAO_Set::getAssoc(FALSE, 'CiviEvent'); + $price = CRM_Price_BAO_PriceSet::getAssoc(FALSE, 'CiviEvent'); if (CRM_Utils_System::isNull($price)) { $this->assign('price', FALSE); } @@ -358,7 +358,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { //discount name $this->add('text', 'discount_name[' . $i . ']', ts('Discount Name'), - CRM_Core_DAO::getAttribute('CRM_Price_DAO_Set', 'title') + CRM_Core_DAO::getAttribute('CRM_Price_DAO_PriceSet', 'title') ); $this->add('hidden', "discount_price_set[$i]", '', array('id' => "discount_price_set[$i]")); @@ -576,17 +576,17 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { // delete all the prior label values or discounts in the custom options table // and delete a price set if one exists - if (CRM_Price_BAO_Set::removeFrom('civicrm_event', $this->_id)) { + if (CRM_Price_BAO_PriceSet::removeFrom('civicrm_event', $this->_id)) { CRM_Core_BAO_Discount::del($this->_id,'civicrm_event'); } } if ($params['is_monetary']) { if (CRM_Utils_Array::value('price_set_id', $params)) { - CRM_Price_BAO_Set::addTo('civicrm_event', $this->_id, $params['price_set_id']); + CRM_Price_BAO_PriceSet::addTo('civicrm_event', $this->_id, $params['price_set_id']); if (CRM_Utils_Array::value('price_field_id', $params)) { - $priceSetID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Field', $params['price_field_id'], 'price_set_id'); - CRM_Price_BAO_Set::setIsQuickConfig($priceSetID,0); + $priceSetID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $params['price_field_id'], 'price_set_id'); + CRM_Price_BAO_PriceSet::setIsQuickConfig($priceSetID,0); } } else { @@ -612,10 +612,10 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { if (!CRM_Utils_Array::value('price_field_id', $params)) { $setParams['title'] = $eventTitle = ($this->_isTemplate) ? $this->_defaultValues['template_title'] : $this->_defaultValues['title']; $eventTitle = strtolower(CRM_Utils_String::munge($eventTitle, '_', 245)); - if (!CRM_Core_DAO::getFieldValue('CRM_Price_BAO_Set', $eventTitle, 'id', 'name')) { + if (!CRM_Core_DAO::getFieldValue('CRM_Price_BAO_PriceSet', $eventTitle, 'id', 'name')) { $setParams['name'] = $eventTitle; } - elseif (!CRM_Core_DAO::getFieldValue('CRM_Price_BAO_Set', $eventTitle . '_' . $this->_id, 'id', 'name')) { + elseif (!CRM_Core_DAO::getFieldValue('CRM_Price_BAO_PriceSet', $eventTitle . '_' . $this->_id, 'id', 'name')) { $setParams['name'] = $eventTitle . '_' . $this->_id; } else { @@ -624,7 +624,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { } $setParams['is_quick_config'] = 1; $setParams['extends'] = CRM_Core_Component::getComponentID('CiviEvent'); - $priceSet = CRM_Price_BAO_Set::create($setParams); + $priceSet = CRM_Price_BAO_PriceSet::create($setParams); $fieldParams['name'] = $fieldParams['label'] = $params['fee_label']; $fieldParams['price_set_id'] = $priceSet->id; @@ -632,23 +632,23 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { else { foreach ($params['price_field_value'] as $arrayID => $fieldValueID) { if (empty($params['label'][$arrayID]) && empty($params['value'][$arrayID]) && !empty($fieldValueID)) { - CRM_Price_BAO_FieldValue::setIsActive($fieldValueID, '0'); + CRM_Price_BAO_PriceFieldValue::setIsActive($fieldValueID, '0'); unset($params['price_field_value'][$arrayID]); } } $fieldParams['id'] = CRM_Utils_Array::value('price_field_id', $params); $fieldParams['option_id'] = $params['price_field_value']; - $priceSet = new CRM_Price_BAO_Set(); - $priceSet->id = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Field', CRM_Utils_Array::value('price_field_id', $params), 'price_set_id'); + $priceSet = new CRM_Price_BAO_PriceSet(); + $priceSet->id = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', CRM_Utils_Array::value('price_field_id', $params), 'price_set_id'); } $fieldParams['html_type'] = 'Radio'; - CRM_Price_BAO_Set::addTo('civicrm_event', $this->_id, $priceSet->id); + CRM_Price_BAO_PriceSet::addTo('civicrm_event', $this->_id, $priceSet->id); $fieldParams['option_label'] = $params['label']; $fieldParams['option_amount'] = $params['value']; $fieldParams['financial_type_id'] = $params['financial_type_id']; foreach ($options as $value) $fieldParams['option_weight'][$value['weight']] = $value['weight']; $fieldParams['default_option'] = $params['default']; - $priceField = CRM_Price_BAO_Field::create($fieldParams); + $priceField = CRM_Price_BAO_PriceField::create($fieldParams); } } } @@ -687,10 +687,10 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { $eventTitle = strtolower(CRM_Utils_String::munge($this->_defaultValues['title'], '_', 200)); } $setParams['title'] = $params['discount_name'][$j]; - if (!CRM_Core_DAO::getFieldValue('CRM_Price_BAO_Set', $eventTitle . '_' . $params['discount_name'][$j], 'id', 'name')) { + if (!CRM_Core_DAO::getFieldValue('CRM_Price_BAO_PriceSet', $eventTitle . '_' . $params['discount_name'][$j], 'id', 'name')) { $setParams['name'] = $eventTitle . '_' . $params['discount_name'][$j]; } - elseif (!CRM_Core_DAO::getFieldValue('CRM_Price_BAO_Set', $eventTitle . '_' . $params['discount_name'][$j] . '_' . $this->_id, 'id', 'name')) { + elseif (!CRM_Core_DAO::getFieldValue('CRM_Price_BAO_PriceSet', $eventTitle . '_' . $params['discount_name'][$j] . '_' . $this->_id, 'id', 'name')) { $setParams['name'] = $eventTitle . '_' . $params['discount_name'][$j] . '_' . $this->_id; } else { @@ -699,12 +699,12 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { } $setParams['is_quick_config'] = 1; $setParams['extends'] = CRM_Core_Component::getComponentID('CiviEvent'); - $priceSet = CRM_Price_BAO_Set::create($setParams); + $priceSet = CRM_Price_BAO_PriceSet::create($setParams); $priceSetID = $priceSet->id; } else { $priceSetID = $discountPriceSets[$j-1]; unset($discountPriceSets[$j-1]); - $fieldParams['id'] = CRM_Core_DAO::getFieldValue('CRM_Price_BAO_Field', $priceSetID, 'id', 'price_set_id'); + $fieldParams['id'] = CRM_Core_DAO::getFieldValue('CRM_Price_BAO_PriceField', $priceSetID, 'id', 'price_set_id'); } $fieldParams['name'] = $fieldParams['label'] = $params['fee_label']; @@ -725,10 +725,10 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { } } //create discount priceset - $priceField = CRM_Price_BAO_Field::create($fieldParams); + $priceField = CRM_Price_BAO_PriceField::create($fieldParams); if (!empty($discountFieldIDs)) { foreach($discountFieldIDs as $fID){ - CRM_Price_BAO_FieldValue::setIsActive($fID, '0'); + CRM_Price_BAO_PriceFieldValue::setIsActive($fID, '0'); } } @@ -746,15 +746,15 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { } if (!empty($discountPriceSets)) { foreach ($discountPriceSets as $setId) { - CRM_Price_BAO_Set::setIsQuickConfig($setId, 0); + CRM_Price_BAO_PriceSet::setIsQuickConfig($setId, 0); } } } } else { if (CRM_Utils_Array::value('price_field_id', $params)) { - $priceSetID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Field', $params['price_field_id'], 'price_set_id'); - CRM_Price_BAO_Set::setIsQuickConfig($priceSetID,0); + $priceSetID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $params['price_field_id'], 'price_set_id'); + CRM_Price_BAO_PriceSet::setIsQuickConfig($priceSetID,0); } $params['financial_type_id'] = ''; $params['is_pay_later'] = 0; diff --git a/CRM/Event/Form/Participant.php b/CRM/Event/Form/Participant.php index b71f3dd55d..bf4823d384 100644 --- a/CRM/Event/Form/Participant.php +++ b/CRM/Event/Form/Participant.php @@ -1007,7 +1007,7 @@ loadCampaign( {$this->_eID}, {$eventCampaigns} ); ($self->_id && !$self->_paymentId && isset($self->_values['line_items']) && is_array($self->_values['line_items'])) ) { if ($priceSetId = CRM_Utils_Array::value('priceSetId', $values)) { - CRM_Price_BAO_Field::priceSetValidation($priceSetId, $values, $errorMsg, TRUE); + CRM_Price_BAO_PriceField::priceSetValidation($priceSetId, $values, $errorMsg, TRUE); } } return CRM_Utils_Array::crmIsEmptyArray($errorMsg) ? TRUE : $errorMsg; @@ -1046,7 +1046,7 @@ loadCampaign( {$this->_eID}, {$eventCampaigns} ); if (CRM_Utils_Array::value('contact_select_id', $params)) { $this->_contactId = $params['contact_select_id'][1]; } - if ($this->_priceSetId && $isQuickConfig = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $this->_priceSetId, 'is_quick_config')) { + if ($this->_priceSetId && $isQuickConfig = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config')) { $this->_quickConfig = $isQuickConfig; } @@ -1094,7 +1094,7 @@ loadCampaign( {$this->_eID}, {$eventCampaigns} ); //lets carry currency, CRM-4453 $params['fee_currency'] = $config->defaultCurrency; - CRM_Price_BAO_Set::processAmount($this->_values['fee'], + CRM_Price_BAO_PriceSet::processAmount($this->_values['fee'], $params, $lineItem[0] ); //CRM-11529 for quick config backoffice transactions diff --git a/CRM/Event/Form/Registration.php b/CRM/Event/Form/Registration.php index 75cd2214f4..ae41826ccb 100644 --- a/CRM/Event/Form/Registration.php +++ b/CRM/Event/Form/Registration.php @@ -685,10 +685,10 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { } if ($discountId) { $priceSetId = CRM_Core_DAO::getFieldValue('CRM_Core_BAO_Discount', $discountId, 'price_set_id'); - $price = CRM_Price_BAO_Set::initSet($form, $eventID, 'civicrm_event', TRUE, $priceSetId); + $price = CRM_Price_BAO_PriceSet::initSet($form, $eventID, 'civicrm_event', TRUE, $priceSetId); } else { - $price = CRM_Price_BAO_Set::initSet($form, $eventID, 'civicrm_event', TRUE); + $price = CRM_Price_BAO_PriceSet::initSet($form, $eventID, 'civicrm_event', TRUE); } if (property_exists($form, '_context') && ($form->_context == 'standalone' @@ -696,12 +696,12 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { $discountedEvent = CRM_Core_BAO_Discount::getOptionGroup($eventID, 'civicrm_event'); if (is_array( $discountedEvent)) { foreach ($discountedEvent as $key => $priceSetId) { - $priceSet = CRM_Price_BAO_Set::getSetDetail($priceSetId); + $priceSet = CRM_Price_BAO_PriceSet::getSetDetail($priceSetId); $priceSet = CRM_Utils_Array::value($priceSetId, $priceSet); $form->_values['discount'][$key] = CRM_Utils_Array::value('fields', $priceSet); $fieldID = key($form->_values['discount'][$key]); $form->_values['discount'][$key][$fieldID]['name'] = CRM_Core_DAO::getFieldValue( - 'CRM_Price_DAO_Set', + 'CRM_Price_DAO_PriceSet', $priceSetId, 'title' ); diff --git a/CRM/Event/Form/Registration/AdditionalParticipant.php b/CRM/Event/Form/Registration/AdditionalParticipant.php index 6dc4850862..2ccac68733 100644 --- a/CRM/Event/Form/Registration/AdditionalParticipant.php +++ b/CRM/Event/Form/Registration/AdditionalParticipant.php @@ -219,7 +219,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R $includeSkipButton = TRUE; $this->_resetAllowWaitlist = FALSE; - $pricesetFieldsCount = CRM_Price_BAO_Set::getPricesetCount($this->_priceSetId); + $pricesetFieldsCount = CRM_Price_BAO_PriceSet::getPricesetCount($this->_priceSetId); if ($this->_lastParticipant || $pricesetFieldsCount) { //get the participant total. @@ -487,7 +487,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R } if ($button == 'skip' && $self->_lastParticipant && CRM_Utils_Array::value('priceSetId', $fields)) { - $pricesetFieldsCount = CRM_Price_BAO_Set::getPricesetCount($fields['priceSetId']); + $pricesetFieldsCount = CRM_Price_BAO_PriceSet::getPricesetCount($fields['priceSetId']); if (($pricesetFieldsCount < 1) || $self->_allowConfirmation) { return $errors; } @@ -532,7 +532,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R $validatePayement = FALSE; if (CRM_Utils_Array::value('priceSetId', $fields)) { $lineItem = array(); - CRM_Price_BAO_Set::processAmount($self->_values['fee'], $fields, $lineItem); + CRM_Price_BAO_PriceSet::processAmount($self->_values['fee'], $fields, $lineItem); if ($fields['amount'] > 0) { $validatePayement = TRUE; // $self->_forcePayement = true; @@ -667,7 +667,7 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R } else { $lineItem = array(); - CRM_Price_BAO_Set::processAmount($this->_values['fee'], $params, $lineItem); + CRM_Price_BAO_PriceSet::processAmount($this->_values['fee'], $params, $lineItem); //build the line item.. if (array_key_exists($addParticipantNum, $this->_lineItem)) { diff --git a/CRM/Event/Form/Registration/Confirm.php b/CRM/Event/Form/Registration/Confirm.php index 0ba42e19be..5b954aef33 100644 --- a/CRM/Event/Form/Registration/Confirm.php +++ b/CRM/Event/Form/Registration/Confirm.php @@ -277,7 +277,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { $this->set('totalAmount', $this->_totalAmount); } - if ($this->_priceSetId && !CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $this->_priceSetId, 'is_quick_config')) { + if ($this->_priceSetId && !CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config')) { $lineItemForTemplate = array(); foreach ($this->_lineItem as $key => $value) { if (!empty($value)) { @@ -437,7 +437,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { $this->assign('isRequireApproval', $this->_requireApproval); // Assign Participant Count to Lineitem Table - $this->assign('pricesetFieldsCount', CRM_Price_BAO_Set::getPricesetCount($this->_priceSetId)); + $this->assign('pricesetFieldsCount', CRM_Price_BAO_PriceSet::getPricesetCount($this->_priceSetId)); } /** diff --git a/CRM/Event/Form/Registration/Register.php b/CRM/Event/Form/Registration/Register.php index 1687abb3c1..eced79d0c9 100644 --- a/CRM/Event/Form/Registration/Register.php +++ b/CRM/Event/Form/Registration/Register.php @@ -626,7 +626,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { } //build the element. - CRM_Price_BAO_Field::addQuickFormElement($form, + CRM_Price_BAO_PriceField::addQuickFormElement($form, $elementName, $fieldId, FALSE, @@ -842,7 +842,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { } $lineItem = array(); - CRM_Price_BAO_Set::processAmount($self->_values['fee'], $fields, $lineItem); + CRM_Price_BAO_PriceSet::processAmount($self->_values['fee'], $fields, $lineItem); if ($fields['amount'] < 0) { $errors['_qf_default'] = ts('Event Fee(s) can not be less than zero. Please select the options accordingly'); } @@ -1049,7 +1049,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { } else { $lineItem = array(); - CRM_Price_BAO_Set::processAmount($this->_values['fee'], $params, $lineItem); + CRM_Price_BAO_PriceSet::processAmount($this->_values['fee'], $params, $lineItem); $this->set('lineItem', array($lineItem)); $this->set('lineItemParticipantsCount', array($primaryParticipantCount)); } diff --git a/CRM/Event/Form/Registration/ThankYou.php b/CRM/Event/Form/Registration/ThankYou.php index 588df3794e..2f1a2dc6ca 100644 --- a/CRM/Event/Form/Registration/ThankYou.php +++ b/CRM/Event/Form/Registration/ThankYou.php @@ -99,7 +99,7 @@ class CRM_Event_Form_Registration_ThankYou extends CRM_Event_Form_Registration { } $this->assignToTemplate(); - if ($this->_priceSetId && !CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $this->_priceSetId, 'is_quick_config')) { + if ($this->_priceSetId && !CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config')) { $lineItemForTemplate = array(); foreach ($this->_lineItem as $key => $value) { if (!empty($value)) { @@ -203,7 +203,7 @@ class CRM_Event_Form_Registration_ThankYou extends CRM_Event_Form_Registration { } // Assign Participant Count to Lineitem Table - $this->assign('pricesetFieldsCount', CRM_Price_BAO_Set::getPricesetCount($this->_priceSetId)); + $this->assign('pricesetFieldsCount', CRM_Price_BAO_PriceSet::getPricesetCount($this->_priceSetId)); // can we blow away the session now to prevent hackery $this->controller->reset(); diff --git a/CRM/Event/Page/EventInfo.php b/CRM/Event/Page/EventInfo.php index 1f24b1377b..4e6cf32acb 100644 --- a/CRM/Event/Page/EventInfo.php +++ b/CRM/Event/Page/EventInfo.php @@ -104,12 +104,12 @@ class CRM_Event_Page_EventInfo extends CRM_Core_Page { if ($discountId) { $priceSetId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Discount', $discountId, 'price_set_id'); } else { - $priceSetId = CRM_Price_BAO_Set::getFor('civicrm_event', $this->_id); + $priceSetId = CRM_Price_BAO_PriceSet::getFor('civicrm_event', $this->_id); } // get price set options, - CRM-5209 if ($priceSetId) { - $setDetails = CRM_Price_BAO_Set::getSetDetail($priceSetId, TRUE, TRUE); + $setDetails = CRM_Price_BAO_PriceSet::getSetDetail($priceSetId, TRUE, TRUE); $priceSetFields = $setDetails[$priceSetId]['fields']; if (is_array($priceSetFields)) { diff --git a/CRM/Mailing/BAO/Mailing.php b/CRM/Mailing/BAO/Mailing.php index ac1f20e9d6..a38ddbf2f4 100644 --- a/CRM/Mailing/BAO/Mailing.php +++ b/CRM/Mailing/BAO/Mailing.php @@ -111,7 +111,7 @@ class CRM_Mailing_BAO_Mailing extends CRM_Mailing_DAO_Mailing { $mailingGroup = new CRM_Mailing_DAO_MailingGroup(); $mailing = CRM_Mailing_BAO_Mailing::getTableName(); - $job = CRM_Mailing_BAO_Job::getTableName(); + $job = CRM_Mailing_BAO_MailingJob::getTableName(); $mg = CRM_Mailing_DAO_MailingGroup::getTableName(); $eq = CRM_Mailing_Event_DAO_Queue::getTableName(); $ed = CRM_Mailing_Event_DAO_Delivered::getTableName(); @@ -1603,7 +1603,7 @@ ORDER BY civicrm_email.is_bulkmail DESC * CRM_Mailing_Form_Schedule::postProcess() or via API. */ if (isset($params['approval_status_id']) && $params['approval_status_id']) { - $job = new CRM_Mailing_BAO_Job(); + $job = new CRM_Mailing_BAO_MailingJob(); $job->mailing_id = $mailing->id; $job->status = 'Scheduled'; $job->is_test = 0; @@ -1636,7 +1636,7 @@ ORDER BY civicrm_email.is_bulkmail DESC 'mailing' => self::getTableName(), 'mailing_group' => CRM_Mailing_DAO_MailingGroup::getTableName(), 'group' => CRM_Contact_BAO_Group::getTableName(), - 'job' => CRM_Mailing_BAO_Job::getTableName(), + 'job' => CRM_Mailing_BAO_MailingJob::getTableName(), 'queue' => CRM_Mailing_Event_BAO_Queue::getTableName(), 'delivered' => CRM_Mailing_Event_BAO_Delivered::getTableName(), 'opened' => CRM_Mailing_Event_BAO_Opened::getTableName(), @@ -1848,7 +1848,7 @@ ORDER BY civicrm_email.is_bulkmail DESC $row['optout'] = CRM_Mailing_Event_BAO_Unsubscribe::getTotalCount($mailing_id, $mailing->id, TRUE, FALSE); $report['event_totals']['optout'] += $row['optout']; - foreach (array_keys(CRM_Mailing_BAO_Job::fields()) as $field) { + foreach (array_keys(CRM_Mailing_BAO_MailingJob::fields()) as $field) { $row[$field] = $mailing->$field; } @@ -2195,7 +2195,7 @@ LEFT JOIN civicrm_mailing_group g ON g.mailing_id = m.id */ public function &getRows($offset, $rowCount, $sort, $additionalClause = NULL, $additionalParams = NULL) { $mailing = self::getTableName(); - $job = CRM_Mailing_BAO_Job::getTableName(); + $job = CRM_Mailing_BAO_MailingJob::getTableName(); $group = CRM_Mailing_DAO_MailingGroup::getTableName(); $session = CRM_Core_Session::singleton(); @@ -2324,7 +2324,7 @@ LEFT JOIN civicrm_mailing_group g ON g.mailing_id = m.id CRM_Core_Error::fatal(); } - $dao = new CRM_Mailing_BAO_Job(); + $dao = new CRM_Mailing_BAO_MailingJob(); $dao->id = $id; $dao->delete(); } @@ -2671,9 +2671,9 @@ WHERE civicrm_mailing_job.id = %1 // load bootstrap to call hooks // Split up the parent jobs into multiple child jobs - CRM_Mailing_BAO_Job::runJobs_pre($config->mailerJobSize, $mode); - CRM_Mailing_BAO_Job::runJobs(NULL, $mode); - CRM_Mailing_BAO_Job::runJobs_post($mode); + CRM_Mailing_BAO_MailingJob::runJobs_pre($config->mailerJobSize, $mode); + CRM_Mailing_BAO_MailingJob::runJobs(NULL, $mode); + CRM_Mailing_BAO_MailingJob::runJobs_post($mode); // lets release the global cron lock if we do have one if ($gotCronLock) { diff --git a/CRM/Mailing/BAO/Job.php b/CRM/Mailing/BAO/MailingJob.php similarity index 96% rename from CRM/Mailing/BAO/Job.php rename to CRM/Mailing/BAO/MailingJob.php index 7bccdb030d..a2b9b60780 100644 --- a/CRM/Mailing/BAO/Job.php +++ b/CRM/Mailing/BAO/MailingJob.php @@ -34,7 +34,7 @@ */ require_once 'Mail.php'; -class CRM_Mailing_BAO_Job extends CRM_Mailing_DAO_Job { +class CRM_Mailing_BAO_MailingJob extends CRM_Mailing_DAO_MailingJob { CONST MAX_CONTACTS_TO_PROCESS = 1000; /** @@ -45,7 +45,7 @@ class CRM_Mailing_BAO_Job extends CRM_Mailing_DAO_Job { } function create ($params){ - $job = new CRM_Mailing_BAO_Job(); + $job = new CRM_Mailing_BAO_MailingJob(); $job->mailing_id = $params['mailing_id']; $job->status = $params['status']; $job->scheduled_date = $params['scheduled_date']; @@ -63,10 +63,10 @@ class CRM_Mailing_BAO_Job extends CRM_Mailing_DAO_Job { * @static */ public static function runJobs($testParams = NULL, $mode = NULL) { - $job = new CRM_Mailing_BAO_Job(); + $job = new CRM_Mailing_BAO_MailingJob(); $config = CRM_Core_Config::singleton(); - $jobTable = CRM_Mailing_DAO_Job::getTableName(); + $jobTable = CRM_Mailing_DAO_MailingJob::getTableName(); $mailingTable = CRM_Mailing_DAO_Mailing::getTableName(); if (!empty($testParams)) { @@ -152,7 +152,7 @@ class CRM_Mailing_BAO_Job extends CRM_Mailing_DAO_Job { $job->queue($testParams); // Mark up the starting time - $saveJob = new CRM_Mailing_DAO_Job(); + $saveJob = new CRM_Mailing_DAO_MailingJob(); $saveJob->id = $job->id; $saveJob->start_date = date('YmdHis'); $saveJob->status = 'Running'; @@ -181,7 +181,7 @@ class CRM_Mailing_BAO_Job extends CRM_Mailing_DAO_Job { $transaction = new CRM_Core_Transaction(); - $saveJob = new CRM_Mailing_DAO_Job(); + $saveJob = new CRM_Mailing_DAO_MailingJob(); $saveJob->id = $job->id; $saveJob->end_date = date('YmdHis'); $saveJob->status = 'Complete'; @@ -205,12 +205,12 @@ class CRM_Mailing_BAO_Job extends CRM_Mailing_DAO_Job { // as well as the mailing is complete after the run public static function runJobs_post($mode = NULL) { - $job = new CRM_Mailing_BAO_Job(); + $job = new CRM_Mailing_BAO_MailingJob(); $mailing = new CRM_Mailing_BAO_Mailing(); $config = CRM_Core_Config::singleton(); - $jobTable = CRM_Mailing_DAO_Job::getTableName(); + $jobTable = CRM_Mailing_DAO_MailingJob::getTableName(); $mailingTable = CRM_Mailing_DAO_Mailing::getTableName(); $currentTime = date('YmdHis'); @@ -235,7 +235,7 @@ class CRM_Mailing_BAO_Job extends CRM_Mailing_DAO_Job { // For each parent job that is running, let's look at their child jobs while ($job->fetch()) { - $child_job = new CRM_Mailing_BAO_Job(); + $child_job = new CRM_Mailing_BAO_MailingJob(); $child_job_sql = " SELECT count(j.id) @@ -254,7 +254,7 @@ class CRM_Mailing_BAO_Job extends CRM_Mailing_DAO_Job { $transaction = new CRM_Core_Transaction(); - $saveJob = new CRM_Mailing_DAO_Job(); + $saveJob = new CRM_Mailing_DAO_MailingJob(); $saveJob->id = $job->id; $saveJob->end_date = date('YmdHis'); $saveJob->status = 'Complete'; @@ -272,17 +272,17 @@ class CRM_Mailing_BAO_Job extends CRM_Mailing_DAO_Job { // before we run jobs, we need to split the jobs public static function runJobs_pre($offset = 200, $mode = NULL) { - $job = new CRM_Mailing_BAO_Job(); + $job = new CRM_Mailing_BAO_MailingJob(); $config = CRM_Core_Config::singleton(); - $jobTable = CRM_Mailing_DAO_Job::getTableName(); + $jobTable = CRM_Mailing_DAO_MailingJob::getTableName(); $mailingTable = CRM_Mailing_DAO_Mailing::getTableName(); $currentTime = date('YmdHis'); $mailingACL = CRM_Mailing_BAO_Mailing::mailingACL('m'); - $workflowClause = CRM_Mailing_BAO_Job::workflowClause(); + $workflowClause = CRM_Mailing_BAO_MailingJob::workflowClause(); $domainID = CRM_Core_Config::domainID(); @@ -344,7 +344,7 @@ class CRM_Mailing_BAO_Job extends CRM_Mailing_DAO_Job { // update the status of the parent job $transaction = new CRM_Core_Transaction(); - $saveJob = new CRM_Mailing_DAO_Job(); + $saveJob = new CRM_Mailing_DAO_MailingJob(); $saveJob->id = $job->id; $saveJob->start_date = date('YmdHis'); $saveJob->status = 'Running'; @@ -362,7 +362,7 @@ class CRM_Mailing_BAO_Job extends CRM_Mailing_DAO_Job { public function split_job($offset = 200) { $recipient_count = CRM_Mailing_BAO_Recipients::mailingSize($this->mailing_id); - $jobTable = CRM_Mailing_DAO_Job::getTableName(); + $jobTable = CRM_Mailing_DAO_MailingJob::getTableName(); $dao = new CRM_Core_DAO(); @@ -780,7 +780,7 @@ AND ( ( job_type IS NULL ) OR in_array($job->status, array('Scheduled', 'Running', 'Paused')) ) { - $newJob = new CRM_Mailing_BAO_Job(); + $newJob = new CRM_Mailing_BAO_MailingJob(); $newJob->id = $job->id; $newJob->end_date = date('YmdHis'); $newJob->status = 'Canceled'; diff --git a/CRM/Mailing/BAO/Spool.php b/CRM/Mailing/BAO/Spool.php index 0d4ee7d16f..40c7c18cab 100644 --- a/CRM/Mailing/BAO/Spool.php +++ b/CRM/Mailing/BAO/Spool.php @@ -91,7 +91,7 @@ class CRM_Mailing_BAO_Spool extends CRM_Mailing_DAO_Spool { return PEAR::raiseError( 'Unable to create spooled mailing.' ); } - $job = new CRM_Mailing_BAO_Job(); + $job = new CRM_Mailing_BAO_MailingJob(); $job->is_test = 0; // if set to 1 it doesn't show in the UI $job->status = 'Complete'; $job->scheduled_date = CRM_Utils_Date::processDate(date('Y-m-d'), date('H:i:s')); @@ -101,7 +101,7 @@ class CRM_Mailing_BAO_Spool extends CRM_Mailing_DAO_Spool { $job->save(); $job_id = $job->id; // need this for parent_id below - $job = new CRM_Mailing_BAO_Job(); + $job = new CRM_Mailing_BAO_MailingJob(); $job->is_test = 0; $job->status = 'Complete'; $job->scheduled_date = CRM_Utils_Date::processDate(date('Y-m-d'), date('H:i:s')); diff --git a/CRM/Mailing/Event/BAO/Bounce.php b/CRM/Mailing/Event/BAO/Bounce.php index 10d4ae842e..95128300c9 100644 --- a/CRM/Mailing/Event/BAO/Bounce.php +++ b/CRM/Mailing/Event/BAO/Bounce.php @@ -137,7 +137,7 @@ class CRM_Mailing_Event_BAO_Bounce extends CRM_Mailing_Event_DAO_Bounce { $bounce = self::getTableName(); $queue = CRM_Mailing_Event_BAO_Queue::getTableName(); $mailing = CRM_Mailing_BAO_Mailing::getTableName(); - $job = CRM_Mailing_BAO_Job::getTableName(); + $job = CRM_Mailing_BAO_MailingJob::getTableName(); $query = " SELECT COUNT($bounce.id) as bounce @@ -192,7 +192,7 @@ class CRM_Mailing_Event_BAO_Bounce extends CRM_Mailing_Event_DAO_Bounce { $bounceType = CRM_Mailing_DAO_BounceType::getTableName(); $queue = CRM_Mailing_Event_BAO_Queue::getTableName(); $mailing = CRM_Mailing_BAO_Mailing::getTableName(); - $job = CRM_Mailing_BAO_Job::getTableName(); + $job = CRM_Mailing_BAO_MailingJob::getTableName(); $contact = CRM_Contact_BAO_Contact::getTableName(); $email = CRM_Core_BAO_Email::getTableName(); diff --git a/CRM/Mailing/Event/BAO/Delivered.php b/CRM/Mailing/Event/BAO/Delivered.php index 6c01049559..209f89edea 100644 --- a/CRM/Mailing/Event/BAO/Delivered.php +++ b/CRM/Mailing/Event/BAO/Delivered.php @@ -99,7 +99,7 @@ class CRM_Mailing_Event_BAO_Delivered extends CRM_Mailing_Event_DAO_Delivered { $bounce = CRM_Mailing_Event_BAO_Bounce::getTableName(); $queue = CRM_Mailing_Event_BAO_Queue::getTableName(); $mailing = CRM_Mailing_BAO_Mailing::getTableName(); - $job = CRM_Mailing_BAO_Job::getTableName(); + $job = CRM_Mailing_BAO_MailingJob::getTableName(); $query = " SELECT COUNT($delivered.id) as delivered @@ -158,7 +158,7 @@ class CRM_Mailing_Event_BAO_Delivered extends CRM_Mailing_Event_DAO_Delivered { $bounce = CRM_Mailing_Event_BAO_Bounce::getTableName(); $queue = CRM_Mailing_Event_BAO_Queue::getTableName(); $mailing = CRM_Mailing_BAO_Mailing::getTableName(); - $job = CRM_Mailing_BAO_Job::getTableName(); + $job = CRM_Mailing_BAO_MailingJob::getTableName(); $contact = CRM_Contact_BAO_Contact::getTableName(); $email = CRM_Core_BAO_Email::getTableName(); diff --git a/CRM/Mailing/Event/BAO/Forward.php b/CRM/Mailing/Event/BAO/Forward.php index 9f479685f5..052e4fc705 100644 --- a/CRM/Mailing/Event/BAO/Forward.php +++ b/CRM/Mailing/Event/BAO/Forward.php @@ -59,7 +59,7 @@ class CRM_Mailing_Event_BAO_Forward extends CRM_Mailing_Event_DAO_Forward { $location = CRM_Core_BAO_Location::getTableName(); $email = CRM_Core_BAO_Email::getTableName(); $queueTable = CRM_Mailing_Event_BAO_Queue::getTableName(); - $job = CRM_Mailing_BAO_Job::getTableName(); + $job = CRM_Mailing_BAO_MailingJob::getTableName(); $mailing = CRM_Mailing_BAO_Mailing::getTableName(); $forward = self::getTableName(); @@ -234,7 +234,7 @@ class CRM_Mailing_Event_BAO_Forward extends CRM_Mailing_Event_DAO_Forward { $forward = self::getTableName(); $queue = CRM_Mailing_Event_BAO_Queue::getTableName(); $mailing = CRM_Mailing_BAO_Mailing::getTableName(); - $job = CRM_Mailing_BAO_Job::getTableName(); + $job = CRM_Mailing_BAO_MailingJob::getTableName(); $query = " SELECT COUNT($forward.id) as forward @@ -289,7 +289,7 @@ class CRM_Mailing_Event_BAO_Forward extends CRM_Mailing_Event_DAO_Forward { $forward = self::getTableName(); $queue = CRM_Mailing_Event_BAO_Queue::getTableName(); $mailing = CRM_Mailing_BAO_Mailing::getTableName(); - $job = CRM_Mailing_BAO_Job::getTableName(); + $job = CRM_Mailing_BAO_MailingJob::getTableName(); $contact = CRM_Contact_BAO_Contact::getTableName(); $email = CRM_Core_BAO_Email::getTableName(); diff --git a/CRM/Mailing/Event/BAO/Opened.php b/CRM/Mailing/Event/BAO/Opened.php index 85844be35f..7ea885b6b9 100644 --- a/CRM/Mailing/Event/BAO/Opened.php +++ b/CRM/Mailing/Event/BAO/Opened.php @@ -88,7 +88,7 @@ class CRM_Mailing_Event_BAO_Opened extends CRM_Mailing_Event_DAO_Opened { $open = self::getTableName(); $queue = CRM_Mailing_Event_BAO_Queue::getTableName(); $mailing = CRM_Mailing_BAO_Mailing::getTableName(); - $job = CRM_Mailing_BAO_Job::getTableName(); + $job = CRM_Mailing_BAO_MailingJob::getTableName(); $query = " SELECT COUNT($open.id) as opened @@ -136,7 +136,7 @@ class CRM_Mailing_Event_BAO_Opened extends CRM_Mailing_Event_DAO_Opened { $open = self::getTableName(); $queue = CRM_Mailing_Event_BAO_Queue::getTableName(); - $job = CRM_Mailing_BAO_Job::getTableName(); + $job = CRM_Mailing_BAO_MailingJob::getTableName(); $mailingIDs = implode(',', $mailingIDs); $query = " @@ -182,7 +182,7 @@ class CRM_Mailing_Event_BAO_Opened extends CRM_Mailing_Event_DAO_Opened { $open = self::getTableName(); $queue = CRM_Mailing_Event_BAO_Queue::getTableName(); $mailing = CRM_Mailing_BAO_Mailing::getTableName(); - $job = CRM_Mailing_BAO_Job::getTableName(); + $job = CRM_Mailing_BAO_MailingJob::getTableName(); $contact = CRM_Contact_BAO_Contact::getTableName(); $email = CRM_Core_BAO_Email::getTableName(); diff --git a/CRM/Mailing/Event/BAO/Queue.php b/CRM/Mailing/Event/BAO/Queue.php index df009a5270..6a2701f481 100644 --- a/CRM/Mailing/Event/BAO/Queue.php +++ b/CRM/Mailing/Event/BAO/Queue.php @@ -144,7 +144,7 @@ class CRM_Mailing_Event_BAO_Queue extends CRM_Mailing_Event_DAO_Queue { $queue = self::getTableName(); $mailing = CRM_Mailing_BAO_Mailing::getTableName(); - $job = CRM_Mailing_BAO_Job::getTableName(); + $job = CRM_Mailing_BAO_MailingJob::getTableName(); $dao->query(" SELECT COUNT(*) as queued @@ -183,7 +183,7 @@ class CRM_Mailing_Event_BAO_Queue extends CRM_Mailing_Event_DAO_Queue { $queue = self::getTableName(); $mailing = CRM_Mailing_BAO_Mailing::getTableName(); - $job = CRM_Mailing_BAO_Job::getTableName(); + $job = CRM_Mailing_BAO_MailingJob::getTableName(); $contact = CRM_Contact_BAO_Contact::getTableName(); $email = CRM_Core_BAO_Email::getTableName(); @@ -252,7 +252,7 @@ class CRM_Mailing_Event_BAO_Queue extends CRM_Mailing_Event_DAO_Queue { */ public function &getMailing() { $mailing = new CRM_Mailing_BAO_Mailing(); - $jobs = CRM_Mailing_BAO_Job::getTableName(); + $jobs = CRM_Mailing_BAO_MailingJob::getTableName(); $mailings = CRM_Mailing_BAO_Mailing::getTableName(); $queue = self::getTableName(); diff --git a/CRM/Mailing/Event/BAO/Reply.php b/CRM/Mailing/Event/BAO/Reply.php index 32a1bf3ef1..024a502e5b 100644 --- a/CRM/Mailing/Event/BAO/Reply.php +++ b/CRM/Mailing/Event/BAO/Reply.php @@ -70,7 +70,7 @@ class CRM_Mailing_Event_BAO_Reply extends CRM_Mailing_Event_DAO_Reply { $mailing = new CRM_Mailing_BAO_Mailing(); $mailings = CRM_Mailing_BAO_Mailing::getTableName(); - $jobs = CRM_Mailing_BAO_Job::getTableName(); + $jobs = CRM_Mailing_BAO_MailingJob::getTableName(); $mailing->query( "SELECT * FROM $mailings INNER JOIN $jobs @@ -307,7 +307,7 @@ class CRM_Mailing_Event_BAO_Reply extends CRM_Mailing_Event_DAO_Reply { $reply = self::getTableName(); $queue = CRM_Mailing_Event_BAO_Queue::getTableName(); $mailing = CRM_Mailing_BAO_Mailing::getTableName(); - $job = CRM_Mailing_BAO_Job::getTableName(); + $job = CRM_Mailing_BAO_MailingJob::getTableName(); $query = " SELECT COUNT($reply.id) as reply @@ -362,7 +362,7 @@ class CRM_Mailing_Event_BAO_Reply extends CRM_Mailing_Event_DAO_Reply { $reply = self::getTableName(); $queue = CRM_Mailing_Event_BAO_Queue::getTableName(); $mailing = CRM_Mailing_BAO_Mailing::getTableName(); - $job = CRM_Mailing_BAO_Job::getTableName(); + $job = CRM_Mailing_BAO_MailingJob::getTableName(); $contact = CRM_Contact_BAO_Contact::getTableName(); $email = CRM_Core_BAO_Email::getTableName(); diff --git a/CRM/Mailing/Event/BAO/Resubscribe.php b/CRM/Mailing/Event/BAO/Resubscribe.php index 8794a5ebe6..2ecc707ded 100644 --- a/CRM/Mailing/Event/BAO/Resubscribe.php +++ b/CRM/Mailing/Event/BAO/Resubscribe.php @@ -70,7 +70,7 @@ class CRM_Mailing_Event_BAO_Resubscribe { $do = new CRM_Core_DAO(); $mg = CRM_Mailing_DAO_MailingGroup::getTableName(); - $job = CRM_Mailing_BAO_Job::getTableName(); + $job = CRM_Mailing_BAO_MailingJob::getTableName(); $mailing = CRM_Mailing_BAO_Mailing::getTableName(); $group = CRM_Contact_BAO_Group::getTableName(); $gc = CRM_Contact_BAO_GroupContact::getTableName(); @@ -199,7 +199,7 @@ class CRM_Mailing_Event_BAO_Resubscribe { $config = CRM_Core_Config::singleton(); $domain = CRM_Core_BAO_Domain::getDomain(); - $jobTable = CRM_Mailing_BAO_Job::getTableName(); + $jobTable = CRM_Mailing_BAO_MailingJob::getTableName(); $mailingTable = CRM_Mailing_DAO_Mailing::getTableName(); $contacts = CRM_Contact_DAO_Contact::getTableName(); $email = CRM_Core_DAO_Email::getTableName(); diff --git a/CRM/Mailing/Event/BAO/TrackableURLOpen.php b/CRM/Mailing/Event/BAO/TrackableURLOpen.php index e0057b7714..083cc7693f 100644 --- a/CRM/Mailing/Event/BAO/TrackableURLOpen.php +++ b/CRM/Mailing/Event/BAO/TrackableURLOpen.php @@ -60,7 +60,7 @@ class CRM_Mailing_Event_BAO_TrackableURLOpen extends CRM_Mailing_Event_DAO_Track * prevents foreign key violations. */ - $job = CRM_Mailing_BAO_Job::getTableName(); + $job = CRM_Mailing_BAO_MailingJob::getTableName(); $eq = CRM_Mailing_Event_BAO_Queue::getTableName(); $turl = CRM_Mailing_BAO_TrackableURL::getTableName(); @@ -115,7 +115,7 @@ class CRM_Mailing_Event_BAO_TrackableURLOpen extends CRM_Mailing_Event_DAO_Track $click = self::getTableName(); $queue = CRM_Mailing_Event_BAO_Queue::getTableName(); $mailing = CRM_Mailing_BAO_Mailing::getTableName(); - $job = CRM_Mailing_BAO_Job::getTableName(); + $job = CRM_Mailing_BAO_MailingJob::getTableName(); $query = " SELECT COUNT($click.id) as opened @@ -167,7 +167,7 @@ class CRM_Mailing_Event_BAO_TrackableURLOpen extends CRM_Mailing_Event_DAO_Track $click = self::getTableName(); $queue = CRM_Mailing_Event_BAO_Queue::getTableName(); - $job = CRM_Mailing_BAO_Job::getTableName(); + $job = CRM_Mailing_BAO_MailingJob::getTableName(); $mailingIDs = implode(',', $mailingIDs); $query = " @@ -217,7 +217,7 @@ class CRM_Mailing_Event_BAO_TrackableURLOpen extends CRM_Mailing_Event_DAO_Track $url = CRM_Mailing_BAO_TrackableURL::getTableName(); $queue = CRM_Mailing_Event_BAO_Queue::getTableName(); $mailing = CRM_Mailing_BAO_Mailing::getTableName(); - $job = CRM_Mailing_BAO_Job::getTableName(); + $job = CRM_Mailing_BAO_MailingJob::getTableName(); $contact = CRM_Contact_BAO_Contact::getTableName(); $email = CRM_Core_BAO_Email::getTableName(); diff --git a/CRM/Mailing/Event/BAO/Unsubscribe.php b/CRM/Mailing/Event/BAO/Unsubscribe.php index 3404787408..676558df19 100644 --- a/CRM/Mailing/Event/BAO/Unsubscribe.php +++ b/CRM/Mailing/Event/BAO/Unsubscribe.php @@ -133,7 +133,7 @@ WHERE email = %2 $do = new CRM_Core_DAO(); $mgObject = new CRM_Mailing_DAO_MailingGroup(); $mg = $mgObject->getTableName(); - $jobObject = new CRM_Mailing_BAO_Job(); + $jobObject = new CRM_Mailing_BAO_MailingJob(); $job = $jobObject->getTableName(); $mailingObject = new CRM_Mailing_BAO_Mailing(); $mailing = $mailingObject->getTableName(); @@ -295,7 +295,7 @@ WHERE email = %2 $config = CRM_Core_Config::singleton(); $domain = CRM_Core_BAO_Domain::getDomain(); - $jobObject = new CRM_Mailing_BAO_Job(); + $jobObject = new CRM_Mailing_BAO_MailingJob(); $jobTable = $jobObject->getTableName(); $mailingObject = new CRM_Mailing_DAO_Mailing(); $mailingTable = $mailingObject->getTableName(); @@ -423,7 +423,7 @@ WHERE email = %2 $queue = $queueObject->getTableName(); $mailingObject = new CRM_Mailing_BAO_Mailing(); $mailing = $mailingObject->getTableName(); - $jobObject = new CRM_Mailing_BAO_Job(); + $jobObject = new CRM_Mailing_BAO_MailingJob(); $job = $jobObject->getTableName(); $query = " @@ -486,7 +486,7 @@ WHERE email = %2 $queue = $queueObject->getTableName(); $mailingObject = new CRM_Mailing_BAO_Mailing(); $mailing = $mailingObject->getTableName(); - $jobObject = new CRM_Mailing_BAO_Job(); + $jobObject = new CRM_Mailing_BAO_MailingJob(); $job = $jobObject->getTableName(); $contactObject = new CRM_Contact_BAO_Contact(); $contact = $contactObject->getTableName(); diff --git a/CRM/Mailing/Form/Approve.php b/CRM/Mailing/Form/Approve.php index e6d1f46d25..a49eeb8639 100644 --- a/CRM/Mailing/Form/Approve.php +++ b/CRM/Mailing/Form/Approve.php @@ -192,7 +192,7 @@ class CRM_Mailing_Form_Approve extends CRM_Core_Form { $params['scheduled_date'] = 'null'; // also delete any jobs associated with this mailing - $job = new CRM_Mailing_BAO_Job(); + $job = new CRM_Mailing_BAO_MailingJob(); $job->mailing_id = $ids['mailing_id']; $job->delete(); } diff --git a/CRM/Mailing/Form/Browse.php b/CRM/Mailing/Form/Browse.php index b7b885e558..f00b460086 100644 --- a/CRM/Mailing/Form/Browse.php +++ b/CRM/Mailing/Form/Browse.php @@ -103,7 +103,7 @@ class CRM_Mailing_Form_Browse extends CRM_Core_Form { CRM_Mailing_BAO_Mailing::del($this->_mailingId); } elseif ($this->_action & CRM_Core_Action::DISABLE) { - CRM_Mailing_BAO_Job::cancel($this->_mailingId); + CRM_Mailing_BAO_MailingJob::cancel($this->_mailingId); } elseif ($this->_action & CRM_Core_Action::RENEW) { //set is_archived to 1 diff --git a/CRM/Mailing/Form/Test.php b/CRM/Mailing/Form/Test.php index b6d47159cc..0ff07057d7 100644 --- a/CRM/Mailing/Form/Test.php +++ b/CRM/Mailing/Form/Test.php @@ -276,7 +276,7 @@ class CRM_Mailing_Form_Test extends CRM_Core_Form { return $error; } - $job = new CRM_Mailing_BAO_Job(); + $job = new CRM_Mailing_BAO_MailingJob(); $job->mailing_id = $self->get('mailing_id'); $job->is_test = TRUE; $job->save(); @@ -342,7 +342,7 @@ ORDER BY e.is_bulkmail DESC, e.is_primary DESC $testParams['job_id'] = $job->id; $isComplete = FALSE; while (!$isComplete) { - $isComplete = CRM_Mailing_BAO_Job::runJobs($testParams); + $isComplete = CRM_Mailing_BAO_MailingJob::runJobs($testParams); } if (CRM_Utils_Array::value('sendtest', $testParams)) { diff --git a/CRM/Mailing/Page/Browse.php b/CRM/Mailing/Page/Browse.php index 3ea830fc40..5756842f73 100644 --- a/CRM/Mailing/Page/Browse.php +++ b/CRM/Mailing/Page/Browse.php @@ -132,9 +132,9 @@ class CRM_Mailing_Page_Browse extends CRM_Core_Page { $newArgs = $newArgs[0]; if (isset($_GET['runJobs']) || CRM_Utils_Array::value('2', $newArgs) == 'queue') { $config = CRM_Core_Config::singleton(); - CRM_Mailing_BAO_Job::runJobs_pre($config->mailerJobSize); - CRM_Mailing_BAO_Job::runJobs(); - CRM_Mailing_BAO_Job::runJobs_post(); + CRM_Mailing_BAO_MailingJob::runJobs_pre($config->mailerJobSize); + CRM_Mailing_BAO_MailingJob::runJobs(); + CRM_Mailing_BAO_MailingJob::runJobs_post(); } $this->_sortByCharacter = @@ -176,7 +176,7 @@ class CRM_Mailing_Page_Browse extends CRM_Core_Page { if ($this->_action & CRM_Core_Action::DISABLE) { if (CRM_Utils_Request::retrieve('confirmed', 'Boolean', $this)) { - CRM_Mailing_BAO_Job::cancel($this->_mailingId); + CRM_Mailing_BAO_MailingJob::cancel($this->_mailingId); CRM_Utils_System::redirect($context); } else { diff --git a/CRM/Mailing/Selector/Browse.php b/CRM/Mailing/Selector/Browse.php index fa96d50e01..6a61698176 100644 --- a/CRM/Mailing/Selector/Browse.php +++ b/CRM/Mailing/Selector/Browse.php @@ -107,7 +107,7 @@ class CRM_Mailing_Selector_Browse extends CRM_Core_Selector_Base implements CRM_ */ function &getColumnHeaders($action = NULL, $output = NULL) { $mailing = CRM_Mailing_BAO_Mailing::getTableName(); - $job = CRM_Mailing_BAO_Job::getTableName(); + $job = CRM_Mailing_BAO_MailingJob::getTableName(); if (!isset(self::$_columnHeaders)) { $completedOrder = NULL; @@ -191,7 +191,7 @@ class CRM_Mailing_Selector_Browse extends CRM_Core_Selector_Base implements CRM_ * @access public */ function getTotalCount($action) { - $job = CRM_Mailing_BAO_Job::getTableName(); + $job = CRM_Mailing_BAO_MailingJob::getTableName(); $mailing = CRM_Mailing_BAO_Mailing::getTableName(); $mailingACL = CRM_Mailing_BAO_Mailing::mailingACL(); @@ -389,7 +389,7 @@ LEFT JOIN civicrm_contact scheduledContact ON ( $mailing.scheduled_id = schedul $actionMask = CRM_Core_Action::ADD; } //get status strings as per locale settings CRM-4411. - $rows[$key]['status'] = CRM_Mailing_BAO_Job::status($row['status']); + $rows[$key]['status'] = CRM_Mailing_BAO_MailingJob::status($row['status']); $rows[$key]['action'] = CRM_Core_Action::formLink($actionLinks, $actionMask, diff --git a/CRM/Mailing/Selector/Event.php b/CRM/Mailing/Selector/Event.php index 8c8694b297..568e911063 100644 --- a/CRM/Mailing/Selector/Event.php +++ b/CRM/Mailing/Selector/Event.php @@ -146,7 +146,7 @@ class CRM_Mailing_Selector_Event extends CRM_Core_Selector_Base implements CRM_C $email = CRM_Core_BAO_Email::getTableName(); - $job = CRM_Mailing_BAO_Job::getTableName(); + $job = CRM_Mailing_BAO_MailingJob::getTableName(); if (!isset($this->_columnHeaders)) { $this->_columnHeaders = array( diff --git a/CRM/Member/BAO/Membership.php b/CRM/Member/BAO/Membership.php index 9230019338..6dd7681814 100644 --- a/CRM/Member/BAO/Membership.php +++ b/CRM/Member/BAO/Membership.php @@ -851,7 +851,7 @@ INNER JOIN civicrm_membership_type type ON ( type.id = membership.membership_ty $form->addRule('selectMembership', ts('Please select one of the memberships.'), 'required'); } else { - $autoRenewOption = CRM_Price_BAO_Set::checkAutoRenewForPriceSet($form->_priceSetId); + $autoRenewOption = CRM_Price_BAO_PriceSet::checkAutoRenewForPriceSet($form->_priceSetId); $form->assign('autoRenewOption', $autoRenewOption); } @@ -2749,16 +2749,16 @@ WHERE civicrm_membership.is_test = 0"; * @static */ static function createLineItems(&$qf, $membershipType, &$priceSetId) { - $qf->_priceSetId = $priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', 'default_membership_type_amount', 'id', 'name'); + $qf->_priceSetId = $priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', 'default_membership_type_amount', 'id', 'name'); if ($priceSetId) { - $qf->_priceSet = $priceSets = current(CRM_Price_BAO_Set::getSetDetail($priceSetId)); + $qf->_priceSet = $priceSets = current(CRM_Price_BAO_PriceSet::getSetDetail($priceSetId)); } $editedFieldParams = array( 'price_set_id' => $priceSetId, 'name' => $membershipType[0], ); $editedResults = array(); - CRM_Price_BAO_Field::retrieve($editedFieldParams, $editedResults); + CRM_Price_BAO_PriceField::retrieve($editedFieldParams, $editedResults); if (!empty($editedResults)) { unset($qf->_priceSet['fields']); @@ -2770,7 +2770,7 @@ WHERE civicrm_membership.is_test = 0"; 'membership_type_id' => $membershipType[1], ); $editedResults = array(); - CRM_Price_BAO_FieldValue::retrieve($editedFieldParams, $editedResults); + CRM_Price_BAO_PriceFieldValue::retrieve($editedFieldParams, $editedResults); $qf->_priceSet['fields'][$fid]['options'][$editedResults['id']] = $priceSets['fields'][$fid]['options'][$editedResults['id']]; if (CRM_Utils_Array::value('total_amount', $qf->_params)) { $qf->_priceSet['fields'][$fid]['options'][$editedResults['id']]['amount'] = $qf->_params['total_amount']; diff --git a/CRM/Member/BAO/MembershipType.php b/CRM/Member/BAO/MembershipType.php index d9b1e13f0b..90d499b461 100644 --- a/CRM/Member/BAO/MembershipType.php +++ b/CRM/Member/BAO/MembershipType.php @@ -659,7 +659,7 @@ class CRM_Member_BAO_MembershipType extends CRM_Member_DAO_MembershipType { public static function createMembershipPriceField($params, $ids, $previousID, $membershipTypeId) { - $priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', 'default_membership_type_amount', 'id', 'name'); + $priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', 'default_membership_type_amount', 'id', 'name'); if (CRM_Utils_Array::value('member_of_contact_id', $params)) { $fieldName = $params['member_of_contact_id']; @@ -674,7 +674,7 @@ class CRM_Member_BAO_MembershipType extends CRM_Member_DAO_MembershipType { 'name' => $fieldName, ); $results = array(); - CRM_Price_BAO_Field::retrieve($fieldParams, $results); + CRM_Price_BAO_PriceField::retrieve($fieldParams, $results); if (empty($results)) { $fieldParams = array(); $fieldParams['label'] = $fieldLabel; @@ -694,7 +694,7 @@ class CRM_Member_BAO_MembershipType extends CRM_Member_DAO_MembershipType { CRM_Member_Form_MembershipType::checkPreviousPriceField($previousID, $priceSetId, $membershipTypeId, $optionsIds); $fieldParams['option_id'] = CRM_Utils_Array::value('option_id', $optionsIds); } - $priceField = CRM_Price_BAO_Field::create($fieldParams); + $priceField = CRM_Price_BAO_PriceField::create($fieldParams); } else { $fieldID = $results['id']; @@ -703,7 +703,7 @@ class CRM_Member_BAO_MembershipType extends CRM_Member_DAO_MembershipType { 'membership_type_id' => $membershipTypeId, ); $results = array(); - CRM_Price_BAO_FieldValue::retrieve($fieldValueParams, $results); + CRM_Price_BAO_PriceFieldValue::retrieve($fieldValueParams, $results); if (!empty($results)) { $results['label'] = $results['name'] = $params['name']; $results['amount'] = empty($params['minimum_fee']) ? 0 : $params['minimum_fee']; @@ -728,7 +728,7 @@ class CRM_Member_BAO_MembershipType extends CRM_Member_DAO_MembershipType { } $results['financial_type_id'] = CRM_Utils_Array::value('financial_type_id', $params); $results['description'] = CRM_Utils_Array::value('description', $params); - CRM_Price_BAO_FieldValue::add($results, $optionsIds); + CRM_Price_BAO_PriceFieldValue::add($results, $optionsIds); } } diff --git a/CRM/Member/Form/Membership.php b/CRM/Member/Form/Membership.php index 61dd97981b..3048817ebb 100644 --- a/CRM/Member/Form/Membership.php +++ b/CRM/Member/Form/Membership.php @@ -313,7 +313,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { } if ($this->_priceSetId) { - return CRM_Price_BAO_Set::setDefaultPriceSet($this, $defaults); + return CRM_Price_BAO_PriceSet::setDefaultPriceSet($this, $defaults); } $defaults = parent::setDefaultValues(); @@ -491,7 +491,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { } $this->set('priceSetId', $this->_priceSetId); - CRM_Price_BAO_Set::buildPriceSet($this); + CRM_Price_BAO_PriceSet::buildPriceSet($this); $optionsMembershipTypes = array(); foreach ($this->_priceSet['fields'] as $pField) { @@ -503,7 +503,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { } } - $this->assign('autoRenewOption', CRM_Price_BAO_Set::checkAutoRenewForPriceSet($this->_priceSetId)); + $this->assign('autoRenewOption', CRM_Price_BAO_PriceSet::checkAutoRenewForPriceSet($this->_priceSetId)); $this->assign('optionsMembershipTypes', $optionsMembershipTypes); $this->assign('contributionType', CRM_Utils_Array::value('financial_type_id', $this->_priceSet)); @@ -519,7 +519,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { if ($this->_action & CRM_Core_Action::ADD) { $buildPriceSet = FALSE; - $priceSets = CRM_Price_BAO_Set::getAssoc(FALSE, 'CiviMember'); + $priceSets = CRM_Price_BAO_PriceSet::getAssoc(FALSE, 'CiviMember'); if (!empty($priceSets)) { $buildPriceSet = TRUE; } @@ -853,7 +853,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; $priceSetId = CRM_Utils_Array::value('price_set_id', $params); if ($priceSetId) { - CRM_Price_BAO_Field::priceSetValidation($priceSetId, $params, $errors); + CRM_Price_BAO_PriceField::priceSetValidation($priceSetId, $params, $errors); $priceFieldIDS = array(); foreach ($self->_priceSet['fields'] as $priceIds => $dontCare) { @@ -875,7 +875,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; if (!empty($priceFieldIDS)) { $ids = implode(',', $priceFieldIDS); - $count = CRM_Price_BAO_Set::getMembershipCount($ids); + $count = CRM_Price_BAO_PriceSet::getMembershipCount($ids); foreach ($count as $id => $occurance) { if ($occurance > 1) { $errors['_qf_default'] = ts('Select at most one option associated with the same membership type.'); @@ -883,7 +883,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; } foreach ($priceFieldIDS as $priceFieldId) { - if ($id = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_FieldValue', $priceFieldId, 'membership_type_id')) { + if ($id = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $priceFieldId, 'membership_type_id')) { $self->_memTypeSelected[$id] = $id; } } @@ -1119,13 +1119,13 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; CRM_Member_BAO_Membership::createLineItems($this, $formValues['membership_type_id'], $priceSetId); } $isQuickConfig = 0; - if ($this->_priceSetId && CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $this->_priceSetId, 'is_quick_config')) { + if ($this->_priceSetId && CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config')) { $isQuickConfig = 1; } $termsByType = array(); if ($priceSetId) { - CRM_Price_BAO_Set::processAmount($this->_priceSet['fields'], + CRM_Price_BAO_PriceSet::processAmount($this->_priceSet['fields'], $this->_params, $lineItem[$priceSetId]); $params['total_amount'] = CRM_Utils_Array::value('amount', $this->_params); $submittedFinancialType = CRM_Utils_Array::value('financial_type_id', $formValues); @@ -1309,7 +1309,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; } if ($priceSetId && !$isQuickConfig) { - $params['financial_type_id'] = CRM_Core_DAO::getFieldValue( 'CRM_Price_DAO_Set', + $params['financial_type_id'] = CRM_Core_DAO::getFieldValue( 'CRM_Price_DAO_PriceSet', $priceSetId, 'financial_type_id' ); @@ -1529,10 +1529,10 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; $lineItem = array(); $lineItems = CRM_Price_BAO_LineItem::getLineItems($params['contribution_id'], 'contribution'); $itemId = key($lineItems); - $priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Field', $lineItems[$itemId]['price_field_id'], 'price_set_id'); + $priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $lineItems[$itemId]['price_field_id'], 'price_set_id'); $fieldType = NULL; if ($itemId && CRM_Utils_Array::value('price_field_id', $lineItems[$itemId])) { - $fieldType = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Field', $lineItems[$itemId]['price_field_id'], 'html_type'); + $fieldType = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $lineItems[$itemId]['price_field_id'], 'html_type'); } $lineItems[$itemId]['unit_price'] = $params['total_amount']; $lineItems[$itemId]['line_total'] = $params['total_amount']; diff --git a/CRM/Member/Form/MembershipBlock.php b/CRM/Member/Form/MembershipBlock.php index 35da0c076e..f73277a464 100644 --- a/CRM/Member/Form/MembershipBlock.php +++ b/CRM/Member/Form/MembershipBlock.php @@ -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'); } } } diff --git a/CRM/Member/Form/MembershipRenewal.php b/CRM/Member/Form/MembershipRenewal.php index 6bd92c286c..28c0bfe133 100644 --- a/CRM/Member/Form/MembershipRenewal.php +++ b/CRM/Member/Form/MembershipRenewal.php @@ -752,7 +752,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; $lineItem = array(); $priceSetId = null; CRM_Member_BAO_Membership::createLineItems($this, $formValues['membership_type_id'], $priceSetId); - CRM_Price_BAO_Set::processAmount($this->_priceSet['fields'], + CRM_Price_BAO_PriceSet::processAmount($this->_priceSet['fields'], $this->_params, $lineItem[$priceSetId] ); //CRM-11529 for quick config backoffice transactions diff --git a/CRM/Member/Form/MembershipType.php b/CRM/Member/Form/MembershipType.php index 382cb73fd8..eb50311159 100644 --- a/CRM/Member/Form/MembershipType.php +++ b/CRM/Member/Form/MembershipType.php @@ -447,14 +447,14 @@ class CRM_Member_Form_MembershipType extends CRM_Member_Form { 'name' => $previousID, ); $editedResults = array(); - CRM_Price_BAO_Field::retrieve($editedFieldParams, $editedResults); + CRM_Price_BAO_PriceField::retrieve($editedFieldParams, $editedResults); if (!empty($editedResults)) { $editedFieldParams = array( 'price_field_id' => $editedResults['id'], 'membership_type_id' => $membershipTypeId, ); $editedResults = array(); - CRM_Price_BAO_FieldValue::retrieve($editedFieldParams, $editedResults); + CRM_Price_BAO_PriceFieldValue::retrieve($editedFieldParams, $editedResults); $optionsIds['option_id'][1] = CRM_Utils_Array::value('id', $editedResults); } } diff --git a/CRM/Price/BAO/LineItem.php b/CRM/Price/BAO/LineItem.php index bf12278992..9290125772 100644 --- a/CRM/Price/BAO/LineItem.php +++ b/CRM/Price/BAO/LineItem.php @@ -194,11 +194,11 @@ class CRM_Price_BAO_LineItem extends CRM_Price_DAO_LineItem { $options = $fields['options']; } else { - CRM_Price_BAO_FieldValue::getValues($fid, $options, 'weight', TRUE); + CRM_Price_BAO_PriceFieldValue::getValues($fid, $options, 'weight', TRUE); } $fieldTitle = CRM_Utils_Array::value('label', $fields); if (!$fieldTitle) { - $fieldTitle = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Field', $fid, 'label'); + $fieldTitle = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $fid, 'label'); } foreach ($params["price_{$fid}"] as $oid => $qty) { @@ -287,7 +287,7 @@ class CRM_Price_BAO_LineItem extends CRM_Price_DAO_LineItem { // if financial type is not set and if price field value is NOT NULL // get financial type id of price field value if (CRM_Utils_Array::value('price_field_value_id', $line) && !CRM_Utils_Array::value('financial_type_id', $line)) { - $line['financial_type_id'] = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_FieldValue', $line['price_field_value_id'], 'financial_type_id'); + $line['financial_type_id'] = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $line['price_field_value_id'], 'financial_type_id'); } $lineItems = CRM_Price_BAO_LineItem::create($line); if (!$update && $contributionDetails) { @@ -360,7 +360,7 @@ class CRM_Price_BAO_LineItem extends CRM_Price_DAO_LineItem { static function getLineItemArray(&$params, $entityId = NULL, $entityTable = 'contribution') { if (!$entityId) { - $priceSetDetails = CRM_Price_BAO_Set::getDefaultPriceSet(); + $priceSetDetails = CRM_Price_BAO_PriceSet::getDefaultPriceSet(); foreach ($priceSetDetails as $values) { $params['line_item'][$values['setID']][$values['priceFieldID']] = array( 'price_field_id' => $values['priceFieldID'], @@ -380,8 +380,8 @@ class CRM_Price_BAO_LineItem extends CRM_Price_DAO_LineItem { $lineItems = CRM_Price_BAO_LineItem::getLineItems($id, $entityTable); foreach ($lineItems as $key => $values) { if (!$setID) { - $setID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Field', $values['price_field_id'], 'price_set_id'); - $params['is_quick_config'] = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $setID, 'is_quick_config'); + $setID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $values['price_field_id'], 'price_set_id'); + $params['is_quick_config'] = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $setID, 'is_quick_config'); } if (CRM_Utils_Array::value('is_quick_config', $params) && array_key_exists('total_amount', $params) && $totalEntityId == 1) { diff --git a/CRM/Price/BAO/Field.php b/CRM/Price/BAO/PriceField.php similarity index 94% rename from CRM/Price/BAO/Field.php rename to CRM/Price/BAO/PriceField.php index 96b8f40598..2d2385d753 100644 --- a/CRM/Price/BAO/Field.php +++ b/CRM/Price/BAO/PriceField.php @@ -37,7 +37,7 @@ * Business objects for managing price fields. * */ -class CRM_Price_BAO_Field extends CRM_Price_DAO_Field { +class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { protected $_options; @@ -51,12 +51,12 @@ class CRM_Price_BAO_Field extends CRM_Price_DAO_Field { * @param array $params (reference ) an assoc array of name/value pairs * @param array $ids the array that holds all the db ids * - * @return object CRM_Price_BAO_Field object + * @return object CRM_Price_BAO_PriceField object * @access public * @static */ static function &add(&$params) { - $priceFieldBAO = new CRM_Price_BAO_Field(); + $priceFieldBAO = new CRM_Price_BAO_PriceField(); $priceFieldBAO->copyValues($params); @@ -75,7 +75,7 @@ class CRM_Price_BAO_Field extends CRM_Price_DAO_Field { * * @param array $params (reference) an assoc array of name/value pairs * - * @return object CRM_Price_DAO_Field object + * @return object CRM_Price_DAO_PriceField object * @access public * @static */ @@ -95,7 +95,7 @@ class CRM_Price_BAO_Field extends CRM_Price_DAO_Field { if ($priceField->html_type == 'Text') { $maxIndex = 1; - $fieldValue = new CRM_Price_DAO_FieldValue(); + $fieldValue = new CRM_Price_DAO_PriceFieldValue(); $fieldValue->price_field_id = $priceField->id; // update previous field values( if any ) @@ -157,7 +157,7 @@ class CRM_Price_BAO_Field extends CRM_Price_DAO_Field { $optionsIds['id'] = NULL; } } - CRM_Price_BAO_FieldValue::create($options, $optionsIds); + CRM_Price_BAO_PriceFieldValue::create($options, $optionsIds); } } @@ -175,12 +175,12 @@ class CRM_Price_BAO_Field extends CRM_Price_DAO_Field { * @param array $params (reference ) an assoc array of name/value pairs * @param array $defaults (reference ) an assoc array to hold the flattened values * - * @return object CRM_Price_DAO_Field object + * @return object CRM_Price_DAO_PriceField object * @access public * @static */ static function retrieve(&$params, &$defaults) { - return CRM_Core_DAO::commonRetrieve('CRM_Price_DAO_Field', $params, $defaults); + return CRM_Core_DAO::commonRetrieve('CRM_Price_DAO_PriceField', $params, $defaults); } /** @@ -195,7 +195,7 @@ class CRM_Price_BAO_Field extends CRM_Price_DAO_Field { * @static */ static function setIsActive($id, $is_active) { - return CRM_Core_DAO::setFieldValue('CRM_Price_DAO_Field', $id, 'is_active', $is_active); + return CRM_Core_DAO::setFieldValue('CRM_Price_DAO_PriceField', $id, 'is_active', $is_active); } /** @@ -210,7 +210,7 @@ class CRM_Price_BAO_Field extends CRM_Price_DAO_Field { * */ public static function getTitle($id) { - return CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Field', $id, 'label'); + return CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $id, 'label'); } /** @@ -236,7 +236,7 @@ class CRM_Price_BAO_Field extends CRM_Price_DAO_Field { $feezeOptions = array() ) { - $field = new CRM_Price_DAO_Field(); + $field = new CRM_Price_DAO_PriceField(); $field->id = $fieldId; if (!$field->find(TRUE)) { /* FIXME: failure! */ @@ -272,7 +272,7 @@ class CRM_Price_BAO_Field extends CRM_Price_DAO_Field { $customOption = $fieldOptions; if (!is_array($customOption)) { - $customOption = CRM_Price_BAO_Field::getOptions($field->id, $inactiveNeeded); + $customOption = CRM_Price_BAO_PriceField::getOptions($field->id, $inactiveNeeded); } //use value field. @@ -501,7 +501,7 @@ class CRM_Price_BAO_Field extends CRM_Price_DAO_Field { if ($reset || empty($options[$fieldId])) { $values = array(); - CRM_Price_BAO_FieldValue::getValues($fieldId, $values, 'weight', !$inactiveNeeded); + CRM_Price_BAO_PriceFieldValue::getValues($fieldId, $values, 'weight', !$inactiveNeeded); $options[$fieldId] = $values; } @@ -545,17 +545,17 @@ WHERE * */ public static function deleteField($id) { - $field = new CRM_Price_DAO_Field(); + $field = new CRM_Price_DAO_PriceField(); $field->id = $id; if ($field->find(TRUE)) { // delete the options for this field - CRM_Price_BAO_FieldValue::deleteValues($id); + CRM_Price_BAO_PriceFieldValue::deleteValues($id); // reorder the weight before delete $fieldValues = array('price_set_id' => $field->price_set_id); - CRM_Utils_Weight::delWeight('CRM_Price_DAO_Field', $field->id, $fieldValues); + CRM_Utils_Weight::delWeight('CRM_Price_DAO_PriceField', $field->id, $fieldValues); // now delete the field return $field->delete(); @@ -592,7 +592,7 @@ WHERE public static function priceSetValidation($priceSetId, $fields, &$error, $allowNoneSelection = FALSE) { // check for at least one positive // amount price field should be selected. - $priceField = new CRM_Price_DAO_Field(); + $priceField = new CRM_Price_DAO_PriceField(); $priceField->price_set_id = $priceSetId; $priceField->find(); @@ -634,7 +634,7 @@ WHERE id IN (" . implode(',', array_keys($priceFields)) . ')'; foreach ($htmlTypes as $fieldId => $type) { $options = array(); - CRM_Price_BAO_FieldValue::getValues($fieldId, $options); + CRM_Price_BAO_PriceFieldValue::getValues($fieldId, $options); if (empty($options)) { continue; diff --git a/CRM/Price/BAO/FieldValue.php b/CRM/Price/BAO/PriceFieldValue.php similarity index 86% rename from CRM/Price/BAO/FieldValue.php rename to CRM/Price/BAO/PriceFieldValue.php index 75323ed984..18551e11a8 100644 --- a/CRM/Price/BAO/FieldValue.php +++ b/CRM/Price/BAO/PriceFieldValue.php @@ -37,20 +37,20 @@ * Business objects for managing price fields values. * */ -class CRM_Price_BAO_FieldValue extends CRM_Price_DAO_FieldValue { +class CRM_Price_BAO_PriceFieldValue extends CRM_Price_DAO_PriceFieldValue { /** * insert/update a new entry in the database. * * @param array $params (reference), array $ids * - * @return object CRM_Price_DAO_FieldValue object + * @return object CRM_Price_DAO_PriceFieldValue object * @access public * @static */ static function &add(&$params, $ids) { - $fieldValueBAO = new CRM_Price_BAO_FieldValue(); + $fieldValueBAO = new CRM_Price_BAO_PriceFieldValue(); $fieldValueBAO->copyValues($params); if ($id = CRM_Utils_Array::value('id', $ids)) { @@ -71,7 +71,7 @@ class CRM_Price_BAO_FieldValue extends CRM_Price_DAO_FieldValue { * * @param array $params (reference), array $ids * - * @return object CRM_Price_DAO_FieldValue object + * @return object CRM_Price_DAO_PriceFieldValue object * @access public * @static */ @@ -86,11 +86,11 @@ class CRM_Price_BAO_FieldValue extends CRM_Price_DAO_FieldValue { $oldWeight = NULL; if ($id) { - $oldWeight = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_FieldValue', $id, 'weight', 'id'); + $oldWeight = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $id, 'weight', 'id'); } $fieldValues = array('price_field_id' => CRM_Utils_Array::value('price_field_id', $params, 0)); - $params['weight'] = CRM_Utils_Weight::updateOtherWeights('CRM_Price_DAO_FieldValue', $oldWeight, $params['weight'], $fieldValues); + $params['weight'] = CRM_Utils_Weight::updateOtherWeights('CRM_Price_DAO_PriceFieldValue', $oldWeight, $params['weight'], $fieldValues); } else { if (!CRM_Utils_Array::value('name', $params)) { @@ -112,12 +112,12 @@ class CRM_Price_BAO_FieldValue extends CRM_Price_DAO_FieldValue { * @param array $params (reference ) an assoc array * @param array $defaults (reference ) an assoc array to hold the flattened values * - * @return object CRM_Price_DAO_FieldValue object + * @return object CRM_Price_DAO_PriceFieldValue object * @access public * @static */ static function retrieve(&$params, &$defaults) { - return CRM_Core_DAO::commonRetrieve('CRM_Price_DAO_FieldValue', $params, $defaults); + return CRM_Core_DAO::commonRetrieve('CRM_Price_DAO_PriceFieldValue', $params, $defaults); } /** @@ -134,7 +134,7 @@ class CRM_Price_BAO_FieldValue extends CRM_Price_DAO_FieldValue { * @static */ static function getValues($fieldId, &$values, $orderBy = 'weight', $isActive = FALSE) { - $fieldValueDAO = new CRM_Price_DAO_FieldValue(); + $fieldValueDAO = new CRM_Price_DAO_PriceFieldValue(); $fieldValueDAO->price_field_id = $fieldId; $fieldValueDAO->orderBy($orderBy, 'label'); if ($isActive) { @@ -161,7 +161,7 @@ class CRM_Price_BAO_FieldValue extends CRM_Price_DAO_FieldValue { * */ public static function getOptionLabel($id) { - return CRM_Core_DAO::getFieldValue('CRM_Price_DAO_FieldValue', $id, 'label'); + return CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $id, 'label'); } /** @@ -176,7 +176,7 @@ class CRM_Price_BAO_FieldValue extends CRM_Price_DAO_FieldValue { * @static */ static function setIsActive($id, $is_active) { - return CRM_Core_DAO::setFieldValue('CRM_Price_DAO_FieldValue', $id, 'is_active', $is_active); + return CRM_Core_DAO::setFieldValue('CRM_Price_DAO_PriceFieldValue', $id, 'is_active', $is_active); } /** @@ -194,7 +194,7 @@ class CRM_Price_BAO_FieldValue extends CRM_Price_DAO_FieldValue { return FALSE; } - $fieldValueDAO = new CRM_Price_DAO_FieldValue(); + $fieldValueDAO = new CRM_Price_DAO_PriceFieldValue(); $fieldValueDAO->price_field_id = $fieldId; $fieldValueDAO->delete(); } @@ -214,7 +214,7 @@ class CRM_Price_BAO_FieldValue extends CRM_Price_DAO_FieldValue { return FALSE; } - $fieldValueDAO = new CRM_Price_DAO_FieldValue(); + $fieldValueDAO = new CRM_Price_DAO_PriceFieldValue(); $fieldValueDAO->id = $id; return $fieldValueDAO->delete(); } diff --git a/CRM/Price/BAO/Set.php b/CRM/Price/BAO/PriceSet.php similarity index 95% rename from CRM/Price/BAO/Set.php rename to CRM/Price/BAO/PriceSet.php index ecee3b7b01..5a78803e87 100644 --- a/CRM/Price/BAO/Set.php +++ b/CRM/Price/BAO/PriceSet.php @@ -37,7 +37,7 @@ * Business object for managing price sets * */ -class CRM_Price_BAO_Set extends CRM_Price_DAO_Set { +class CRM_Price_BAO_PriceSet extends CRM_Price_DAO_PriceSet { /** * class constructor @@ -51,12 +51,12 @@ class CRM_Price_BAO_Set extends CRM_Price_DAO_Set { * * @param array $params (reference) an assoc array of name/value pairs * - * @return object CRM_Price_DAO_Set object + * @return object CRM_Price_DAO_PriceSet object * @access public * @static */ static function create(&$params) { - $priceSetBAO = new CRM_Price_BAO_Set(); + $priceSetBAO = new CRM_Price_BAO_PriceSet(); $priceSetBAO->copyValues($params); if (self::eventPriceSetDomainID()) { $priceSetBAO->domain_id = CRM_Core_Config::domainID(); @@ -74,12 +74,12 @@ class CRM_Price_BAO_Set extends CRM_Price_DAO_Set { * @param array $params (reference ) an assoc array of name/value pairs * @param array $defaults (reference ) an assoc array to hold the flattened values * - * @return object CRM_Price_DAO_Set object + * @return object CRM_Price_DAO_PriceSet object * @access public * @static */ static function retrieve(&$params, &$defaults) { - return CRM_Core_DAO::commonRetrieve('CRM_Price_DAO_Set', $params, $defaults); + return CRM_Core_DAO::commonRetrieve('CRM_Price_DAO_PriceSet', $params, $defaults); } /** @@ -93,7 +93,7 @@ class CRM_Price_BAO_Set extends CRM_Price_DAO_Set { * @access public */ static function setIsActive($id, $isActive) { - return CRM_Core_DAO::setFieldValue('CRM_Price_DAO_Set', $id, 'is_active', $isActive); + return CRM_Core_DAO::setFieldValue('CRM_Price_DAO_PriceSet', $id, 'is_active', $isActive); } /** @@ -149,7 +149,7 @@ WHERE ps.name = '{$entityName}' * */ public static function getTitle($id) { - return CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $id, 'title'); + return CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $id, 'title'); } /** @@ -285,15 +285,15 @@ WHERE ct.id = cp.financial_type_id AND } // delete price fields - $priceField = new CRM_Price_DAO_Field(); + $priceField = new CRM_Price_DAO_PriceField(); $priceField->price_set_id = $id; $priceField->find(); while ($priceField->fetch()) { // delete options first - CRM_Price_BAO_Field::deleteField($priceField->id); + CRM_Price_BAO_PriceField::deleteField($priceField->id); } - $set = new CRM_Price_DAO_Set(); + $set = new CRM_Price_DAO_PriceSet(); $set->id = $id; return $set->delete(); } @@ -309,14 +309,14 @@ WHERE ct.id = cp.financial_type_id AND */ public static function addTo($entityTable, $entityId, $priceSetId) { // verify that the price set exists - $dao = new CRM_Price_DAO_Set(); + $dao = new CRM_Price_DAO_PriceSet(); $dao->id = $priceSetId; if (!$dao->find()) { return FALSE; } unset($dao); - $dao = new CRM_Price_DAO_SetEntity(); + $dao = new CRM_Price_DAO_PriceSetEntity(); // find if this already exists $dao->entity_id = $entityId; $dao->entity_table = $entityTable; @@ -334,7 +334,7 @@ WHERE ct.id = cp.financial_type_id AND * @param integer $entityId */ public static function removeFrom($entityTable, $entityId) { - $dao = new CRM_Price_DAO_SetEntity(); + $dao = new CRM_Price_DAO_PriceSetEntity(); $dao->entity_table = $entityTable; $dao->entity_id = $entityId; return $dao->delete(); @@ -391,7 +391,7 @@ WHERE ct.id = cp.financial_type_id AND $fid = NULL; if ($oid = CRM_Utils_Array::value('oid', $params)) { - $fieldValue = new CRM_Price_DAO_FieldValue(); + $fieldValue = new CRM_Price_DAO_PriceFieldValue(); $fieldValue->id = $oid; if ($fieldValue->find(TRUE)) { $fid = $fieldValue->price_field_id; @@ -402,7 +402,7 @@ WHERE ct.id = cp.financial_type_id AND } if (isset($fid)) { - return CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Field', $fid, 'price_set_id'); + return CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $fid, 'price_set_id'); } return NULL; @@ -529,7 +529,7 @@ AND ( expire_on IS NULL OR expire_on >= {$currentTime} ) } $setTree[$setID]['fields'][$fieldID][$field] = $dao->$field; } - $setTree[$setID]['fields'][$fieldID]['options'] = CRM_Price_BAO_Field::getOptions($fieldID, FALSE); + $setTree[$setID]['fields'][$fieldID]['options'] = CRM_Price_BAO_PriceField::getOptions($fieldID, FALSE); } // also get the pre and post help from this price set @@ -555,7 +555,7 @@ WHERE id = %1"; //check if priceset is is_config if (is_numeric($priceSetId)) { - if (CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $priceSetId, 'is_quick_config') && $form->getVar('_name') != 'Participant') { + if (CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $priceSetId, 'is_quick_config') && $form->getVar('_name') != 'Participant') { $form->assign('quickConfig', 1); } } @@ -803,7 +803,7 @@ WHERE id = %1"; $priceSet = self::getSetDetail($priceSetId, TRUE, $validFieldsOnly); $form->_priceSet = CRM_Utils_Array::value($priceSetId, $priceSet); $form->_quickConfig = $quickConfig = 0; - if (CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $priceSetId, 'is_quick_config')) { + if (CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $priceSetId, 'is_quick_config')) { $quickConfig = 1; } @@ -845,7 +845,7 @@ WHERE id = %1"; if (!is_array($options)) { continue; } - CRM_Price_BAO_Field::addQuickFormElement($form, + CRM_Price_BAO_PriceField::addQuickFormElement($form, 'price_' . $field['id'], $field['id'], FALSE, @@ -924,7 +924,7 @@ WHERE id = %1"; * @static */ public static function getFieldIds($id) { - $priceField = new CRM_Price_DAO_Field(); + $priceField = new CRM_Price_DAO_PriceField(); $priceField->price_set_id = $id; $priceField->find(); while ($priceField->fetch()) { @@ -953,14 +953,14 @@ WHERE id = %1"; ), ); - $copy = &CRM_Core_DAO::copyGeneric('CRM_Price_DAO_Set', + $copy = &CRM_Core_DAO::copyGeneric('CRM_Price_DAO_PriceSet', array('id' => $id), NULL, $fieldsFix ); //copying all the blocks pertaining to the price set - $copyPriceField = &CRM_Core_DAO::copyGeneric('CRM_Price_DAO_Field', + $copyPriceField = &CRM_Core_DAO::copyGeneric('CRM_Price_DAO_PriceField', array('price_set_id' => $id), array('price_set_id' => $copy->id) ); @@ -969,7 +969,7 @@ WHERE id = %1"; //copy option group and values foreach ($price as $originalId => $copyId) { - CRM_Core_DAO::copyGeneric('CRM_Price_DAO_FieldValue', + CRM_Core_DAO::copyGeneric('CRM_Price_DAO_PriceFieldValue', array('price_field_id' => $originalId), array('price_field_id' => $copyId) ); @@ -988,7 +988,7 @@ WHERE id = %1"; */ static function checkPermission($sid) { if ($sid && self::eventPriceSetDomainID()) { - $domain_id = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $sid, 'domain_id', 'id'); + $domain_id = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $sid, 'domain_id', 'id'); if (CRM_Core_Config::domainID() != $domain_id) { CRM_Core_Error::fatal(ts('You do not have permission to access this page')); } @@ -1138,7 +1138,7 @@ GROUP BY mt.member_of_contact_id"; * @access public */ static function setIsQuickConfig($id, $isQuickConfig) { - return CRM_Core_DAO::setFieldValue('CRM_Price_DAO_Set', $id, 'is_quick_config', $isQuickConfig); + return CRM_Core_DAO::setFieldValue('CRM_Price_DAO_PriceSet', $id, 'is_quick_config', $isQuickConfig); } /** @@ -1191,15 +1191,15 @@ WHERE ps.id = %1 * */ static function copyPriceSet($baoName, $id, $newId) { - $priceSetId = CRM_Price_BAO_Set::getFor($baoName, $id); + $priceSetId = CRM_Price_BAO_PriceSet::getFor($baoName, $id); if ($priceSetId) { - $isQuickConfig = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $priceSetId, 'is_quick_config'); + $isQuickConfig = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $priceSetId, 'is_quick_config'); if($isQuickConfig) { - $copyPriceSet = &CRM_Price_BAO_Set::copy($priceSetId); - CRM_Price_BAO_Set::addTo($baoName, $newId, $copyPriceSet->id); + $copyPriceSet = &CRM_Price_BAO_PriceSet::copy($priceSetId); + CRM_Price_BAO_PriceSet::addTo($baoName, $newId, $copyPriceSet->id); } else { - $copyPriceSet = &CRM_Core_DAO::copyGeneric('CRM_Price_DAO_SetEntity', + $copyPriceSet = &CRM_Core_DAO::copyGeneric('CRM_Price_DAO_PriceSetEntity', array( 'entity_id' => $id, 'entity_table' => $baoName, @@ -1212,7 +1212,7 @@ WHERE ps.id = %1 $discount = CRM_Core_BAO_Discount::getOptionGroup($id, 'civicrm_event'); foreach ($discount as $discountId => $setId) { - $copyPriceSet = &CRM_Price_BAO_Set::copy($setId); + $copyPriceSet = &CRM_Price_BAO_PriceSet::copy($setId); $copyDiscount = &CRM_Core_DAO::copyGeneric( 'CRM_Core_DAO_Discount', diff --git a/CRM/Price/Form/DeleteField.php b/CRM/Price/Form/DeleteField.php index 17a6c31558..76e3e7d740 100644 --- a/CRM/Price/Form/DeleteField.php +++ b/CRM/Price/Form/DeleteField.php @@ -62,7 +62,7 @@ class CRM_Price_Form_DeleteField extends CRM_Core_Form { */ function preProcess() { $this->_fid = $this->get('fid'); - $this->_title = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Field', + $this->_title = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $this->_fid, 'label', 'id' ); @@ -105,7 +105,7 @@ class CRM_Price_Form_DeleteField extends CRM_Core_Form { */ public function postProcess() { - if (CRM_Price_BAO_Field::deleteField($this->_fid)) { + if (CRM_Price_BAO_PriceField::deleteField($this->_fid)) { CRM_Core_Session::setStatus(ts('The Price Field \'%1\' has been deleted.', array(1 => $this->_title)), '', 'success'); } } diff --git a/CRM/Price/Form/DeleteSet.php b/CRM/Price/Form/DeleteSet.php index b0ea039672..137b69dc7a 100644 --- a/CRM/Price/Form/DeleteSet.php +++ b/CRM/Price/Form/DeleteSet.php @@ -60,7 +60,7 @@ class CRM_Price_Form_DeleteSet extends CRM_Core_Form { */ function preProcess() { $this->_sid = $this->get('sid'); - $this->_title = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', + $this->_title = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_sid, 'title' ); } @@ -94,7 +94,7 @@ class CRM_Price_Form_DeleteSet extends CRM_Core_Form { * @access public */ public function postProcess() { - if (CRM_Price_BAO_Set::deleteSet($this->_sid)) { + if (CRM_Price_BAO_PriceSet::deleteSet($this->_sid)) { CRM_Core_Session::setStatus(ts('The Price Set \'%1\' has been deleted.', array(1 => $this->_title), ts('Deleted'), 'success' )); diff --git a/CRM/Price/Form/Field.php b/CRM/Price/Form/Field.php index 7978facf9d..d47d2b730f 100644 --- a/CRM/Price/Form/Field.php +++ b/CRM/Price/Form/Field.php @@ -91,7 +91,7 @@ class CRM_Price_Form_Field extends CRM_Core_Form { )); $this->_extendComponentId = array(); - $extendComponentId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $this->_sid, 'extends', 'id'); + $extendComponentId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_sid, 'extends', 'id'); if ($extendComponentId) { $this->_extendComponentId = explode(CRM_Core_DAO::VALUE_SEPARATOR, $extendComponentId); } @@ -114,14 +114,14 @@ class CRM_Price_Form_Field extends CRM_Core_Form { if (isset($this->_fid)) { $params = array('id' => $this->_fid); $this->assign('fid', $this->_fid); - CRM_Price_BAO_Field::retrieve($params, $defaults); + CRM_Price_BAO_PriceField::retrieve($params, $defaults); $this->_sid = $defaults['price_set_id']; // if text, retrieve price if ($defaults['html_type'] == 'Text') { $valueParams = array('price_field_id' => $this->_fid); - CRM_Price_BAO_FieldValue::retrieve($valueParams, $defaults); + CRM_Price_BAO_PriceFieldValue::retrieve($valueParams, $defaults); // fix the display of the monetary value, CRM-4038 $defaults['price'] = CRM_Utils_Money::format($defaults['amount'], NULL, '%a'); @@ -149,14 +149,14 @@ class CRM_Price_Form_Field extends CRM_Core_Form { if ($this->_action & CRM_Core_Action::ADD) { $fieldValues = array('price_set_id' => $this->_sid); - $defaults['weight'] = CRM_Utils_Weight::getDefaultWeight('CRM_Price_DAO_Field', $fieldValues); + $defaults['weight'] = CRM_Utils_Weight::getDefaultWeight('CRM_Price_DAO_PriceField', $fieldValues); $defaults['options_per_line'] = 1; $defaults['is_display_amounts'] = 1; } $eventComponentId = CRM_Core_Component::getComponentID('CiviEvent'); if (isset($this->_sid) && $this->_action == CRM_Core_Action::ADD) { - $financialTypeId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $this->_sid, 'financial_type_id'); + $financialTypeId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_sid, 'financial_type_id'); $defaults['financial_type_id'] = $financialTypeId; for ($i = 1; $i <= self::NUM_OPTION; $i++) { $defaults['option_financial_type_id[' . $i . ']'] = $financialTypeId; @@ -183,12 +183,12 @@ class CRM_Price_Form_Field extends CRM_Core_Form { $this->add('hidden', 'fid', $this->_fid); // label - $this->add('text', 'label', ts('Field Label'), CRM_Core_DAO::getAttribute('CRM_Price_DAO_Field', 'label'), TRUE); + $this->add('text', 'label', ts('Field Label'), CRM_Core_DAO::getAttribute('CRM_Price_DAO_PriceField', 'label'), TRUE); // html_type $javascript = 'onchange="option_html_type(this.form)";'; - $htmlTypes = CRM_Price_BAO_Field::htmlTypes(); + $htmlTypes = CRM_Price_BAO_PriceField::htmlTypes(); // Text box for Participant Count for a field @@ -200,7 +200,7 @@ class CRM_Price_Form_Field extends CRM_Core_Form { $eventComponentId = CRM_Core_Component::getComponentID('CiviEvent'); $memberComponentId = CRM_Core_Component::getComponentID('CiviMember'); - $attributes = CRM_Core_DAO::getAttribute('CRM_Price_DAO_FieldValue'); + $attributes = CRM_Core_DAO::getAttribute('CRM_Price_DAO_PriceFieldValue'); $this->add('select', 'financial_type_id', ts('Financial Type'), @@ -312,7 +312,7 @@ class CRM_Price_Form_Field extends CRM_Core_Form { $this->add('checkbox', 'is_display_amounts', ts('Display Amount?')); // weight - $this->add('text', 'weight', ts('Order'), CRM_Core_DAO::getAttribute('CRM_Price_DAO_Field', 'weight'), TRUE); + $this->add('text', 'weight', ts('Order'), CRM_Core_DAO::getAttribute('CRM_Price_DAO_PriceField', 'weight'), TRUE); $this->addRule('weight', ts('is a numeric field'), 'numeric'); // checkbox / radio options per line @@ -321,7 +321,7 @@ class CRM_Price_Form_Field extends CRM_Core_Form { // help post, mask, attributes, javascript ? $this->add('textarea', 'help_post', ts('Field Help'), - CRM_Core_DAO::getAttribute('CRM_Price_DAO_Field', 'help_post') + CRM_Core_DAO::getAttribute('CRM_Price_DAO_PriceField', 'help_post') ); // active_on @@ -409,7 +409,7 @@ class CRM_Price_Form_Field extends CRM_Core_Form { } //avoid the same price field label in Within PriceSet - $priceFieldLabel = new CRM_Price_DAO_Field(); + $priceFieldLabel = new CRM_Price_DAO_PriceField(); $priceFieldLabel->label = $fields['label']; $priceFieldLabel->price_set_id = $form->_sid; @@ -556,7 +556,7 @@ class CRM_Price_Form_Field extends CRM_Core_Form { if ($foundAutorenew) { // if so, check for other fields in this price set which also have auto-renew membership options - $otherFieldAutorenew = CRM_Price_BAO_Set::checkAutoRenewForPriceSet($form->_sid); + $otherFieldAutorenew = CRM_Price_BAO_PriceSet::checkAutoRenewForPriceSet($form->_sid); if ($otherFieldAutorenew) { $errors['_qf_default'] = ts('You can include auto-renew membership choices for only one price field in a price set. Another field in this set already contains one or more auto-renew membership options.'); } @@ -632,9 +632,9 @@ class CRM_Price_Form_Field extends CRM_Core_Form { $fieldValues = array('price_set_id' => $this->_sid); $oldWeight = NULL; if ($this->_fid) { - $oldWeight = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Field', $this->_fid, 'weight', 'id'); + $oldWeight = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $this->_fid, 'weight', 'id'); } - $params['weight'] = CRM_Utils_Weight::updateOtherWeights('CRM_Price_DAO_Field', $oldWeight, $params['weight'], $fieldValues); + $params['weight'] = CRM_Utils_Weight::updateOtherWeights('CRM_Price_DAO_PriceField', $oldWeight, $params['weight'], $fieldValues); } // make value <=> name consistency. @@ -664,7 +664,7 @@ class CRM_Price_Form_Field extends CRM_Core_Form { $params['membership_num_terms'] = (!empty($params['membership_type_id'])) ? CRM_Utils_Array::value('membership_num_terms', $params, 1) : NULL; - $priceField = CRM_Price_BAO_Field::create($params); + $priceField = CRM_Price_BAO_PriceField::create($params); if (!is_a($priceField, 'CRM_Core_Error')) { CRM_Core_Session::setStatus(ts('Price Field \'%1\' has been saved.', array(1 => $priceField->label)), ts('Saved'), 'success'); diff --git a/CRM/Price/Form/Option.php b/CRM/Price/Form/Option.php index bd22ac79c9..078a562560 100644 --- a/CRM/Price/Form/Option.php +++ b/CRM/Price/Form/Option.php @@ -87,25 +87,25 @@ class CRM_Price_Form_Option extends CRM_Core_Form { if (isset($this->_oid)) { $params = array('id' => $this->_oid); - CRM_Price_BAO_FieldValue::retrieve($params, $defaults); + CRM_Price_BAO_PriceFieldValue::retrieve($params, $defaults); // fix the display of the monetary value, CRM-4038 $defaults['value'] = CRM_Utils_Money::format(CRM_Utils_Array::value('value', $defaults), NULL, '%a'); } $memberComponentId = CRM_Core_Component::getComponentID('CiviMember'); - $extendComponentId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $this->_sid, 'extends', 'id'); + $extendComponentId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_sid, 'extends', 'id'); if (!isset($defaults['membership_num_terms']) && $memberComponentId == $extendComponentId) { $defaults['membership_num_terms'] = 1; } // set financial type used for price set to set default for new option if (!$this->_oid) { - $defaults['financial_type_id'] = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $this->_sid, 'financial_type_id', 'id');; + $defaults['financial_type_id'] = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_sid, 'financial_type_id', 'id');; } if (!isset($defaults['weight']) || !$defaults['weight']) { $fieldValues = array('price_field_id' => $this->_fid); - $defaults['weight'] = CRM_Utils_Weight::getDefaultWeight('CRM_Price_DAO_FieldValue', $fieldValues); + $defaults['weight'] = CRM_Utils_Weight::getDefaultWeight('CRM_Price_DAO_PriceFieldValue', $fieldValues); $defaults['is_active'] = 1; } @@ -136,7 +136,7 @@ class CRM_Price_Form_Option extends CRM_Core_Form { return; } else { - $attributes = CRM_Core_DAO::getAttribute('CRM_Price_DAO_FieldValue'); + $attributes = CRM_Core_DAO::getAttribute('CRM_Price_DAO_PriceFieldValue'); // lets trim all the whitespace $this->applyFilter('__ALL__', 'trim'); @@ -155,10 +155,10 @@ class CRM_Price_Form_Option extends CRM_Core_Form { elseif ($this->_action == CRM_Core_Action::ADD || $this->_action == CRM_Core_Action::VIEW ) { - $this->_sid = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Field', $this->_fid, 'price_set_id', 'id'); + $this->_sid = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $this->_fid, 'price_set_id', 'id'); } $this->isEvent = False; - $extendComponentId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $this->_sid, 'extends', 'id'); + $extendComponentId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_sid, 'extends', 'id'); $this->assign('showMember', FALSE); if ($memberComponentId == $extendComponentId) { $this->assign('showMember', TRUE); @@ -197,7 +197,7 @@ class CRM_Price_Form_Option extends CRM_Core_Form { true ); - //CRM_Core_DAO::getFieldValue( 'CRM_Price_DAO_Field', $this->_fid, 'weight', 'id' ); + //CRM_Core_DAO::getFieldValue( 'CRM_Price_DAO_PriceField', $this->_fid, 'weight', 'id' ); // FIX ME: duplicate rule? /* $this->addRule( 'label', @@ -229,7 +229,7 @@ class CRM_Price_Form_Option extends CRM_Core_Form { if ($this->_fid) { //hide the default checkbox option for text field - $htmlType = CRM_Core_DAO::getFieldValue('CRM_Price_BAO_Field', $this->_fid, 'html_type'); + $htmlType = CRM_Core_DAO::getFieldValue('CRM_Price_BAO_PriceField', $this->_fid, 'html_type'); $this->assign('hideDefaultOption', FALSE); if ($htmlType == 'Text') { $this->assign('hideDefaultOption', TRUE); @@ -297,13 +297,13 @@ class CRM_Price_Form_Option extends CRM_Core_Form { public function postProcess() { if ($this->_action == CRM_Core_Action::DELETE) { $fieldValues = array('price_field_id' => $this->_fid); - $wt = CRM_Utils_Weight::delWeight('CRM_Price_DAO_FieldValue', $this->_oid, $fieldValues); - $label = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_FieldValue', + $wt = CRM_Utils_Weight::delWeight('CRM_Price_DAO_PriceFieldValue', $this->_oid, $fieldValues); + $label = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $this->_oid, 'label', 'id' ); - if (CRM_Price_BAO_FieldValue::del($this->_oid)) { + if (CRM_Price_BAO_PriceFieldValue::del($this->_oid)) { CRM_Core_Session::setStatus(ts('%1 option has been deleted.', array(1 => $label)), ts('Record Deleted'), 'success'); } return; @@ -311,7 +311,7 @@ class CRM_Price_Form_Option extends CRM_Core_Form { else { $params = $ids = array(); $params = $this->controller->exportValues('Option'); - $fieldLabel = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Field', $this->_fid, 'label'); + $fieldLabel = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $this->_fid, 'label'); $params['amount'] = CRM_Utils_Rule::cleanMoney(trim($params['amount'])); $params['price_field_id'] = $this->_fid; @@ -320,7 +320,7 @@ class CRM_Price_Form_Option extends CRM_Core_Form { if ($this->_oid) { $ids['id'] = $this->_oid; } - $optionValue = CRM_Price_BAO_FieldValue::create($params, $ids); + $optionValue = CRM_Price_BAO_PriceFieldValue::create($params, $ids); CRM_Core_Session::setStatus(ts("The option '%1' has been saved.", array(1 => $params['label'])), ts('Value Saved'), 'success'); } diff --git a/CRM/Price/Form/Preview.php b/CRM/Price/Form/Preview.php index 2ae8407abd..3d461cbdcc 100644 --- a/CRM/Price/Form/Preview.php +++ b/CRM/Price/Form/Preview.php @@ -65,7 +65,7 @@ class CRM_Price_Form_Preview extends CRM_Core_Form { $fieldId = $this->get('fieldId'); if ($fieldId) { - $groupTree = CRM_Price_BAO_Set::getSetDetail($groupId); + $groupTree = CRM_Price_BAO_PriceSet::getSetDetail($groupId); $this->_groupTree[$groupId]['fields'][$fieldId] = $groupTree[$groupId]['fields'][$fieldId]; $this->assign('preview_type', 'field'); $url = CRM_Utils_System::url('civicrm/admin/price/field', "reset=1&action=browse&sid={$groupId}"); @@ -75,9 +75,9 @@ class CRM_Price_Form_Preview extends CRM_Core_Form { } else { // group preview - $this->_groupTree = CRM_Price_BAO_Set::getSetDetail($groupId); + $this->_groupTree = CRM_Price_BAO_PriceSet::getSetDetail($groupId); $this->assign('preview_type', 'group'); - $this->assign('setTitle', CRM_Price_BAO_Set::getTitle($groupId)); + $this->assign('setTitle', CRM_Price_BAO_PriceSet::getTitle($groupId)); $url = CRM_Utils_System::url('civicrm/admin/price', 'reset=1'); $breadCrumb = array(array('title' => ts('Price Sets'), 'url' => $url, @@ -133,7 +133,7 @@ class CRM_Price_Form_Preview extends CRM_Core_Form { foreach ($group['fields'] as $field) { $fieldId = $field['id']; $elementName = 'price_' . $fieldId; - CRM_Price_BAO_Field::addQuickFormElement($this, $elementName, $fieldId, FALSE, $field['is_required']); + CRM_Price_BAO_PriceField::addQuickFormElement($this, $elementName, $fieldId, FALSE, $field['is_required']); } } } diff --git a/CRM/Price/Form/Set.php b/CRM/Price/Form/Set.php index dd2f6ce958..ceafecd0a8 100644 --- a/CRM/Price/Form/Set.php +++ b/CRM/Price/Form/Set.php @@ -61,7 +61,7 @@ class CRM_Price_Form_Set extends CRM_Core_Form { // setting title for html page $title = ts('New Price Set'); if ($this->_sid) { - $title = CRM_Price_BAO_Set::getTitle($this->_sid); + $title = CRM_Price_BAO_PriceSet::getTitle($this->_sid); } if ($this->_action & CRM_Core_Action::UPDATE) { $title = ts('Edit %1', array(1 => $title)); @@ -122,14 +122,14 @@ class CRM_Price_Form_Set extends CRM_Core_Form { $this->assign('sid', $this->_sid); // title - $this->add('text', 'title', ts('Set Name'), CRM_Core_DAO::getAttribute('CRM_Price_DAO_Set', 'title'), TRUE); + $this->add('text', 'title', ts('Set Name'), CRM_Core_DAO::getAttribute('CRM_Price_DAO_PriceSet', 'title'), TRUE); $this->addRule('title', ts('Name already exists in Database.'), - 'objectExists', array('CRM_Price_DAO_Set', $this->_sid, 'title') + 'objectExists', array('CRM_Price_DAO_PriceSet', $this->_sid, 'title') ); $priceSetUsedTables = $extends = array(); if ($this->_action == CRM_Core_Action::UPDATE && $this->_sid) { - $priceSetUsedTables = CRM_Price_BAO_Set::getUsedBy($this->_sid, 'table'); + $priceSetUsedTables = CRM_Price_BAO_PriceSet::getUsedBy($this->_sid, 'table'); } $config = CRM_Core_Config::singleton(); @@ -197,10 +197,10 @@ class CRM_Price_Form_Set extends CRM_Core_Form { // help text $this->add('textarea', 'help_pre', ts('Pre-form Help'), - CRM_Core_DAO::getAttribute('CRM_Price_DAO_Set', 'help_pre') + CRM_Core_DAO::getAttribute('CRM_Price_DAO_PriceSet', 'help_pre') ); $this->add('textarea', 'help_post', ts('Post-form Help'), - CRM_Core_DAO::getAttribute('CRM_Price_DAO_Set', 'help_post') + CRM_Core_DAO::getAttribute('CRM_Price_DAO_PriceSet', 'help_post') ); // is this set active ? @@ -242,7 +242,7 @@ class CRM_Price_Form_Set extends CRM_Core_Form { $defaults = array('is_active' => TRUE); if ($this->_sid) { $params = array('id' => $this->_sid); - CRM_Price_BAO_Set::retrieve($params, $defaults); + CRM_Price_BAO_PriceSet::retrieve($params, $defaults); $extends = explode(CRM_Core_DAO::VALUE_SEPARATOR, $defaults['extends']); unset($defaults['extends']); foreach ($extends as $compId) $defaults['extends'][$compId] = 1; @@ -262,7 +262,7 @@ class CRM_Price_Form_Set extends CRM_Core_Form { public function postProcess() { // get the submitted form values. $params = $this->controller->exportValues('Set'); - $nameLength = CRM_Core_DAO::getAttribute('CRM_Price_DAO_Set', 'name'); + $nameLength = CRM_Core_DAO::getAttribute('CRM_Price_DAO_PriceSet', 'name'); $params['name'] = CRM_Utils_String::titleToVar($params['title'], CRM_Utils_Array::value('maxlength', $nameLength)); $params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE); $params['financial_type_id'] = CRM_Utils_Array::value('financial_type_id', $params, FALSE); @@ -278,7 +278,7 @@ class CRM_Price_Form_Set extends CRM_Core_Form { $params['id'] = $this->_sid; } - $set = CRM_Price_BAO_Set::create($params); + $set = CRM_Price_BAO_PriceSet::create($params); if ($this->_action & CRM_Core_Action::UPDATE) { CRM_Core_Session::setStatus(ts('The Set \'%1\' has been saved.', array(1 => $set->title)), ts('Saved'), 'success'); } diff --git a/CRM/Price/Page/Field.php b/CRM/Price/Page/Field.php index 8870bec4ac..83d8743ec6 100644 --- a/CRM/Price/Page/Field.php +++ b/CRM/Price/Page/Field.php @@ -93,13 +93,13 @@ class CRM_Price_Page_Field extends CRM_Core_Page { ), CRM_Core_Action::DISABLE => array( 'name' => ts('Disable'), - 'extra' => 'onclick = "enableDisable( %%fid%%,\'' . 'CRM_Price_BAO_Field' . '\',\'' . 'enable-disable' . '\' );"', + 'extra' => 'onclick = "enableDisable( %%fid%%,\'' . 'CRM_Price_BAO_PriceField' . '\',\'' . 'enable-disable' . '\' );"', 'ref' => 'disable-action', 'title' => ts('Disable Price'), ), CRM_Core_Action::ENABLE => array( 'name' => ts('Enable'), - 'extra' => 'onclick = "enableDisable( %%fid%%,\'' . 'CRM_Price_BAO_Field' . '\',\'' . 'disable-enable' . '\' );"', + 'extra' => 'onclick = "enableDisable( %%fid%%,\'' . 'CRM_Price_BAO_PriceField' . '\',\'' . 'disable-enable' . '\' );"', 'ref' => 'enable-action', 'title' => ts('Enable Price'), ), @@ -125,7 +125,7 @@ class CRM_Price_Page_Field extends CRM_Core_Page { */ function browse() { $priceField = array(); - $priceFieldBAO = new CRM_Price_BAO_Field(); + $priceFieldBAO = new CRM_Price_BAO_PriceField(); // fkey is sid $priceFieldBAO->price_set_id = $this->_sid; @@ -141,7 +141,7 @@ class CRM_Price_Page_Field extends CRM_Core_Page { $optionValues = array(); $params = array('price_field_id' => $priceFieldBAO->id); - CRM_Price_BAO_FieldValue::retrieve($params, $optionValues); + CRM_Price_BAO_PriceFieldValue::retrieve($params, $optionValues); $priceField[$priceFieldBAO->id]['price'] = CRM_Utils_Array::value('amount', $optionValues); } @@ -169,7 +169,7 @@ class CRM_Price_Page_Field extends CRM_Core_Page { } // need to translate html types from the db - $htmlTypes = CRM_Price_BAO_Field::htmlTypes(); + $htmlTypes = CRM_Price_BAO_PriceField::htmlTypes(); $priceField[$priceFieldBAO->id]['html_type'] = $htmlTypes[$priceField[$priceFieldBAO->id]['html_type']]; $priceField[$priceFieldBAO->id]['order'] = $priceField[$priceFieldBAO->id]['weight']; $priceField[$priceFieldBAO->id]['action'] = CRM_Core_Action::formLink(self::actionLinks(), $action, @@ -182,7 +182,7 @@ class CRM_Price_Page_Field extends CRM_Core_Page { $returnURL = CRM_Utils_System::url('civicrm/admin/price/field', "reset=1&action=browse&sid={$this->_sid}"); $filter = "price_set_id = {$this->_sid}"; - CRM_Utils_Weight::addOrder($priceField, 'CRM_Price_DAO_Field', + CRM_Utils_Weight::addOrder($priceField, 'CRM_Price_DAO_PriceField', 'id', $returnURL, $filter ); $this->assign('priceField', $priceField); @@ -239,12 +239,12 @@ class CRM_Price_Page_Field extends CRM_Core_Page { ); if ($this->_sid) { - $usedBy = CRM_Price_BAO_Set::getUsedBy($this->_sid); + $usedBy = CRM_Price_BAO_PriceSet::getUsedBy($this->_sid); $this->assign('usedBy', $usedBy); - $this->_isSetReserved= CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $this->_sid, 'is_reserved'); + $this->_isSetReserved= CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_sid, 'is_reserved'); $this->assign('isReserved', $this->_isSetReserved); - CRM_Price_BAO_Set::checkPermission($this->_sid); + CRM_Price_BAO_PriceSet::checkPermission($this->_sid); $comps = array( 'Event' => 'civicrm_event', 'Contribution' => 'civicrm_contribution_page', @@ -276,12 +276,12 @@ class CRM_Price_Page_Field extends CRM_Core_Page { CRM_Utils_System::appendBreadCrumb(ts('Price'), $url ); - $this->assign('usedPriceSetTitle', CRM_Price_BAO_Field::getTitle($fid)); + $this->assign('usedPriceSetTitle', CRM_Price_BAO_PriceField::getTitle($fid)); } } if ($this->_sid) { - $groupTitle = CRM_Price_BAO_Set::getTitle($this->_sid); + $groupTitle = CRM_Price_BAO_PriceSet::getTitle($this->_sid); $this->assign('sid', $this->_sid); $this->assign('groupTitle', $groupTitle); CRM_Utils_System::setTitle(ts('%1 - Price Fields', array(1 => $groupTitle))); diff --git a/CRM/Price/Page/Option.php b/CRM/Price/Page/Option.php index 6ac60c4659..507fdb206b 100644 --- a/CRM/Price/Page/Option.php +++ b/CRM/Price/Page/Option.php @@ -99,13 +99,13 @@ class CRM_Price_Page_Option extends CRM_Core_Page { ), CRM_Core_Action::DISABLE => array( 'name' => ts('Disable'), - 'extra' => 'onclick = "enableDisable( %%oid%%,\'' . 'CRM_Price_BAO_FieldValue' . '\',\'' . 'enable-disable' . '\' );"', + 'extra' => 'onclick = "enableDisable( %%oid%%,\'' . 'CRM_Price_BAO_PriceFieldValue' . '\',\'' . 'enable-disable' . '\' );"', 'ref' => 'disable-action', 'title' => ts('Disable Price Option'), ), CRM_Core_Action::ENABLE => array( 'name' => ts('Enable'), - 'extra' => 'onclick = "enableDisable( %%oid%%,\'' . 'CRM_Price_BAO_FieldValue' . '\',\'' . 'disable-enable' . '\' );"', + 'extra' => 'onclick = "enableDisable( %%oid%%,\'' . 'CRM_Price_BAO_PriceFieldValue' . '\',\'' . 'disable-enable' . '\' );"', 'ref' => 'enable-action', 'title' => ts('Enable Price Option'), ), @@ -130,7 +130,7 @@ class CRM_Price_Page_Option extends CRM_Core_Page { */ function browse() { $customOption = array(); - CRM_Price_BAO_FieldValue::getValues($this->_fid, $customOption); + CRM_Price_BAO_PriceFieldValue::getValues($this->_fid, $customOption); $config = CRM_Core_Config::singleton(); $financialType = CRM_Contribute_PseudoConstant::financialType(); foreach ($customOption as $id => $values) { @@ -168,7 +168,7 @@ class CRM_Price_Page_Option extends CRM_Core_Page { // Add order changing widget to selector $returnURL = CRM_Utils_System::url('civicrm/admin/price/field/option', "action=browse&reset=1&fid={$this->_fid}&sid={$this->_sid}"); $filter = "price_field_id = {$this->_fid}"; - CRM_Utils_Weight::addOrder($customOption, 'CRM_Price_DAO_FieldValue', + CRM_Utils_Weight::addOrder($customOption, 'CRM_Price_DAO_PriceFieldValue', 'id', $returnURL, $filter ); @@ -193,9 +193,9 @@ class CRM_Price_Page_Option extends CRM_Core_Page { $params = array(); if ($oid) { $params['oid'] = $oid; - $sid = CRM_Price_BAO_Set::getSetId($params); + $sid = CRM_Price_BAO_PriceSet::getSetId($params); - $usedBy = CRM_Price_BAO_Set::getUsedBy($sid); + $usedBy = CRM_Price_BAO_PriceSet::getUsedBy($sid); } // set the userContext stack $session = CRM_Core_Session::singleton(); @@ -218,7 +218,7 @@ class CRM_Price_Page_Option extends CRM_Core_Page { CRM_Utils_System::appendBreadCrumb(ts('Price Option'), $url ); - $this->assign('usedPriceSetTitle', CRM_Price_BAO_FieldValue::getOptionLabel($oid)); + $this->assign('usedPriceSetTitle', CRM_Price_BAO_PriceFieldValue::getOptionLabel($oid)); $this->assign('usedBy', $usedBy); $comps = array( "Event" => "civicrm_event", @@ -257,8 +257,8 @@ class CRM_Price_Page_Option extends CRM_Core_Page { } if ($this->_sid) { - CRM_Price_BAO_Set::checkPermission($this->_sid); - $this->_isSetReserved= CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $this->_sid, 'is_reserved'); + CRM_Price_BAO_PriceSet::checkPermission($this->_sid); + $this->_isSetReserved= CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_sid, 'is_reserved'); $this->assign('isReserved', $this->_isSetReserved); } //as url contain $sid so append breadcrumb dynamically. @@ -268,12 +268,12 @@ class CRM_Price_Page_Option extends CRM_Core_Page { CRM_Utils_System::appendBreadCrumb($breadcrumb); if ($this->_fid) { - $fieldTitle = CRM_Price_BAO_Field::getTitle($this->_fid); + $fieldTitle = CRM_Price_BAO_PriceField::getTitle($this->_fid); $this->assign('fid', $this->_fid); $this->assign('fieldTitle', $fieldTitle); CRM_Utils_System::setTitle(ts('%1 - Price Options', array(1 => $fieldTitle))); - $htmlType = CRM_Core_DAO::getFieldValue('CRM_Price_BAO_Field', $this->_fid, 'html_type'); + $htmlType = CRM_Core_DAO::getFieldValue('CRM_Price_BAO_PriceField', $this->_fid, 'html_type'); $this->assign('addMoreFields', TRUE); //for text price field only single option present if ($htmlType == 'Text') { diff --git a/CRM/Price/Page/Set.php b/CRM/Price/Page/Set.php index 9940d67c7f..ea1fcba15d 100644 --- a/CRM/Price/Page/Set.php +++ b/CRM/Price/Page/Set.php @@ -84,13 +84,13 @@ class CRM_Price_Page_Set extends CRM_Core_Page { ), CRM_Core_Action::DISABLE => array( 'name' => ts('Disable'), - 'extra' => 'onclick = "enableDisable( %%sid%%,\'' . 'CRM_Price_BAO_Set' . '\',\'' . 'enable-disable' . '\' );"', + 'extra' => 'onclick = "enableDisable( %%sid%%,\'' . 'CRM_Price_BAO_PriceSet' . '\',\'' . 'enable-disable' . '\' );"', 'ref' => 'disable-action', 'title' => ts('Disable Price Set'), ), CRM_Core_Action::ENABLE => array( 'name' => ts('Enable'), - 'extra' => 'onclick = "enableDisable( %%sid%%,\'' . 'CRM_Price_BAO_Set' . '\',\'' . 'disable-enable' . '\' );"', + 'extra' => 'onclick = "enableDisable( %%sid%%,\'' . 'CRM_Price_BAO_PriceSet' . '\',\'' . 'disable-enable' . '\' );"', 'ref' => 'enable-action', 'title' => ts('Enable Price Set'), ), @@ -140,7 +140,7 @@ class CRM_Price_Page_Set extends CRM_Core_Page { ); if ($sid) { - CRM_Price_BAO_Set::checkPermission($sid); + CRM_Price_BAO_PriceSet::checkPermission($sid); } // what action to take ? if ($action & (CRM_Core_Action::UPDATE | CRM_Core_Action::ADD)) { @@ -158,7 +158,7 @@ class CRM_Price_Page_Set extends CRM_Core_Page { // if action is delete do the needful. if ($action & (CRM_Core_Action::DELETE)) { - $usedBy = CRM_Price_BAO_Set::getUsedBy($sid); + $usedBy = CRM_Price_BAO_PriceSet::getUsedBy($sid); if (empty($usedBy)) { // prompt to delete @@ -175,7 +175,7 @@ class CRM_Price_Page_Set extends CRM_Core_Page { // add breadcrumb $url = CRM_Utils_System::url('civicrm/admin/price', 'reset=1'); CRM_Utils_System::appendBreadCrumb(ts('Price Sets'), $url); - $this->assign('usedPriceSetTitle', CRM_Price_BAO_Set::getTitle($sid)); + $this->assign('usedPriceSetTitle', CRM_Price_BAO_PriceSet::getTitle($sid)); $this->assign('usedBy', $usedBy); $comps = array( @@ -262,8 +262,8 @@ class CRM_Price_Page_Set extends CRM_Core_Page { 'CiviMember' => ts('Membership'), ); - $dao = new CRM_Price_DAO_Set(); - if (CRM_Price_BAO_Set::eventPriceSetDomainID()) { + $dao = new CRM_Price_DAO_PriceSet(); + if (CRM_Price_BAO_PriceSet::eventPriceSetDomainID()) { $dao->domain_id = CRM_Core_Config::domainID(); } $dao->is_quick_config = 0; @@ -318,7 +318,7 @@ class CRM_Price_Page_Set extends CRM_Core_Page { $this, TRUE, 0, 'GET' ); - CRM_Price_BAO_Set::copy($id); + CRM_Price_BAO_PriceSet::copy($id); CRM_Utils_System::redirect(CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1')); } diff --git a/CRM/Report/Form/Extended.php b/CRM/Report/Form/Extended.php index 8bc77c7c6b..c3c50b1fdc 100644 --- a/CRM/Report/Form/Extended.php +++ b/CRM/Report/Form/Extended.php @@ -206,7 +206,7 @@ class CRM_Report_Form_Extended extends CRM_Report_Form { return array( 'civicrm_price_field_value' => array( - 'dao' => 'CRM_Price_BAO_FieldValue', + 'dao' => 'CRM_Price_BAO_PriceFieldValue', 'fields' => array( 'price_field_value_label' => array('title' => ts('Price Field Value Label'), @@ -247,7 +247,7 @@ class CRM_Report_Form_Extended extends CRM_Report_Form { return array( 'civicrm_price_field' => array( - 'dao' => 'CRM_Price_BAO_Field', + 'dao' => 'CRM_Price_BAO_PriceField', 'fields' => array( 'price_field_label' => diff --git a/CRM/Upgrade/Incremental/php/FourTwo.php b/CRM/Upgrade/Incremental/php/FourTwo.php index 77659f1f03..ed01d053ef 100644 --- a/CRM/Upgrade/Incremental/php/FourTwo.php +++ b/CRM/Upgrade/Incremental/php/FourTwo.php @@ -642,7 +642,7 @@ WHERE cpf.price_set_id = %1 $priceSetId = $result->price_set_id; } else{ - $defaultPriceSets = CRM_Price_BAO_Set::getDefaultPriceSet(); + $defaultPriceSets = CRM_Price_BAO_PriceSet::getDefaultPriceSet(); foreach ($defaultPriceSets as $key => $pSet) { if ($pSet['name'] == 'contribution_amount'){ $priceSetId = $pSet['setID']; diff --git a/CRM/Upgrade/Incremental/php/ThreeThree.php b/CRM/Upgrade/Incremental/php/ThreeThree.php index fdcc479cd1..ee60dcde5b 100644 --- a/CRM/Upgrade/Incremental/php/ThreeThree.php +++ b/CRM/Upgrade/Incremental/php/ThreeThree.php @@ -138,7 +138,7 @@ WHERE id = %2 CRM_Core_DAO::executeQuery($updateLineItem1); - $priceFieldDAO = new CRM_Price_DAO_Field(); + $priceFieldDAO = new CRM_Price_DAO_PriceField(); $priceFieldDAO->find(); $ids = array(); while ($priceFieldDAO->fetch()) { @@ -175,7 +175,7 @@ WHERE id = %2 $fieldValue['count'] = $priceFieldDAO->count; } - $fieldValueDAO = CRM_Price_BAO_FieldValue::add($fieldValue, $ids); + $fieldValueDAO = CRM_Price_BAO_PriceFieldValue::add($fieldValue, $ids); $lineItemDAO = new CRM_Price_DAO_LineItem(); $lineItemDAO->option_group_id = $opGroupDAO->id; diff --git a/CRM/Utils/VersionCheck.php b/CRM/Utils/VersionCheck.php index f94487cdda..bcdc3a4b73 100644 --- a/CRM/Utils/VersionCheck.php +++ b/CRM/Utils/VersionCheck.php @@ -224,7 +224,7 @@ class CRM_Utils_VersionCheck { 'CRM_Contribute_DAO_ContributionProduct' => NULL, 'CRM_Contribute_DAO_Widget' => 'is_active = 1', 'CRM_Core_DAO_Discount' => NULL, - 'CRM_Price_DAO_SetEntity' => NULL, + 'CRM_Price_DAO_PriceSetEntity' => NULL, 'CRM_Core_DAO_UFGroup' => 'is_active = 1', 'CRM_Event_DAO_Event' => 'is_active = 1', 'CRM_Event_DAO_Participant' => 'is_test = 0', diff --git a/api/v3/PriceFieldValue.php b/api/v3/PriceFieldValue.php index 8aae82c36d..f79c825f29 100644 --- a/api/v3/PriceFieldValue.php +++ b/api/v3/PriceFieldValue.php @@ -52,7 +52,7 @@ function civicrm_api3_price_field_value_create($params) { $ids['id'] = $params['id']; } - $bao = CRM_Price_BAO_FieldValue::create($params, $ids); + $bao = CRM_Price_BAO_PriceFieldValue::create($params, $ids); $values = array(); _civicrm_api3_object_to_array($bao, $values[$bao->id]); diff --git a/api/v3/PriceSet.php b/api/v3/PriceSet.php index 6916b13e5c..19bc367819 100644 --- a/api/v3/PriceSet.php +++ b/api/v3/PriceSet.php @@ -57,7 +57,7 @@ function civicrm_api3_price_set_create($params) { foreach ($entityId as $eid) { $eid = (int) trim($eid); if ($eid) { - CRM_Price_BAO_Set::addTo($params['entity_table'], $eid, $result['id']); + CRM_Price_BAO_PriceSet::addTo($params['entity_table'], $eid, $result['id']); } } } @@ -87,7 +87,7 @@ function civicrm_api3_price_set_get($params) { $result = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, FALSE); // Fetch associated entities foreach ($result as &$item) { - $item['entity'] = CRM_Price_BAO_Set::getUsedBy($item['id'], 'entity'); + $item['entity'] = CRM_Price_BAO_PriceSet::getUsedBy($item['id'], 'entity'); } return civicrm_api3_create_success($result, $params); } diff --git a/api/v3/examples/ActivityTypeCreate.php b/api/v3/examples/ActivityTypeCreate.php index e6323a3b5e..9ae09772d1 100644 --- a/api/v3/examples/ActivityTypeCreate.php +++ b/api/v3/examples/ActivityTypeCreate.php @@ -28,10 +28,10 @@ function activity_type_create_expectedresult(){ 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 720, + 'id' => 722, 'values' => array( - '720' => array( - 'id' => '720', + '722' => array( + 'id' => '722', 'option_group_id' => '2', 'label' => 'send out letters', 'value' => '46', diff --git a/api/v3/examples/ActivityTypeDelete.php b/api/v3/examples/ActivityTypeDelete.php index b0c3598f86..b087ac58e7 100644 --- a/api/v3/examples/ActivityTypeDelete.php +++ b/api/v3/examples/ActivityTypeDelete.php @@ -5,7 +5,7 @@ */ function activity_type_delete_example(){ $params = array( - 'activity_type_id' => 722, + 'activity_type_id' => 724, 'version' => 3, ); diff --git a/api/v3/examples/ContributionRecurCreate.php b/api/v3/examples/ContributionRecurCreate.php index 137259bc85..722de8ea18 100644 --- a/api/v3/examples/ContributionRecurCreate.php +++ b/api/v3/examples/ContributionRecurCreate.php @@ -41,7 +41,7 @@ function contribution_recur_create_expectedresult(){ 'frequency_interval' => '1', 'installments' => '12', 'start_date' => '20120101000000', - 'create_date' => '20130622083552', + 'create_date' => '20130713234826', 'modified_date' => '2012-11-14 16:02:35', 'cancel_date' => '', 'end_date' => '', diff --git a/api/v3/examples/ContributionRecurGet.php b/api/v3/examples/ContributionRecurGet.php index 0b773fcd33..b1d1ebdda5 100644 --- a/api/v3/examples/ContributionRecurGet.php +++ b/api/v3/examples/ContributionRecurGet.php @@ -34,7 +34,7 @@ function contribution_recur_get_expectedresult(){ 'frequency_interval' => '1', 'installments' => '12', 'start_date' => '2012-01-01 00:00:00', - 'create_date' => '2013-06-22 08:35:53', + 'create_date' => '2013-07-13 23:48:27', 'contribution_status_id' => '1', 'is_test' => 0, 'cycle_day' => '1', diff --git a/api/v3/examples/PriceSetCreate.php b/api/v3/examples/PriceSetCreate.php index 7fff23c625..c041e0b8cc 100644 --- a/api/v3/examples/PriceSetCreate.php +++ b/api/v3/examples/PriceSetCreate.php @@ -31,10 +31,10 @@ function price_set_create_expectedresult(){ 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 15, + 'id' => 3, 'values' => array( - '15' => array( - 'id' => '15', + '3' => array( + 'id' => '3', 'domain_id' => '', 'name' => 'default_goat_priceset', 'title' => 'Goat accessories', diff --git a/api/v3/examples/PriceSetDelete.php b/api/v3/examples/PriceSetDelete.php index 741d4d322f..aec0a29b07 100644 --- a/api/v3/examples/PriceSetDelete.php +++ b/api/v3/examples/PriceSetDelete.php @@ -6,7 +6,7 @@ function price_set_delete_example(){ $params = array( 'version' => 3, - 'id' => 17, + 'id' => 5, ); $result = civicrm_api( 'price_set','delete',$params ); diff --git a/api/v3/examples/PriceSetSet.php b/api/v3/examples/PriceSetSet.php index a8ba0e23a7..694bdb89c9 100644 --- a/api/v3/examples/PriceSetSet.php +++ b/api/v3/examples/PriceSetSet.php @@ -27,10 +27,10 @@ function price_set_set_expectedresult(){ 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 16, + 'id' => 4, 'values' => array( - '16' => array( - 'id' => '16', + '4' => array( + 'id' => '4', 'domain_id' => '', 'name' => 'event price', 'title' => 'event price', diff --git a/api/v3/utils.php b/api/v3/utils.php index 38e2d06809..cd67feb0b8 100644 --- a/api/v3/utils.php +++ b/api/v3/utils.php @@ -273,20 +273,10 @@ function _civicrm_api3_get_DAO($name) { $name = 'Contact'; } - //hack to deal with incorrectly named BAO/DAO - see CRM-10859 - remove after rename - if($name == 'price_set' || $name == 'PriceSet'){ - return 'CRM_Price_DAO_Set'; - } - if($name == 'price_field' || $name == 'PriceField'){ - return 'CRM_Price_DAO_Field'; - } - if($name == 'price_field_value' || $name == 'PriceFieldValue'){ - return 'CRM_Price_DAO_FieldValue'; - } - // these aren't listed on ticket CRM-10859 - but same problem - lack of standardisation - if($name == 'mailing_job' || $name == 'MailingJob'){ - return 'CRM_Mailing_BAO_Job'; - } + //hack to deal with incorrectly named BAO/DAO - see CRM-10859 - + // several of these have been removed but am not confident mailing_recipients is + // tests so have not tackled. + // correct approach for im is unclear if($name == 'mailing_recipients' || $name == 'MailingRecipients'){ return 'CRM_Mailing_BAO_Recipients'; } diff --git a/sql/GenerateMailing.php b/sql/GenerateMailing.php index e0e5a94ef6..5e946490de 100644 --- a/sql/GenerateMailing.php +++ b/sql/GenerateMailing.php @@ -73,7 +73,7 @@ for ($i = 1; $i <= $numGroups; $i++) { $mailing->is_completed = 1; $mailing->save(); - $job = new CRM_Mailing_BAO_Job(); + $job = new CRM_Mailing_BAO_MailingJob(); $job->mailing_id = $mailing->id; $job->scheduled_date = generateRandomDate(); $job->start_date = generateRandomDate(); diff --git a/tests/phpunit/CRM/Core/PseudoConstantTest.php b/tests/phpunit/CRM/Core/PseudoConstantTest.php index 000fa2622b..9eed410239 100644 --- a/tests/phpunit/CRM/Core/PseudoConstantTest.php +++ b/tests/phpunit/CRM/Core/PseudoConstantTest.php @@ -201,7 +201,7 @@ class CRM_Core_PseudoConstantTest extends CiviUnitTestCase { 'sample' => 'Public', ), ), - 'CRM_Price_DAO_Field' => array( + 'CRM_Price_DAO_PriceField' => array( array( 'fieldName' => 'visibility_id', 'sample' => 'Public', diff --git a/tests/phpunit/CRM/Event/BAO/ParticipantTest.php b/tests/phpunit/CRM/Event/BAO/ParticipantTest.php index 57b206638c..143a850b2a 100644 --- a/tests/phpunit/CRM/Event/BAO/ParticipantTest.php +++ b/tests/phpunit/CRM/Event/BAO/ParticipantTest.php @@ -348,10 +348,10 @@ class CRM_Event_BAO_ParticipantTest extends CiviUnitTestCase { $paramsSet['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE); $paramsSet['extends'] = 1; - $priceset = CRM_Price_BAO_Set::create($paramsSet); + $priceset = CRM_Price_BAO_PriceSet::create($paramsSet); //Checking for priceset added in the table. - $this->assertDBCompareValue('CRM_Price_BAO_Set', $priceset->id, 'title', + $this->assertDBCompareValue('CRM_Price_BAO_PriceSet', $priceset->id, 'title', 'id', $paramsSet['title'], 'Check DB for created priceset' ); $paramsField = array( @@ -372,10 +372,10 @@ class CRM_Event_BAO_ParticipantTest extends CiviUnitTestCase { ); $ids = array(); - $pricefield = CRM_Price_BAO_Field::create($paramsField, $ids); + $pricefield = CRM_Price_BAO_PriceField::create($paramsField, $ids); //Checking for priceset added in the table. - $this->assertDBCompareValue('CRM_Price_BAO_Field', $pricefield->id, 'label', + $this->assertDBCompareValue('CRM_Price_BAO_PriceField', $pricefield->id, 'label', 'id', $paramsField['label'], 'Check DB for created pricefield' ); @@ -414,13 +414,13 @@ class CRM_Event_BAO_ParticipantTest extends CiviUnitTestCase { CRM_Event_BAO_Participant::fixEventLevel($values[$participant->id]['fee_level']); } - $deletePricefield = CRM_Price_BAO_Field::deleteField($pricefield->id); - $this->assertDBNull('CRM_Price_BAO_Field', $pricefield->id, 'name', + $deletePricefield = CRM_Price_BAO_PriceField::deleteField($pricefield->id); + $this->assertDBNull('CRM_Price_BAO_PriceField', $pricefield->id, 'name', 'id', 'Check DB for non-existence of Price Field.' ); - $deletePriceset = CRM_Price_BAO_Set::deleteSet($priceset->id); - $this->assertDBNull('CRM_Price_BAO_Set', $priceset->id, 'title', + $deletePriceset = CRM_Price_BAO_PriceSet::deleteSet($priceset->id); + $this->assertDBNull('CRM_Price_BAO_PriceSet', $priceset->id, 'title', 'id', 'Check DB for non-existence of Price Set.' ); diff --git a/tools/scripts/civimail-spooler/civimail-spooler.php b/tools/scripts/civimail-spooler/civimail-spooler.php index 7cf3f6543e..63bb5a83a5 100644 --- a/tools/scripts/civimail-spooler/civimail-spooler.php +++ b/tools/scripts/civimail-spooler/civimail-spooler.php @@ -35,11 +35,11 @@ if (isset($options['b'])) { - CRM_Mailing_BAO_Job::runJobs(); + CRM_Mailing_BAO_MailingJob::runJobs(); sleep($config->mailerPeriod); } } else { - CRM_Mailing_BAO_Job::runJobs(); + CRM_Mailing_BAO_MailingJob::runJobs(); } diff --git a/xml/schema/Mailing/Job.xml b/xml/schema/Mailing/MailingJob.xml similarity index 98% rename from xml/schema/Mailing/Job.xml rename to xml/schema/Mailing/MailingJob.xml index f94817ec16..e13aaca2c4 100644 --- a/xml/schema/Mailing/Job.xml +++ b/xml/schema/Mailing/MailingJob.xml @@ -2,7 +2,7 @@ CRM/Mailing - Job + MailingJobcivicrm_mailing_jobStores information about the job that executes this mailingtrue diff --git a/xml/schema/Mailing/files.xml b/xml/schema/Mailing/files.xml index b2c9e070ec..80d8caa6d4 100644 --- a/xml/schema/Mailing/files.xml +++ b/xml/schema/Mailing/files.xml @@ -6,7 +6,7 @@ - + diff --git a/xml/schema/Price/Field.xml b/xml/schema/Price/PriceField.xml similarity index 99% rename from xml/schema/Price/Field.xml rename to xml/schema/Price/PriceField.xml index b79067e455..e89f8453cc 100644 --- a/xml/schema/Price/Field.xml +++ b/xml/schema/Price/PriceField.xml @@ -2,7 +2,7 @@
CRM/Price - Field + PriceFieldcivicrm_price_field1.8true diff --git a/xml/schema/Price/FieldValue.xml b/xml/schema/Price/PriceFieldValue.xml similarity index 99% rename from xml/schema/Price/FieldValue.xml rename to xml/schema/Price/PriceFieldValue.xml index 640fba32f5..6a7b817cce 100644 --- a/xml/schema/Price/FieldValue.xml +++ b/xml/schema/Price/PriceFieldValue.xml @@ -2,7 +2,7 @@
CRM/Price - FieldValue + PriceFieldValuecivicrm_price_field_value3.3 diff --git a/xml/schema/Price/Set.xml b/xml/schema/Price/PriceSet.xml similarity index 99% rename from xml/schema/Price/Set.xml rename to xml/schema/Price/PriceSet.xml index b750b256e0..c81cb83e28 100644 --- a/xml/schema/Price/Set.xml +++ b/xml/schema/Price/PriceSet.xml @@ -2,7 +2,7 @@
CRM/Price - Set + PriceSetcivicrm_price_set1.8true diff --git a/xml/schema/Price/SetEntity.xml b/xml/schema/Price/PriceSetEntity.xml similarity index 97% rename from xml/schema/Price/SetEntity.xml rename to xml/schema/Price/PriceSetEntity.xml index c16bb088b0..4614eb7722 100644 --- a/xml/schema/Price/SetEntity.xml +++ b/xml/schema/Price/PriceSetEntity.xml @@ -2,7 +2,7 @@
CRM/Price - SetEntity + PriceSetEntitycivicrm_price_set_entity1.8true diff --git a/xml/schema/Price/files.xml b/xml/schema/Price/files.xml index 73a96bfbb5..450952f69d 100644 --- a/xml/schema/Price/files.xml +++ b/xml/schema/Price/files.xml @@ -1,9 +1,9 @@ - - + + - - + + -- 2.25.1