Skip to content

Commit

Permalink
BASW-123: Prevent cancelling membership when cancelling linked offlin…
Browse files Browse the repository at this point in the history
…e installment contribution

Included in CiviCRM-Core
PR: civicrm#12253

(cherry picked from commit 07cd5b4)
  • Loading branch information
omarabuhussein authored and erawat committed Sep 14, 2021
1 parent 79335e5 commit a393093
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CRM/Core/DAO.php
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,10 @@ public function table() {
*/
public function save($hook = TRUE) {
$eventID = uniqid();
if ($hook) {
CRM_Utils_Hook::preSave($this);
}

if (!empty($this->id)) {
if ($hook) {
$preEvent = new \Civi\Core\DAO\Event\PreUpdate($this);
Expand Down
13 changes: 13 additions & 0 deletions CRM/Utils/Hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -1575,6 +1575,19 @@ public static function alterAPIPermissions($entity, $action, &$params, &$permiss
);
}

/**
* @param CRM_Core_DAO $dao
*
* @return mixed
*/
public static function preSave(&$dao) {
$hookName = 'civicrm_preSave_' . $dao->getTableName();
return self::singleton()->invoke(array('dao'), $dao,
self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
$hookName
);
}

/**
* @param CRM_Core_DAO $dao
*
Expand Down

0 comments on commit a393093

Please sign in to comment.