'repetition_frequency_interval' => 1,
'start_action_offset' => $numberOfRepeatingActivitiesToCreate - 1,
];
- $actionScheduleBao = CRM_Core_BAO_ActionSchedule::add($actionScheduleParams);
+ $actionScheduleBao = CRM_Core_BAO_ActionSchedule::writeRecord($actionScheduleParams);
// Create the activity's repeats.
$recurringEntityBao = new CRM_Core_BAO_RecurringEntity();
$this->assertEquals($result->name, $params['name']);
$this->assertEquals($result->parent_id, $params['parent_id']);
$this->assertEquals($result->is_active, $params['is_active']);
- CRM_Contact_BAO_ContactType::del($result->id);
+ CRM_Contact_BAO_ContactType::deleteRecord(['id' => $result->id]);
$params = [
'label' => 'householdSubType',
$this->assertEquals($result->name, $params['name']);
$this->assertEquals($result->parent_id, $params['parent_id']);
$this->assertEquals($result->is_active, $params['is_active']);
- CRM_Contact_BAO_ContactType::del($result->id);
+ CRM_Contact_BAO_ContactType::deleteRecord(['id' => $result->id]);
}
/**
$this->assertEquals(FALSE, in_array($subtype->name, $result, TRUE));
}
- /**
- * Test del() with invalid data
- */
- public function testDelInvalid() {
- $del = CRM_Contact_BAO_ContactType::del(NULL);
- $this->assertEquals($del, FALSE);
- }
-
}
$this->assertEquals($contributionProduct->product_id, $premium->id, 'Check for Product id .');
//Delete Product
- CRM_Contribute_BAO_Product::del($premium->id);
+ CRM_Contribute_BAO_Product::deleteRecord(['id' => $premium->id]);
$this->assertDBNull('CRM_Contribute_DAO_Product', $premium->name,
'id', 'name', 'Database check for deleted Product.'
);
'is_deductible' => 0,
'is_active' => 1,
];
- $ids = [];
- $contributionType = CRM_Financial_BAO_FinancialType::add($params, $ids);
+ $contributionType = CRM_Financial_BAO_FinancialType::writeRecord($params);
$result = $this->assertDBNotNull('CRM_Financial_BAO_FinancialType', $contributionType->id,
'name', 'id',
'is_deductible' => 0,
'is_active' => 1,
];
- $ids = [];
- $contributionType = CRM_Financial_BAO_FinancialType::add($params, $ids);
+ $contributionType = CRM_Financial_BAO_FinancialType::writeRecord($params);
$result = CRM_Financial_BAO_FinancialType::setIsActive($contributionType->id, 0);
$this->assertEquals($result, TRUE, 'Verify financial type record updation for is_active.');
];
$product = CRM_Contribute_BAO_Product::create($params);
- CRM_Contribute_BAO_Product::del($product->id);
+ CRM_Contribute_BAO_Product::deleteRecord(['id' => $product->id]);
$params = ['id' => $product->id];
$defaults = [];
$modifiedDate = $this->callAPISuccess('Contact', 'getvalue', ['id' => $contact['id'], 'return' => 'modified_date']);
$actionSchedule = $this->createScheduleFromFixtures('sched_contact_mod_anniversary');
$actionSchedule['effective_start_date'] = date('Y-m-d H:i:s', strtotime($contact['values'][$contact['id']]['modified_date']));
- $actionScheduleDao = CRM_Core_BAO_ActionSchedule::add($actionSchedule);
+ $actionScheduleDao = CRM_Core_BAO_ActionSchedule::writeRecord($actionSchedule);
$this->assertCronRuns([
[
// On some random day, no email.
$actionScheduleAfter['effective_end_date'] = '2012-06-16 02:00:00';
$actionScheduleBefore['entity_value'] = $actionScheduleOn['entity_value'] = $actionScheduleAfter['entity_value'] = $membership['membership_type_id'];
foreach (['actionScheduleBefore', 'actionScheduleOn', 'actionScheduleAfter'] as $value) {
- $$value = CRM_Core_BAO_ActionSchedule::add($$value);
+ $$value = CRM_Core_BAO_ActionSchedule::writeRecord($$value);
}
$this->assertCronRuns(
$actionScheduleParams['entity_value'] = $membershipType->id;
$actionScheduleParams['repetition_frequency_unit'] = $interval_unit;
$actionScheduleParams['repetition_frequency_interval'] = 2;
- $actionSchedule = CRM_Core_BAO_ActionSchedule::add($actionScheduleParams);
+ $actionSchedule = CRM_Core_BAO_ActionSchedule::writeRecord($actionScheduleParams);
$beforeEndDate = $this->createModifiedDateTime($membershipEndDate, '-1 day');
$beforeFirstUnit = $this->createModifiedDateTime($membershipEndDate, "+1 $interval_unit");
$afterFirstUnit = $this->createModifiedDateTime($membershipEndDate, "+2 $interval_unit");
"start_action_condition" => "monday,tuesday,wednesday,thursday,friday,saturday",
"start_action_offset" => "2",
];
- $actionScheduleObj = CRM_Core_BAO_ActionSchedule::add($params);
+ $actionScheduleObj = CRM_Core_BAO_ActionSchedule::writeRecord($params);
return $actionScheduleObj;
}
];
$ufGroup = CRM_Core_BAO_UFGroup::add($params);
$ufGroupID = $ufGroup->id;
- $ufGroup = CRM_Core_BAO_UFGroup::del($ufGroupID);
+ $ufGroup = CRM_Core_BAO_UFGroup::deleteRecord(['id' => $ufGroupID]);
// Assert that pre hook implemntation was called for delete op.
$systemLogCount = $this->callAPISuccess('SystemLog', 'getcount', [
];
$ufGroup = CRM_Core_BAO_UFGroup::add($params);
$ufGroupID = $ufGroup->id;
- $ufGroup = CRM_Core_BAO_UFGroup::del($ufGroupID);
+ $ufGroup = CRM_Core_BAO_UFGroup::deleteRecord(['id' => $ufGroupID]);
// Assert that pre hook implemntation was called for delete op.
$systemLogCount = $this->callAPISuccess('SystemLog', 'getcount', [
'is_deductible' => 0,
'is_active' => 1,
];
- $ids = [];
- $financialAccount = CRM_Financial_BAO_FinancialAccount::add($params, $ids);
+ $financialAccount = CRM_Financial_BAO_FinancialAccount::writeRecord($params);
$result = $this->assertDBNotNull(
'CRM_Financial_BAO_FinancialAccount',
'is_deductible' => 0,
'is_active' => 1,
];
- $ids = $defaults = [];
- CRM_Financial_BAO_FinancialAccount::add($params);
+ $defaults = [];
+ CRM_Financial_BAO_FinancialAccount::writeRecord($params);
$result = CRM_Financial_BAO_FinancialAccount::retrieve($params, $defaults);
'is_deductible' => 0,
'is_active' => 1,
];
- $ids = [];
- $financialAccount = CRM_Financial_BAO_FinancialAccount::add($params, $ids);
+ $financialAccount = CRM_Financial_BAO_FinancialAccount::writeRecord($params);
$result = CRM_Financial_BAO_FinancialAccount::setIsActive($financialAccount->id, 0);
$this->assertEquals($result, TRUE, 'Verify financial account record updation for is_active.');
'is_deductible' => 0,
'is_active' => 1,
];
- $financialAccount = CRM_Financial_BAO_FinancialAccount::add($params);
+ $financialAccount = CRM_Financial_BAO_FinancialAccount::writeRecord($params);
CRM_Financial_BAO_FinancialAccount::del($financialAccount->id);
$params = ['id' => $financialAccount->id];
'is_reserved' => 0,
];
- $ids = [];
- $financialType = CRM_Financial_BAO_FinancialType::add($params, $ids);
+ $financialType = CRM_Financial_BAO_FinancialType::writeRecord($params);
$financialAccountid = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialAccount', 'Donations', 'id', 'name');
CRM_Core_DAO::setFieldValue('CRM_Financial_DAO_FinancialAccount', $financialAccountid, 'accounting_code', '4800');
$accountingCode = CRM_Financial_BAO_FinancialAccount::getAccountingCode($financialType->id);
];
$amount = 200;
- $financialAccount = CRM_Financial_BAO_FinancialAccount::add($fParams);
+ $financialAccount = CRM_Financial_BAO_FinancialAccount::writeRecord($fParams);
$financialTrxn = new CRM_Financial_DAO_FinancialTrxn();
$financialTrxn->to_financial_account_id = $financialAccount->id;
$financialTrxn->total_amount = $amount;
'is_reserved' => 0,
'financial_account_type_id' => array_search($financialAccountType, $financialAccountTypes),
];
- $financialAccount = CRM_Financial_BAO_FinancialAccount::add($params);
+ $financialAccount = CRM_Financial_BAO_FinancialAccount::writeRecord($params);
$financialType = $financialAccountType = NULL;
if ($relationType) {
$params['name'] = 'test_financialType1';
- $financialType = CRM_Financial_BAO_FinancialType::add($params);
+ $financialType = CRM_Financial_BAO_FinancialType::writeRecord($params);
$financialParams = [
'entity_table' => 'civicrm_financial_type',
'entity_id' => $financialType->id,
*/
public function testDel() {
list($contactID, $membershipID) = $this->setupMembership();
- CRM_Member_BAO_MembershipLog::del($membershipID);
+ CRM_Member_BAO_MembershipLog::deleteRecord(['id' => $membershipID]);
$this->assertDBNull('CRM_Member_BAO_MembershipLog', $membershipID, 'membership_id',
'id', 'Database check for deleted membership log.'
);
$params = ['name' => 'testStatus', 'is_active' => 1];
$membershipID = $this->callAPISuccess('MembershipStatus', 'create', $params)['id'];
- CRM_Member_BAO_MembershipStatus::del($membershipID);
+ CRM_Member_BAO_MembershipStatus::deleteRecord(['id' => $membershipID]);
$defaults = [];
$result = CRM_Member_BAO_MembershipStatus::retrieve($params, $defaults);
$this->assertEquals($result === NULL, TRUE, 'Verify membership status record deletion.');
return $entity = $this->callAPISuccess($this->entity, 'create', $this->params);
}
- /**
- * @param int $contactTypeId
- *
- * @throws Exception
- */
- public function contactTypeDelete($contactTypeId) {
- $result = CRM_Contact_BAO_ContactType::del($contactTypeId);
- if (!$result) {
- throw new Exception('Could not delete contact type');
- }
- }
-
/**
* @param array $params
*