Skip to content

Commit

Permalink
Prevent intermittant fail on pcp api calls.
Browse files Browse the repository at this point in the history
When I run the SyntaxConformance tests locally I get a fatal error because it tries
to include api_v3_pcp.php after having included api_v3_PCP.php & thinks they are 2 files.
This is a Mac so obviously the handling is different to the jenkins method. Not overwriting the
 param if passed in works locally
  • Loading branch information
eileenmcnaughton committed Jan 29, 2018
1 parent 06d7516 commit 3c931e2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CRM/Member/BAO/MembershipBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static function create(&$params) {
$hook = empty($params['id']) ? 'create' : 'edit';
CRM_Utils_Hook::pre($hook, 'MembershipBlock', CRM_Utils_Array::value('id', $params), $params);
$dao = new CRM_Member_DAO_MembershipBlock();
$dao->copyValues($params);
$dao->copyValues($params, TRUE);
$dao->id = CRM_Utils_Array::value('id', $params);
$dao->save();
CRM_Utils_Hook::post($hook, 'MembershipBlock', $dao->id, $dao);
Expand Down
2 changes: 1 addition & 1 deletion api/v3/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,7 @@ function formatCheckBoxField(&$checkboxFieldValue, $customFieldLabel, $entity) {
* @return array
*/
function _civicrm_api3_basic_get($bao_name, $params, $returnAsSuccess = TRUE, $entity = "", $sql = NULL, $uniqueFields = FALSE) {
$entity = CRM_Core_DAO_AllCoreTables::getBriefName(str_replace('_BAO_', '_DAO_', $bao_name));
$entity = $entity ? : CRM_Core_DAO_AllCoreTables::getBriefName(str_replace('_BAO_', '_DAO_', $bao_name));
$options = _civicrm_api3_get_options_from_params($params);

$query = new \Civi\API\Api3SelectQuery($entity, CRM_Utils_Array::value('check_permissions', $params, FALSE));
Expand Down
3 changes: 3 additions & 0 deletions tests/phpunit/api/v3/SyntaxConformanceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1356,6 +1356,9 @@ public function testCreateSingleValueAlter($entityName) {
'id' => $entity['id'],
$field => isset($entity[$field]) ? $entity[$field] : NULL,
);
if (!empty($specs['serialize'])) {
$updateParams[$field] = (array) $specs['serialize'];
}
if (isset($updateParams['financial_type_id']) && in_array($entityName, array('Grant'))) {
//api has special handling on these 2 fields for backward compatibility reasons
$entity['contribution_type_id'] = $updateParams['financial_type_id'];
Expand Down

0 comments on commit 3c931e2

Please sign in to comment.