Merge pull request #8916 from cividesk/CRM-19256-4.7
[civicrm-core.git] / CRM / Core / DAO / ActionLog.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
0f03f337 6| Copyright CiviCRM LLC (c) 2004-2017 |
e501603b
TO
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
0f03f337 29 * @copyright CiviCRM LLC (c) 2004-2017
e501603b
TO
30 *
31 * Generated from xml/schema/CRM/Core/ActionLog.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
437fafcf 33 * (GenCodeChecksum:721c03b2046e11d8774a5e14204a28d8)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
f41f0342 37/**
38 * CRM_Core_DAO_ActionLog constructor.
39 */
e501603b
TO
40class CRM_Core_DAO_ActionLog extends CRM_Core_DAO {
41 /**
f41f0342 42 * Static instance to hold the table name.
e501603b
TO
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_action_log';
e501603b 47 /**
f41f0342 48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b
TO
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 /**
f41f0342 113 * Class constructor.
e501603b
TO
114 */
115 function __construct() {
116 $this->__table = 'civicrm_action_log';
117 parent::__construct();
118 }
119 /**
f41f0342 120 * Returns foreign keys and entity references.
e501603b
TO
121 *
122 * @return array
123 * [CRM_Core_Reference_Interface]
124 */
125 static function getReferenceColumns() {
346aaaba
TO
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']);
e501603b 132 }
346aaaba 133 return Civi::$statics[__CLASS__]['links'];
e501603b
TO
134 }
135 /**
136 * Returns all the column names of this table
137 *
138 * @return array
139 */
140 static function &fields() {
346aaaba
TO
141 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
142 Civi::$statics[__CLASS__]['fields'] = array(
e501603b
TO
143 'id' => array(
144 'name' => 'id',
145 'type' => CRM_Utils_Type::T_INT,
146 'title' => ts('Action Schedule ID') ,
147 'required' => true,
148 ) ,
149 'contact_id' => array(
150 'name' => 'contact_id',
151 'type' => CRM_Utils_Type::T_INT,
152 'title' => ts('Action Schedule Contact ID') ,
153 'description' => 'FK to Contact ID',
154 'FKClassName' => 'CRM_Contact_DAO_Contact',
155 ) ,
156 'entity_id' => array(
157 'name' => 'entity_id',
158 'type' => CRM_Utils_Type::T_INT,
159 'title' => ts('Entity ID') ,
160 'description' => 'FK to id of the entity that the action was performed on. Pseudo - FK.',
161 'required' => true,
162 ) ,
163 'entity_table' => array(
164 'name' => 'entity_table',
165 'type' => CRM_Utils_Type::T_STRING,
166 'title' => ts('Entity Table') ,
167 'description' => 'name of the entity table for the above id, e.g. civicrm_activity, civicrm_participant',
168 'maxlength' => 255,
169 'size' => CRM_Utils_Type::HUGE,
170 ) ,
171 'action_schedule_id' => array(
172 'name' => 'action_schedule_id',
173 'type' => CRM_Utils_Type::T_INT,
174 'title' => ts('Schedule') ,
175 'description' => 'FK to the action schedule that this action originated from.',
176 'required' => true,
177 'FKClassName' => 'CRM_Core_DAO_ActionSchedule',
178 ) ,
179 'action_date_time' => array(
180 'name' => 'action_date_time',
181 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
182 'title' => ts('Action Date And Time') ,
183 'description' => 'date time that the action was performed on.',
184 ) ,
185 'is_error' => array(
186 'name' => 'is_error',
187 'type' => CRM_Utils_Type::T_BOOLEAN,
188 'title' => ts('Error?') ,
189 'description' => 'Was there any error sending the reminder?',
190 ) ,
191 'message' => array(
192 'name' => 'message',
193 'type' => CRM_Utils_Type::T_TEXT,
194 'title' => ts('Message') ,
195 'description' => 'Description / text in case there was an error encountered.',
196 ) ,
197 'repetition_number' => array(
198 'name' => 'repetition_number',
199 'type' => CRM_Utils_Type::T_INT,
200 'title' => ts('Repetition Number') ,
201 'description' => 'Keeps track of the sequence number of this repetition.',
202 ) ,
203 'reference_date' => array(
204 'name' => 'reference_date',
205 'type' => CRM_Utils_Type::T_DATE,
206 'title' => ts('Reference Date') ,
207 'description' => 'Stores the date from the entity which triggered this reminder action (e.g. membership.end_date for most membership renewal reminders)',
208 'default' => 'NULL',
209 ) ,
210 );
346aaaba 211 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 212 }
346aaaba 213 return Civi::$statics[__CLASS__]['fields'];
e501603b
TO
214 }
215 /**
bd8e0b14 216 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
217 *
218 * @return array
bd8e0b14 219 * Array(string $name => string $uniqueName).
e501603b
TO
220 */
221 static function &fieldKeys() {
bd8e0b14
TO
222 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
223 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 224 }
bd8e0b14 225 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
226 }
227 /**
228 * Returns the names of this table
229 *
230 * @return string
231 */
232 static function getTableName() {
233 return self::$_tableName;
234 }
235 /**
236 * Returns if this table needs to be logged
237 *
238 * @return boolean
239 */
240 function getLog() {
241 return self::$_log;
242 }
243 /**
244 * Returns the list of fields that can be imported
245 *
246 * @param bool $prefix
247 *
248 * @return array
249 */
250 static function &import($prefix = false) {
60808919
TO
251 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'action_log', $prefix, array());
252 return $r;
e501603b
TO
253 }
254 /**
255 * Returns the list of fields that can be exported
256 *
257 * @param bool $prefix
258 *
259 * @return array
260 */
261 static function &export($prefix = false) {
60808919
TO
262 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'action_log', $prefix, array());
263 return $r;
e501603b
TO
264 }
265}