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
  • Loading branch information
omarabuhussein authored and davialexandre committed Aug 25, 2020
1 parent de36080 commit 07cd5b4
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 @@ -597,6 +597,10 @@ public function table() {
* @return CRM_Core_DAO
*/
public function save($hook = TRUE) {
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 @@ -1524,6 +1524,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 07cd5b4

Please sign in to comment.