Merge pull request #8861 from danbrellis/patch-1
[civicrm-core.git] / CRM / Core / DAO / ActionLog.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2016 |
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-2016
30 *
31 * Generated from xml/schema/CRM/Core/ActionLog.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:721c03b2046e11d8774a5e14204a28d8)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Core_DAO_ActionLog extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_action_log';
44 /**
45 * static value to see if we should log any modifications to
46 * this table in the civicrm_log table
47 *
48 * @var boolean
49 */
50 static $_log = false;
51 /**
52 *
53 * @var int unsigned
54 */
55 public $id;
56 /**
57 * FK to Contact ID
58 *
59 * @var int unsigned
60 */
61 public $contact_id;
62 /**
63 * FK to id of the entity that the action was performed on. Pseudo - FK.
64 *
65 * @var int unsigned
66 */
67 public $entity_id;
68 /**
69 * name of the entity table for the above id, e.g. civicrm_activity, civicrm_participant
70 *
71 * @var string
72 */
73 public $entity_table;
74 /**
75 * FK to the action schedule that this action originated from.
76 *
77 * @var int unsigned
78 */
79 public $action_schedule_id;
80 /**
81 * date time that the action was performed on.
82 *
83 * @var datetime
84 */
85 public $action_date_time;
86 /**
87 * Was there any error sending the reminder?
88 *
89 * @var boolean
90 */
91 public $is_error;
92 /**
93 * Description / text in case there was an error encountered.
94 *
95 * @var text
96 */
97 public $message;
98 /**
99 * Keeps track of the sequence number of this repetition.
100 *
101 * @var int unsigned
102 */
103 public $repetition_number;
104 /**
105 * Stores the date from the entity which triggered this reminder action (e.g. membership.end_date for most membership renewal reminders)
106 *
107 * @var date
108 */
109 public $reference_date;
110 /**
111 * class constructor
112 *
113 * @return civicrm_action_log
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 ) ,
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 );
211 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
212 }
213 return Civi::$statics[__CLASS__]['fields'];
214 }
215 /**
216 * Return a mapping from field-name to the corresponding key (as used in fields()).
217 *
218 * @return array
219 * Array(string $name => string $uniqueName).
220 */
221 static function &fieldKeys() {
222 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
223 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
224 }
225 return Civi::$statics[__CLASS__]['fieldKeys'];
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) {
251 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'action_log', $prefix, array());
252 return $r;
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) {
262 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'action_log', $prefix, array());
263 return $r;
264 }
265 }