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 | ||
18 | /** | |
c037736a | 19 | * BAO object for crm_email table. |
6a488035 TO |
20 | */ |
21 | class CRM_Contact_BAO_SubscriptionHistory extends CRM_Contact_DAO_SubscriptionHistory { | |
69078420 | 22 | |
86538308 | 23 | /** |
fe482240 | 24 | * Class constructor. |
86538308 | 25 | */ |
00be9182 | 26 | public function __construct() { |
6a488035 TO |
27 | parent::__construct(); |
28 | } | |
29 | ||
30 | /** | |
fe482240 | 31 | * Create a new subscription history record. |
6a488035 | 32 | * |
77c5b619 TO |
33 | * @param array $params |
34 | * Values for the new history record. | |
6a488035 | 35 | * |
a6c01b45 CW |
36 | * @return object |
37 | * $history The new history object | |
6a488035 TO |
38 | */ |
39 | public static function &create(&$params) { | |
40 | $history = new CRM_Contact_BAO_SubscriptionHistory(); | |
41 | $history->date = date('Ymd'); | |
42 | $history->copyValues($params); | |
43 | $history->save(); | |
44 | return $history; | |
45 | } | |
46 | ||
47 | /** | |
c037736a | 48 | * Erase a contact's subscription history records. |
6a488035 | 49 | * |
77c5b619 TO |
50 | * @param int $id |
51 | * The contact id. | |
6a488035 TO |
52 | */ |
53 | public static function deleteContact($id) { | |
54 | $history = new CRM_Contact_BAO_SubscriptionHistory(); | |
55 | $history->contact_id = $id; | |
56 | $history->delete(); | |
57 | } | |
96025800 | 58 | |
6a488035 | 59 | } |