-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API - Consistently save custom data for v3 & v4 #24036
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -174,6 +174,7 @@ public static function getList($filterMapping = NULL, $filterValue = NULL): arra | |
* @param array $params | ||
* An assoc array of name/value pairs. | ||
* | ||
* @deprecated | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
* @return CRM_Core_DAO_ActionSchedule | ||
* @throws \CRM_Core_Exception | ||
*/ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -149,6 +149,7 @@ public function getLocationValues() { | |
* @param array $params | ||
* @param int $id | ||
* | ||
* @deprecated | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
* @return CRM_Core_DAO_Domain | ||
* @throws \CRM_Core_Exception | ||
*/ | ||
|
@@ -160,6 +161,7 @@ public static function edit($params, $id): CRM_Core_DAO_Domain { | |
/** | ||
* Create or update domain. | ||
* | ||
* @deprecated | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK - not called from api anyway |
||
* @param array $params | ||
* @return CRM_Core_DAO_Domain | ||
*/ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -144,6 +144,7 @@ public static function setStatus($status) { | |
/** | ||
* Create or update a RecurringEntity. | ||
* | ||
* @deprecated | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
* @param array $params | ||
* @return CRM_Core_DAO_RecurringEntity | ||
*/ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ class CRM_Core_BAO_Website extends CRM_Core_DAO_Website { | |
* | ||
* @param array $params | ||
* | ||
* @deprecated | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
* @return CRM_Core_DAO_Website | ||
* @throws \CRM_Core_Exception | ||
*/ | ||
|
@@ -36,8 +37,6 @@ public static function create($params) { | |
/** | ||
* Create website. | ||
* | ||
* If called in a legacy manner this, temporarily, fails back to calling the legacy function. | ||
* | ||
* @param array $params | ||
* | ||
* @return CRM_Core_DAO_Website | ||
|
@@ -46,7 +45,7 @@ public static function create($params) { | |
*/ | ||
public static function add($params) { | ||
CRM_Core_Error::deprecatedFunctionWarning('use apiv4'); | ||
return self::create($params); | ||
return self::writeRecord($params); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
|
||
/** | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1442,52 +1442,32 @@ public function &getGroupNames() { | |
* Add the mailings. | ||
* | ||
* @param array $params | ||
* Reference array contains the values submitted by the form. | ||
* @param array $ids | ||
* Reference array contains the id. | ||
* | ||
* | ||
* @return CRM_Mailing_DAO_Mailing | ||
* @throws \Civi\API\Exception\UnauthorizedException | ||
*/ | ||
public static function add(&$params, $ids = []) { | ||
$id = $params['id'] ?? $ids['mailing_id'] ?? NULL; | ||
public static function add($params) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok - ids was deprecated noisily in year zero (2020) |
||
$id = $params['id'] ?? NULL; | ||
|
||
if (empty($params['id']) && !empty($ids)) { | ||
CRM_Core_Error::deprecatedWarning('Parameter $ids is no longer used by Mailing::add. Use the api or just pass $params'); | ||
} | ||
if (!empty($params['check_permissions']) && CRM_Mailing_Info::workflowEnabled()) { | ||
$params = self::processWorkflowPermissions($params); | ||
} | ||
$action = $id ? 'create' : 'edit'; | ||
CRM_Utils_Hook::pre($action, 'Mailing', $id, $params); | ||
|
||
$mailing = new static(); | ||
if ($id) { | ||
$mailing->id = $id; | ||
$mailing->find(TRUE); | ||
if (!$id) { | ||
$params['domain_id'] = $params['domain_id'] ?? CRM_Core_Config::domainID(); | ||
} | ||
$mailing->domain_id = CRM_Utils_Array::value('domain_id', $params, CRM_Core_Config::domainID()); | ||
|
||
if (((!$id && empty($params['replyto_email'])) || !isset($params['replyto_email'])) && | ||
if ( | ||
((!$id && empty($params['replyto_email'])) || !isset($params['replyto_email'])) && | ||
isset($params['from_email']) | ||
) { | ||
$params['replyto_email'] = $params['from_email']; | ||
} | ||
$mailing->copyValues($params); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK - changes to this function make sense |
||
|
||
// CRM-20892 Unset Modifed Date here so that MySQL can correctly set an updated modfied date. | ||
unset($mailing->modified_date); | ||
$result = $mailing->save(); | ||
unset($params['modified_date']); | ||
|
||
// CRM-20892 Re find record after saing so we can set the updated modified date in the result. | ||
$mailing->find(TRUE); | ||
$result = static::writeRecord($params); | ||
|
||
if (isset($mailing->modified_date)) { | ||
$result->modified_date = $mailing->modified_date; | ||
} | ||
|
||
CRM_Utils_Hook::post($action, 'Mailing', $mailing->id, $mailing); | ||
// CRM-20892 Re find record after saing so we can set the updated modified date in the result. | ||
$result->find(TRUE); | ||
|
||
return $result; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ class CRM_Member_BAO_MembershipBlock extends CRM_Member_DAO_MembershipBlock { | |
/** | ||
* Create or update a MembershipBlock. | ||
* | ||
* @deprecated | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
* @param array $params | ||
* @return CRM_Member_DAO_MembershipBlock | ||
*/ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,8 +38,8 @@ public static function retrieve($params, &$defaults) { | |
* | ||
* @param array $params | ||
* (reference ) an assoc array of name/value pairs. | ||
* | ||
* @return CRM_Pledge_BAO_PledgeBlock | ||
* @deprecated | ||
* @return CRM_Pledge_DAO_PledgeBlock | ||
*/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
public static function &create(&$params) { | ||
$transaction = new CRM_Core_Transaction(); | ||
|
@@ -61,8 +61,8 @@ public static function &create(&$params) { | |
* Add or update pledgeBlock. | ||
* | ||
* @param array $params | ||
* | ||
* @return object | ||
* @deprecated | ||
* @return CRM_Pledge_DAO_PledgeBlock | ||
*/ | ||
public static function add($params) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
// FIXME: This is assuming checkbox input like ['foo' => 1, 'bar' => 0, 'baz' => 1]. Not API friendly. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK - already calls
writeRecord