Merge pull request #9724 from civicrm/michaelmcandrew-CRM-19921
[civicrm-core.git] / CRM / Core / DAO / ActionLog.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
26 */
27 /**
28 * @package CRM
29 * @copyright CiviCRM LLC (c) 2004-2017
30 *
31 * Generated from xml/schema/CRM/Core/ActionLog.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:4ef96df03630ecc884c881b79a40818f)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 /**
38 * CRM_Core_DAO_ActionLog constructor.
39 */
40 class CRM_Core_DAO_ActionLog extends CRM_Core_DAO {
41 /**
42 * Static instance to hold the table name.
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_action_log';
47 /**
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
49 *
50 * @var boolean
51 */
52 static $_log = false;
53 /**
54 *
55 * @var int unsigned
56 */
57 public $id;
58 /**
59 * FK to Contact ID
60 *
61 * @var int unsigned
62 */
63 public $contact_id;
64 /**
65 * FK to id of the entity that the action was performed on. Pseudo - FK.
66 *
67 * @var int unsigned
68 */
69 public $entity_id;
70 /**
71 * name of the entity table for the above id, e.g. civicrm_activity, civicrm_participant
72 *
73 * @var string
74 */
75 public $entity_table;
76 /**
77 * FK to the action schedule that this action originated from.
78 *
79 * @var int unsigned
80 */
81 public $action_schedule_id;
82 /**
83 * date time that the action was performed on.
84 *
85 * @var datetime
86 */
87 public $action_date_time;
88 /**
89 * Was there any error sending the reminder?
90 *
91 * @var boolean
92 */
93 public $is_error;
94 /**
95 * Description / text in case there was an error encountered.
96 *
97 * @var text
98 */
99 public $message;
100 /**
101 * Keeps track of the sequence number of this repetition.
102 *
103 * @var int unsigned
104 */
105 public $repetition_number;
106 /**
107 * Stores the date from the entity which triggered this reminder action (e.g. membership.end_date for most membership renewal reminders)
108 *
109 * @var date
110 */
111 public $reference_date;
112 /**
113 * Class constructor.
114 */
115 function __construct() {
116 $this->__table = 'civicrm_action_log';
117 parent::__construct();
118 }
119 /**
120 * Returns foreign keys and entity references.
121 *
122 * @return array
123 * [CRM_Core_Reference_Interface]
124 */
125 static function getReferenceColumns() {
126 if (!isset(Civi::$statics[__CLASS__]['links'])) {
127 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
128 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id');
129 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'action_schedule_id', 'civicrm_action_schedule', 'id');
130 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table');
131 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
132 }
133 return Civi::$statics[__CLASS__]['links'];
134 }
135 /**
136 * Returns all the column names of this table
137 *
138 * @return array
139 */
140 static function &fields() {
141 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
142 Civi::$statics[__CLASS__]['fields'] = array(
143 'id' => array(
144 'name' => 'id',
145 'type' => CRM_Utils_Type::T_INT,
146 'title' => ts('Action Schedule ID') ,
147 'required' => true,
148 'table_name' => 'civicrm_action_log',
149 'entity' => 'ActionLog',
150 'bao' => 'CRM_Core_BAO_ActionLog',
151 ) ,
152 'contact_id' => array(
153 'name' => 'contact_id',
154 'type' => CRM_Utils_Type::T_INT,
155 'title' => ts('Action Schedule Contact ID') ,
156 'description' => 'FK to Contact ID',
157 'table_name' => 'civicrm_action_log',
158 'entity' => 'ActionLog',
159 'bao' => 'CRM_Core_BAO_ActionLog',
160 'FKClassName' => 'CRM_Contact_DAO_Contact',
161 ) ,
162 'entity_id' => array(
163 'name' => 'entity_id',
164 'type' => CRM_Utils_Type::T_INT,
165 'title' => ts('Entity ID') ,
166 'description' => 'FK to id of the entity that the action was performed on. Pseudo - FK.',
167 'required' => true,
168 'table_name' => 'civicrm_action_log',
169 'entity' => 'ActionLog',
170 'bao' => 'CRM_Core_BAO_ActionLog',
171 ) ,
172 'entity_table' => array(
173 'name' => 'entity_table',
174 'type' => CRM_Utils_Type::T_STRING,
175 'title' => ts('Entity Table') ,
176 'description' => 'name of the entity table for the above id, e.g. civicrm_activity, civicrm_participant',
177 'maxlength' => 255,
178 'size' => CRM_Utils_Type::HUGE,
179 'table_name' => 'civicrm_action_log',
180 'entity' => 'ActionLog',
181 'bao' => 'CRM_Core_BAO_ActionLog',
182 ) ,
183 'action_schedule_id' => array(
184 'name' => 'action_schedule_id',
185 'type' => CRM_Utils_Type::T_INT,
186 'title' => ts('Schedule') ,
187 'description' => 'FK to the action schedule that this action originated from.',
188 'required' => true,
189 'table_name' => 'civicrm_action_log',
190 'entity' => 'ActionLog',
191 'bao' => 'CRM_Core_BAO_ActionLog',
192 'FKClassName' => 'CRM_Core_DAO_ActionSchedule',
193 ) ,
194 'action_date_time' => array(
195 'name' => 'action_date_time',
196 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
197 'title' => ts('Action Date And Time') ,
198 'description' => 'date time that the action was performed on.',
199 'table_name' => 'civicrm_action_log',
200 'entity' => 'ActionLog',
201 'bao' => 'CRM_Core_BAO_ActionLog',
202 ) ,
203 'is_error' => array(
204 'name' => 'is_error',
205 'type' => CRM_Utils_Type::T_BOOLEAN,
206 'title' => ts('Error?') ,
207 'description' => 'Was there any error sending the reminder?',
208 'table_name' => 'civicrm_action_log',
209 'entity' => 'ActionLog',
210 'bao' => 'CRM_Core_BAO_ActionLog',
211 ) ,
212 'message' => array(
213 'name' => 'message',
214 'type' => CRM_Utils_Type::T_TEXT,
215 'title' => ts('Message') ,
216 'description' => 'Description / text in case there was an error encountered.',
217 'table_name' => 'civicrm_action_log',
218 'entity' => 'ActionLog',
219 'bao' => 'CRM_Core_BAO_ActionLog',
220 ) ,
221 'repetition_number' => array(
222 'name' => 'repetition_number',
223 'type' => CRM_Utils_Type::T_INT,
224 'title' => ts('Repetition Number') ,
225 'description' => 'Keeps track of the sequence number of this repetition.',
226 'table_name' => 'civicrm_action_log',
227 'entity' => 'ActionLog',
228 'bao' => 'CRM_Core_BAO_ActionLog',
229 ) ,
230 'reference_date' => array(
231 'name' => 'reference_date',
232 'type' => CRM_Utils_Type::T_DATE,
233 'title' => ts('Reference Date') ,
234 'description' => 'Stores the date from the entity which triggered this reminder action (e.g. membership.end_date for most membership renewal reminders)',
235 'default' => 'NULL',
236 'table_name' => 'civicrm_action_log',
237 'entity' => 'ActionLog',
238 'bao' => 'CRM_Core_BAO_ActionLog',
239 ) ,
240 );
241 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
242 }
243 return Civi::$statics[__CLASS__]['fields'];
244 }
245 /**
246 * Return a mapping from field-name to the corresponding key (as used in fields()).
247 *
248 * @return array
249 * Array(string $name => string $uniqueName).
250 */
251 static function &fieldKeys() {
252 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
253 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
254 }
255 return Civi::$statics[__CLASS__]['fieldKeys'];
256 }
257 /**
258 * Returns the names of this table
259 *
260 * @return string
261 */
262 static function getTableName() {
263 return self::$_tableName;
264 }
265 /**
266 * Returns if this table needs to be logged
267 *
268 * @return boolean
269 */
270 function getLog() {
271 return self::$_log;
272 }
273 /**
274 * Returns the list of fields that can be imported
275 *
276 * @param bool $prefix
277 *
278 * @return array
279 */
280 static function &import($prefix = false) {
281 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'action_log', $prefix, array());
282 return $r;
283 }
284 /**
285 * Returns the list of fields that can be exported
286 *
287 * @param bool $prefix
288 *
289 * @return array
290 */
291 static function &export($prefix = false) {
292 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'action_log', $prefix, array());
293 return $r;
294 }
295 }