Merge pull request #10118 from civicrm/4.7.18-rc
[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 'localizable' => 0,
152 ) ,
153 'contact_id' => array(
154 'name' => 'contact_id',
155 'type' => CRM_Utils_Type::T_INT,
156 'title' => ts('Action Schedule Contact ID') ,
157 'description' => 'FK to Contact ID',
158 'table_name' => 'civicrm_action_log',
159 'entity' => 'ActionLog',
160 'bao' => 'CRM_Core_BAO_ActionLog',
161 'localizable' => 0,
162 'FKClassName' => 'CRM_Contact_DAO_Contact',
163 ) ,
164 'entity_id' => array(
165 'name' => 'entity_id',
166 'type' => CRM_Utils_Type::T_INT,
167 'title' => ts('Entity ID') ,
168 'description' => 'FK to id of the entity that the action was performed on. Pseudo - FK.',
169 'required' => true,
170 'table_name' => 'civicrm_action_log',
171 'entity' => 'ActionLog',
172 'bao' => 'CRM_Core_BAO_ActionLog',
173 'localizable' => 0,
174 ) ,
175 'entity_table' => array(
176 'name' => 'entity_table',
177 'type' => CRM_Utils_Type::T_STRING,
178 'title' => ts('Entity Table') ,
179 'description' => 'name of the entity table for the above id, e.g. civicrm_activity, civicrm_participant',
180 'maxlength' => 255,
181 'size' => CRM_Utils_Type::HUGE,
182 'table_name' => 'civicrm_action_log',
183 'entity' => 'ActionLog',
184 'bao' => 'CRM_Core_BAO_ActionLog',
185 'localizable' => 0,
186 ) ,
187 'action_schedule_id' => array(
188 'name' => 'action_schedule_id',
189 'type' => CRM_Utils_Type::T_INT,
190 'title' => ts('Schedule') ,
191 'description' => 'FK to the action schedule that this action originated from.',
192 'required' => true,
193 'table_name' => 'civicrm_action_log',
194 'entity' => 'ActionLog',
195 'bao' => 'CRM_Core_BAO_ActionLog',
196 'localizable' => 0,
197 'FKClassName' => 'CRM_Core_DAO_ActionSchedule',
198 ) ,
199 'action_date_time' => array(
200 'name' => 'action_date_time',
201 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
202 'title' => ts('Action Date And Time') ,
203 'description' => 'date time that the action was performed on.',
204 'table_name' => 'civicrm_action_log',
205 'entity' => 'ActionLog',
206 'bao' => 'CRM_Core_BAO_ActionLog',
207 'localizable' => 0,
208 ) ,
209 'is_error' => array(
210 'name' => 'is_error',
211 'type' => CRM_Utils_Type::T_BOOLEAN,
212 'title' => ts('Error?') ,
213 'description' => 'Was there any error sending the reminder?',
214 'table_name' => 'civicrm_action_log',
215 'entity' => 'ActionLog',
216 'bao' => 'CRM_Core_BAO_ActionLog',
217 'localizable' => 0,
218 ) ,
219 'message' => array(
220 'name' => 'message',
221 'type' => CRM_Utils_Type::T_TEXT,
222 'title' => ts('Message') ,
223 'description' => 'Description / text in case there was an error encountered.',
224 'table_name' => 'civicrm_action_log',
225 'entity' => 'ActionLog',
226 'bao' => 'CRM_Core_BAO_ActionLog',
227 'localizable' => 0,
228 ) ,
229 'repetition_number' => array(
230 'name' => 'repetition_number',
231 'type' => CRM_Utils_Type::T_INT,
232 'title' => ts('Repetition Number') ,
233 'description' => 'Keeps track of the sequence number of this repetition.',
234 'table_name' => 'civicrm_action_log',
235 'entity' => 'ActionLog',
236 'bao' => 'CRM_Core_BAO_ActionLog',
237 'localizable' => 0,
238 ) ,
239 'reference_date' => array(
240 'name' => 'reference_date',
241 'type' => CRM_Utils_Type::T_DATE,
242 'title' => ts('Reference Date') ,
243 'description' => 'Stores the date from the entity which triggered this reminder action (e.g. membership.end_date for most membership renewal reminders)',
244 'default' => 'NULL',
245 'table_name' => 'civicrm_action_log',
246 'entity' => 'ActionLog',
247 'bao' => 'CRM_Core_BAO_ActionLog',
248 'localizable' => 0,
249 ) ,
250 );
251 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
252 }
253 return Civi::$statics[__CLASS__]['fields'];
254 }
255 /**
256 * Return a mapping from field-name to the corresponding key (as used in fields()).
257 *
258 * @return array
259 * Array(string $name => string $uniqueName).
260 */
261 static function &fieldKeys() {
262 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
263 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
264 }
265 return Civi::$statics[__CLASS__]['fieldKeys'];
266 }
267 /**
268 * Returns the names of this table
269 *
270 * @return string
271 */
272 static function getTableName() {
273 return self::$_tableName;
274 }
275 /**
276 * Returns if this table needs to be logged
277 *
278 * @return boolean
279 */
280 function getLog() {
281 return self::$_log;
282 }
283 /**
284 * Returns the list of fields that can be imported
285 *
286 * @param bool $prefix
287 *
288 * @return array
289 */
290 static function &import($prefix = false) {
291 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'action_log', $prefix, array());
292 return $r;
293 }
294 /**
295 * Returns the list of fields that can be exported
296 *
297 * @param bool $prefix
298 *
299 * @return array
300 */
301 static function &export($prefix = false) {
302 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'action_log', $prefix, array());
303 return $r;
304 }
305 /**
306 * Returns the list of indices
307 */
308 public static function indices($localize = TRUE) {
309 $indices = array();
310 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
311 }
312 }