Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
bc77d7c0 | 4 | | Copyright CiviCRM LLC. All rights reserved. | |
6a488035 | 5 | | | |
bc77d7c0 TO |
6 | | This work is published under the GNU AGPLv3 license with some | |
7 | | permitted exceptions and without any warranty. For full license | | |
8 | | and copyright information, see https://civicrm.org/licensing | | |
6a488035 | 9 | +--------------------------------------------------------------------+ |
d25dd0ee | 10 | */ |
6a488035 TO |
11 | |
12 | /** | |
13 | * | |
14 | * @package CRM | |
ca5cec67 | 15 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
6a488035 TO |
16 | */ |
17 | class CRM_Member_BAO_MembershipLog extends CRM_Member_DAO_MembershipLog { | |
18 | ||
19 | /** | |
fe482240 | 20 | * Add the membership log record. |
6a488035 | 21 | * |
b2363ea8 | 22 | * @param array $params |
dfc9c0c7 | 23 | * Properties of the log item. |
6a488035 | 24 | * |
dfc9c0c7 | 25 | * @return CRM_Member_DAO_MembershipLog|CRM_Core_Error |
6a488035 | 26 | */ |
dfc9c0c7 | 27 | public static function add($params) { |
6a488035 TO |
28 | $membershipLog = new CRM_Member_DAO_MembershipLog(); |
29 | $membershipLog->copyValues($params); | |
6a488035 | 30 | $membershipLog->save(); |
6a488035 TO |
31 | |
32 | return $membershipLog; | |
33 | } | |
34 | ||
35 | /** | |
fe482240 | 36 | * Delete membership log record. |
6a488035 | 37 | * |
c490a46a | 38 | * @param int $membershipID |
77b97be7 EM |
39 | * |
40 | * @return mixed | |
6a488035 | 41 | */ |
00be9182 | 42 | public static function del($membershipID) { |
6a488035 TO |
43 | $membershipLog = new CRM_Member_DAO_MembershipLog(); |
44 | $membershipLog->membership_id = $membershipID; | |
45 | return $membershipLog->delete(); | |
46 | } | |
47 | ||
bb3a214a | 48 | /** |
dfc9c0c7 EM |
49 | * Reset the modified ID to NULL for log items by the given contact ID. |
50 | * | |
100fef9d | 51 | * @param int $contactID |
bb3a214a | 52 | */ |
00be9182 | 53 | public static function resetModifiedID($contactID) { |
6a488035 TO |
54 | $query = " |
55 | UPDATE civicrm_membership_log | |
56 | SET modified_id = null | |
57 | WHERE modified_id = %1"; | |
58 | ||
be2fb01f | 59 | $params = [1 => [$contactID, 'Integer']]; |
6a488035 TO |
60 | CRM_Core_DAO::executeQuery($query, $params); |
61 | } | |
96025800 | 62 | |
6a488035 | 63 | } |