Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
ca5cec67 | 5 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Campaign/Campaign.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
5c385299 | 9 | * (GenCodeChecksum:1356a7073a6caa15e0da58422c6763b9) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the Campaign entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Campaign_DAO_Campaign extends CRM_Core_DAO { |
929a1c14 CW |
16 | const EXT = 'civicrm'; |
17 | const TABLE_ADDED = '3.3'; | |
c3fc2621 | 18 | |
e501603b | 19 | /** |
f41f0342 | 20 | * Static instance to hold the table name. |
e501603b TO |
21 | * |
22 | * @var string | |
23 | */ | |
fa45b5b9 | 24 | public static $_tableName = 'civicrm_campaign'; |
c3fc2621 | 25 | |
449c4e6b CW |
26 | /** |
27 | * Icon associated with this entity. | |
28 | * | |
29 | * @var string | |
30 | */ | |
31 | public static $_icon = 'fa-bullhorn'; | |
32 | ||
e501603b | 33 | /** |
f41f0342 | 34 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 35 | * |
c3fc2621 | 36 | * @var bool |
e501603b | 37 | */ |
fa45b5b9 | 38 | public static $_log = FALSE; |
c3fc2621 | 39 | |
5c385299 CW |
40 | /** |
41 | * Paths for accessing this entity in the UI. | |
42 | * | |
43 | * @var string[] | |
44 | */ | |
45 | protected static $_paths = [ | |
46 | 'add' => 'civicrm/campaign/add?reset=1', | |
47 | 'update' => 'civicrm/campaign/add?reset=1&action=update&id=[id]', | |
48 | 'delete' => 'civicrm/campaign/add?reset=1&action=delete&id=[id]', | |
49 | ]; | |
50 | ||
e501603b TO |
51 | /** |
52 | * Unique Campaign ID. | |
53 | * | |
e6ca0a57 | 54 | * @var int |
e501603b TO |
55 | */ |
56 | public $id; | |
c3fc2621 | 57 | |
e501603b TO |
58 | /** |
59 | * Name of the Campaign. | |
60 | * | |
61 | * @var string | |
62 | */ | |
63 | public $name; | |
c3fc2621 | 64 | |
e501603b TO |
65 | /** |
66 | * Title of the Campaign. | |
67 | * | |
68 | * @var string | |
69 | */ | |
70 | public $title; | |
c3fc2621 | 71 | |
e501603b TO |
72 | /** |
73 | * Full description of Campaign. | |
74 | * | |
75 | * @var text | |
76 | */ | |
77 | public $description; | |
c3fc2621 | 78 | |
e501603b TO |
79 | /** |
80 | * Date and time that Campaign starts. | |
81 | * | |
82 | * @var datetime | |
83 | */ | |
84 | public $start_date; | |
c3fc2621 | 85 | |
e501603b TO |
86 | /** |
87 | * Date and time that Campaign ends. | |
88 | * | |
89 | * @var datetime | |
90 | */ | |
91 | public $end_date; | |
c3fc2621 | 92 | |
e501603b TO |
93 | /** |
94 | * Campaign Type ID.Implicit FK to civicrm_option_value where option_group = campaign_type | |
95 | * | |
e6ca0a57 | 96 | * @var int |
e501603b TO |
97 | */ |
98 | public $campaign_type_id; | |
c3fc2621 | 99 | |
e501603b TO |
100 | /** |
101 | * Campaign status ID.Implicit FK to civicrm_option_value where option_group = campaign_status | |
102 | * | |
e6ca0a57 | 103 | * @var int |
e501603b TO |
104 | */ |
105 | public $status_id; | |
c3fc2621 | 106 | |
e501603b TO |
107 | /** |
108 | * Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations. | |
109 | * | |
110 | * @var string | |
111 | */ | |
112 | public $external_identifier; | |
c3fc2621 | 113 | |
e501603b TO |
114 | /** |
115 | * Optional parent id for this Campaign. | |
116 | * | |
e6ca0a57 | 117 | * @var int |
e501603b TO |
118 | */ |
119 | public $parent_id; | |
c3fc2621 | 120 | |
e501603b TO |
121 | /** |
122 | * Is this Campaign enabled or disabled/cancelled? | |
123 | * | |
e6ca0a57 | 124 | * @var bool |
e501603b TO |
125 | */ |
126 | public $is_active; | |
c3fc2621 | 127 | |
e501603b TO |
128 | /** |
129 | * FK to civicrm_contact, who created this Campaign. | |
130 | * | |
e6ca0a57 | 131 | * @var int |
e501603b TO |
132 | */ |
133 | public $created_id; | |
c3fc2621 | 134 | |
e501603b TO |
135 | /** |
136 | * Date and time that Campaign was created. | |
137 | * | |
138 | * @var datetime | |
139 | */ | |
140 | public $created_date; | |
c3fc2621 | 141 | |
e501603b TO |
142 | /** |
143 | * FK to civicrm_contact, who recently edited this Campaign. | |
144 | * | |
e6ca0a57 | 145 | * @var int |
e501603b TO |
146 | */ |
147 | public $last_modified_id; | |
c3fc2621 | 148 | |
e501603b TO |
149 | /** |
150 | * Date and time that Campaign was edited last time. | |
151 | * | |
152 | * @var datetime | |
153 | */ | |
154 | public $last_modified_date; | |
c3fc2621 | 155 | |
e501603b TO |
156 | /** |
157 | * General goals for Campaign. | |
158 | * | |
159 | * @var text | |
160 | */ | |
161 | public $goal_general; | |
c3fc2621 | 162 | |
e501603b TO |
163 | /** |
164 | * The target revenue for this campaign. | |
165 | * | |
166 | * @var float | |
167 | */ | |
168 | public $goal_revenue; | |
c3fc2621 | 169 | |
e501603b | 170 | /** |
f41f0342 | 171 | * Class constructor. |
e501603b | 172 | */ |
c3fc2621 | 173 | public function __construct() { |
e501603b TO |
174 | $this->__table = 'civicrm_campaign'; |
175 | parent::__construct(); | |
176 | } | |
c3fc2621 | 177 | |
449c4e6b CW |
178 | /** |
179 | * Returns localized title of this entity. | |
7b66c3b5 AH |
180 | * |
181 | * @param bool $plural | |
182 | * Whether to return the plural version of the title. | |
449c4e6b | 183 | */ |
7b66c3b5 AH |
184 | public static function getEntityTitle($plural = FALSE) { |
185 | return $plural ? ts('Campaigns') : ts('Campaign'); | |
449c4e6b CW |
186 | } |
187 | ||
e501603b | 188 | /** |
f41f0342 | 189 | * Returns foreign keys and entity references. |
e501603b TO |
190 | * |
191 | * @return array | |
192 | * [CRM_Core_Reference_Interface] | |
193 | */ | |
c3fc2621 | 194 | public static function getReferenceColumns() { |
346aaaba | 195 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 196 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 CW |
197 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'parent_id', 'civicrm_campaign', 'id'); |
198 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id'); | |
199 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'last_modified_id', 'civicrm_contact', 'id'); | |
346aaaba | 200 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 201 | } |
346aaaba | 202 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 203 | } |
c3fc2621 | 204 | |
e501603b TO |
205 | /** |
206 | * Returns all the column names of this table | |
207 | * | |
208 | * @return array | |
209 | */ | |
c3fc2621 | 210 | public static function &fields() { |
346aaaba | 211 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
212 | Civi::$statics[__CLASS__]['fields'] = [ |
213 | 'id' => [ | |
e501603b TO |
214 | 'name' => 'id', |
215 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 216 | 'title' => ts('Campaign ID'), |
215b423e | 217 | 'description' => ts('Unique Campaign ID.'), |
c3fc2621 CW |
218 | 'required' => TRUE, |
219 | 'import' => TRUE, | |
e501603b | 220 | 'where' => 'civicrm_campaign.id', |
c3fc2621 | 221 | 'export' => TRUE, |
522a26c9 | 222 | 'table_name' => 'civicrm_campaign', |
223 | 'entity' => 'Campaign', | |
224 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 225 | 'localizable' => 0, |
a9d0587b | 226 | 'add' => '3.3', |
c3fc2621 CW |
227 | ], |
228 | 'name' => [ | |
e501603b TO |
229 | 'name' => 'name', |
230 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 231 | 'title' => ts('Campaign Name'), |
215b423e | 232 | 'description' => ts('Name of the Campaign.'), |
c3fc2621 | 233 | 'required' => TRUE, |
e501603b TO |
234 | 'maxlength' => 255, |
235 | 'size' => CRM_Utils_Type::HUGE, | |
c3fc2621 | 236 | 'import' => TRUE, |
e501603b | 237 | 'where' => 'civicrm_campaign.name', |
c3fc2621 | 238 | 'export' => TRUE, |
522a26c9 | 239 | 'table_name' => 'civicrm_campaign', |
240 | 'entity' => 'Campaign', | |
241 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 242 | 'localizable' => 0, |
c3fc2621 | 243 | 'html' => [ |
e501603b | 244 | 'type' => 'Text', |
c3fc2621 | 245 | ], |
a9d0587b | 246 | 'add' => '3.3', |
c3fc2621 CW |
247 | ], |
248 | 'title' => [ | |
e501603b TO |
249 | 'name' => 'title', |
250 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 251 | 'title' => ts('Campaign Title'), |
215b423e | 252 | 'description' => ts('Title of the Campaign.'), |
e501603b TO |
253 | 'maxlength' => 255, |
254 | 'size' => CRM_Utils_Type::HUGE, | |
c3fc2621 | 255 | 'import' => TRUE, |
e501603b | 256 | 'where' => 'civicrm_campaign.title', |
c3fc2621 | 257 | 'export' => TRUE, |
522a26c9 | 258 | 'table_name' => 'civicrm_campaign', |
259 | 'entity' => 'Campaign', | |
260 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 261 | 'localizable' => 0, |
c3fc2621 | 262 | 'html' => [ |
e501603b | 263 | 'type' => 'Text', |
c3fc2621 | 264 | ], |
a9d0587b | 265 | 'add' => '3.3', |
c3fc2621 CW |
266 | ], |
267 | 'description' => [ | |
e501603b TO |
268 | 'name' => 'description', |
269 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 270 | 'title' => ts('Campaign Description'), |
215b423e | 271 | 'description' => ts('Full description of Campaign.'), |
e501603b TO |
272 | 'rows' => 8, |
273 | 'cols' => 60, | |
a36434b9 | 274 | 'where' => 'civicrm_campaign.description', |
522a26c9 | 275 | 'table_name' => 'civicrm_campaign', |
276 | 'entity' => 'Campaign', | |
277 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 278 | 'localizable' => 0, |
c3fc2621 | 279 | 'html' => [ |
e501603b | 280 | 'type' => 'TextArea', |
c3fc2621 | 281 | ], |
a9d0587b | 282 | 'add' => '3.3', |
c3fc2621 CW |
283 | ], |
284 | 'start_date' => [ | |
e501603b TO |
285 | 'name' => 'start_date', |
286 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 287 | 'title' => ts('Campaign Start Date'), |
215b423e | 288 | 'description' => ts('Date and time that Campaign starts.'), |
c3fc2621 | 289 | 'import' => TRUE, |
e501603b TO |
290 | 'where' => 'civicrm_campaign.start_date', |
291 | 'headerPattern' => '/^start|(s(tart\s)?date)$/i', | |
c3fc2621 | 292 | 'export' => TRUE, |
522a26c9 | 293 | 'table_name' => 'civicrm_campaign', |
294 | 'entity' => 'Campaign', | |
295 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 296 | 'localizable' => 0, |
c3fc2621 | 297 | 'html' => [ |
e501603b | 298 | 'type' => 'Select Date', |
efcda6b9 | 299 | 'formatType' => 'activityDateTime', |
c3fc2621 | 300 | ], |
a9d0587b | 301 | 'add' => '3.3', |
c3fc2621 CW |
302 | ], |
303 | 'end_date' => [ | |
e501603b TO |
304 | 'name' => 'end_date', |
305 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 306 | 'title' => ts('Campaign End Date'), |
215b423e | 307 | 'description' => ts('Date and time that Campaign ends.'), |
c3fc2621 | 308 | 'import' => TRUE, |
e501603b TO |
309 | 'where' => 'civicrm_campaign.end_date', |
310 | 'headerPattern' => '/^end|(e(nd\s)?date)$/i', | |
c3fc2621 | 311 | 'export' => TRUE, |
522a26c9 | 312 | 'table_name' => 'civicrm_campaign', |
313 | 'entity' => 'Campaign', | |
314 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 315 | 'localizable' => 0, |
c3fc2621 | 316 | 'html' => [ |
e501603b | 317 | 'type' => 'Select Date', |
efcda6b9 | 318 | 'formatType' => 'activityDateTime', |
c3fc2621 | 319 | ], |
a9d0587b | 320 | 'add' => '3.3', |
c3fc2621 CW |
321 | ], |
322 | 'campaign_type_id' => [ | |
e501603b TO |
323 | 'name' => 'campaign_type_id', |
324 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 325 | 'title' => ts('Campaign Type'), |
215b423e | 326 | 'description' => ts('Campaign Type ID.Implicit FK to civicrm_option_value where option_group = campaign_type'), |
c3fc2621 | 327 | 'import' => TRUE, |
e501603b | 328 | 'where' => 'civicrm_campaign.campaign_type_id', |
c3fc2621 | 329 | 'export' => TRUE, |
e501603b | 330 | 'default' => 'NULL', |
522a26c9 | 331 | 'table_name' => 'civicrm_campaign', |
332 | 'entity' => 'Campaign', | |
333 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 334 | 'localizable' => 0, |
c3fc2621 | 335 | 'html' => [ |
e501603b | 336 | 'type' => 'Select', |
c3fc2621 CW |
337 | ], |
338 | 'pseudoconstant' => [ | |
e501603b TO |
339 | 'optionGroupName' => 'campaign_type', |
340 | 'optionEditPath' => 'civicrm/admin/options/campaign_type', | |
e6ca0a57 | 341 | ], |
a9d0587b | 342 | 'add' => '3.3', |
c3fc2621 CW |
343 | ], |
344 | 'status_id' => [ | |
e501603b TO |
345 | 'name' => 'status_id', |
346 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 347 | 'title' => ts('Campaign Status'), |
215b423e | 348 | 'description' => ts('Campaign status ID.Implicit FK to civicrm_option_value where option_group = campaign_status'), |
c3fc2621 | 349 | 'import' => TRUE, |
e501603b | 350 | 'where' => 'civicrm_campaign.status_id', |
c3fc2621 | 351 | 'export' => TRUE, |
e501603b | 352 | 'default' => 'NULL', |
522a26c9 | 353 | 'table_name' => 'civicrm_campaign', |
354 | 'entity' => 'Campaign', | |
355 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 356 | 'localizable' => 0, |
c3fc2621 | 357 | 'html' => [ |
e501603b | 358 | 'type' => 'Select', |
c3fc2621 CW |
359 | ], |
360 | 'pseudoconstant' => [ | |
e501603b TO |
361 | 'optionGroupName' => 'campaign_status', |
362 | 'optionEditPath' => 'civicrm/admin/options/campaign_status', | |
e6ca0a57 | 363 | ], |
a9d0587b | 364 | 'add' => '3.3', |
c3fc2621 CW |
365 | ], |
366 | 'external_identifier' => [ | |
e501603b TO |
367 | 'name' => 'external_identifier', |
368 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 369 | 'title' => ts('Campaign External ID'), |
215b423e | 370 | 'description' => ts('Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations.'), |
e501603b TO |
371 | 'maxlength' => 32, |
372 | 'size' => CRM_Utils_Type::MEDIUM, | |
c3fc2621 | 373 | 'import' => TRUE, |
e501603b TO |
374 | 'where' => 'civicrm_campaign.external_identifier', |
375 | 'headerPattern' => '/external\s?id/i', | |
376 | 'dataPattern' => '/^\d{11,}$/', | |
c3fc2621 | 377 | 'export' => TRUE, |
522a26c9 | 378 | 'table_name' => 'civicrm_campaign', |
379 | 'entity' => 'Campaign', | |
380 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 381 | 'localizable' => 0, |
c3fc2621 | 382 | 'html' => [ |
e501603b | 383 | 'type' => 'Text', |
c3fc2621 | 384 | ], |
a9d0587b | 385 | 'add' => '3.3', |
c3fc2621 CW |
386 | ], |
387 | 'parent_id' => [ | |
e501603b TO |
388 | 'name' => 'parent_id', |
389 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 390 | 'title' => ts('Parent Campaign'), |
215b423e | 391 | 'description' => ts('Optional parent id for this Campaign.'), |
c3fc2621 | 392 | 'import' => TRUE, |
e501603b | 393 | 'where' => 'civicrm_campaign.parent_id', |
c3fc2621 | 394 | 'export' => TRUE, |
e501603b | 395 | 'default' => 'NULL', |
522a26c9 | 396 | 'table_name' => 'civicrm_campaign', |
397 | 'entity' => 'Campaign', | |
398 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 399 | 'localizable' => 0, |
e501603b | 400 | 'FKClassName' => 'CRM_Campaign_DAO_Campaign', |
c3fc2621 | 401 | 'html' => [ |
e501603b | 402 | 'type' => 'EntityRef', |
c3fc2621 | 403 | ], |
a9d0587b | 404 | 'add' => '3.3', |
c3fc2621 CW |
405 | ], |
406 | 'is_active' => [ | |
e501603b TO |
407 | 'name' => 'is_active', |
408 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 409 | 'title' => ts('Is Campaign Active?'), |
215b423e | 410 | 'description' => ts('Is this Campaign enabled or disabled/cancelled?'), |
a36434b9 | 411 | 'where' => 'civicrm_campaign.is_active', |
e501603b | 412 | 'default' => '1', |
522a26c9 | 413 | 'table_name' => 'civicrm_campaign', |
414 | 'entity' => 'Campaign', | |
415 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 416 | 'localizable' => 0, |
c3fc2621 | 417 | 'html' => [ |
e501603b | 418 | 'type' => 'CheckBox', |
c3fc2621 | 419 | ], |
a9d0587b | 420 | 'add' => '3.3', |
c3fc2621 CW |
421 | ], |
422 | 'created_id' => [ | |
e501603b TO |
423 | 'name' => 'created_id', |
424 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 425 | 'title' => ts('Campaign Created By'), |
215b423e | 426 | 'description' => ts('FK to civicrm_contact, who created this Campaign.'), |
a36434b9 | 427 | 'where' => 'civicrm_campaign.created_id', |
522a26c9 | 428 | 'table_name' => 'civicrm_campaign', |
429 | 'entity' => 'Campaign', | |
430 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 431 | 'localizable' => 0, |
e501603b | 432 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
a9d0587b | 433 | 'add' => '3.3', |
c3fc2621 CW |
434 | ], |
435 | 'created_date' => [ | |
e501603b TO |
436 | 'name' => 'created_date', |
437 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 438 | 'title' => ts('Campaign Created Date'), |
215b423e | 439 | 'description' => ts('Date and time that Campaign was created.'), |
a36434b9 | 440 | 'where' => 'civicrm_campaign.created_date', |
522a26c9 | 441 | 'table_name' => 'civicrm_campaign', |
442 | 'entity' => 'Campaign', | |
443 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 444 | 'localizable' => 0, |
c3fc2621 | 445 | 'html' => [ |
e501603b | 446 | 'type' => 'Select Date', |
efcda6b9 | 447 | 'formatType' => 'activityDateTime', |
c3fc2621 | 448 | ], |
a9d0587b | 449 | 'add' => '3.3', |
c3fc2621 CW |
450 | ], |
451 | 'last_modified_id' => [ | |
e501603b TO |
452 | 'name' => 'last_modified_id', |
453 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 454 | 'title' => ts('Campaign Modified By'), |
215b423e | 455 | 'description' => ts('FK to civicrm_contact, who recently edited this Campaign.'), |
a36434b9 | 456 | 'where' => 'civicrm_campaign.last_modified_id', |
522a26c9 | 457 | 'table_name' => 'civicrm_campaign', |
458 | 'entity' => 'Campaign', | |
459 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 460 | 'localizable' => 0, |
e501603b | 461 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
a9d0587b | 462 | 'add' => '3.3', |
c3fc2621 CW |
463 | ], |
464 | 'last_modified_date' => [ | |
e501603b TO |
465 | 'name' => 'last_modified_date', |
466 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 467 | 'title' => ts('Campaign Modified Date'), |
215b423e | 468 | 'description' => ts('Date and time that Campaign was edited last time.'), |
a36434b9 | 469 | 'where' => 'civicrm_campaign.last_modified_date', |
522a26c9 | 470 | 'table_name' => 'civicrm_campaign', |
471 | 'entity' => 'Campaign', | |
472 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 473 | 'localizable' => 0, |
a9d0587b | 474 | 'add' => '3.3', |
c3fc2621 CW |
475 | ], |
476 | 'goal_general' => [ | |
e501603b TO |
477 | 'name' => 'goal_general', |
478 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 479 | 'title' => ts('Campaign Goals'), |
215b423e | 480 | 'description' => ts('General goals for Campaign.'), |
a36434b9 | 481 | 'where' => 'civicrm_campaign.goal_general', |
522a26c9 | 482 | 'table_name' => 'civicrm_campaign', |
483 | 'entity' => 'Campaign', | |
484 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 485 | 'localizable' => 0, |
c3fc2621 | 486 | 'html' => [ |
e501603b | 487 | 'type' => 'RichTextEditor', |
c3fc2621 | 488 | ], |
a9d0587b | 489 | 'add' => '3.4', |
c3fc2621 CW |
490 | ], |
491 | 'goal_revenue' => [ | |
e501603b TO |
492 | 'name' => 'goal_revenue', |
493 | 'type' => CRM_Utils_Type::T_MONEY, | |
c3fc2621 | 494 | 'title' => ts('Goal Revenue'), |
215b423e | 495 | 'description' => ts('The target revenue for this campaign.'), |
c3fc2621 | 496 | 'precision' => [ |
e501603b | 497 | 20, |
fb607354 | 498 | 2, |
c3fc2621 | 499 | ], |
a36434b9 | 500 | 'where' => 'civicrm_campaign.goal_revenue', |
522a26c9 | 501 | 'table_name' => 'civicrm_campaign', |
502 | 'entity' => 'Campaign', | |
503 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 504 | 'localizable' => 0, |
c3fc2621 | 505 | 'html' => [ |
e501603b | 506 | 'type' => 'Text', |
c3fc2621 | 507 | ], |
a9d0587b | 508 | 'add' => '3.4', |
c3fc2621 CW |
509 | ], |
510 | ]; | |
346aaaba | 511 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 512 | } |
346aaaba | 513 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 514 | } |
c3fc2621 | 515 | |
e501603b | 516 | /** |
bd8e0b14 | 517 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
518 | * |
519 | * @return array | |
bd8e0b14 | 520 | * Array(string $name => string $uniqueName). |
e501603b | 521 | */ |
c3fc2621 | 522 | public static function &fieldKeys() { |
bd8e0b14 TO |
523 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
524 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 525 | } |
bd8e0b14 | 526 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 527 | } |
c3fc2621 | 528 | |
e501603b TO |
529 | /** |
530 | * Returns the names of this table | |
531 | * | |
532 | * @return string | |
533 | */ | |
c3fc2621 | 534 | public static function getTableName() { |
e501603b TO |
535 | return self::$_tableName; |
536 | } | |
c3fc2621 | 537 | |
e501603b TO |
538 | /** |
539 | * Returns if this table needs to be logged | |
540 | * | |
c3fc2621 | 541 | * @return bool |
e501603b | 542 | */ |
c3fc2621 | 543 | public function getLog() { |
e501603b TO |
544 | return self::$_log; |
545 | } | |
c3fc2621 | 546 | |
e501603b TO |
547 | /** |
548 | * Returns the list of fields that can be imported | |
549 | * | |
550 | * @param bool $prefix | |
551 | * | |
552 | * @return array | |
553 | */ | |
c3fc2621 CW |
554 | public static function &import($prefix = FALSE) { |
555 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'campaign', $prefix, []); | |
60808919 | 556 | return $r; |
e501603b | 557 | } |
c3fc2621 | 558 | |
e501603b TO |
559 | /** |
560 | * Returns the list of fields that can be exported | |
561 | * | |
562 | * @param bool $prefix | |
563 | * | |
564 | * @return array | |
565 | */ | |
c3fc2621 CW |
566 | public static function &export($prefix = FALSE) { |
567 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'campaign', $prefix, []); | |
60808919 | 568 | return $r; |
e501603b | 569 | } |
c3fc2621 | 570 | |
e7a6b91a AS |
571 | /** |
572 | * Returns the list of indices | |
c3fc2621 CW |
573 | * |
574 | * @param bool $localize | |
575 | * | |
576 | * @return array | |
e7a6b91a AS |
577 | */ |
578 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
579 | $indices = [ |
580 | 'UI_campaign_type_id' => [ | |
e7a6b91a | 581 | 'name' => 'UI_campaign_type_id', |
c3fc2621 | 582 | 'field' => [ |
e7a6b91a | 583 | 0 => 'campaign_type_id', |
c3fc2621 CW |
584 | ], |
585 | 'localizable' => FALSE, | |
e7a6b91a | 586 | 'sig' => 'civicrm_campaign::0::campaign_type_id', |
c3fc2621 CW |
587 | ], |
588 | 'UI_campaign_status_id' => [ | |
e7a6b91a | 589 | 'name' => 'UI_campaign_status_id', |
c3fc2621 | 590 | 'field' => [ |
e7a6b91a | 591 | 0 => 'status_id', |
c3fc2621 CW |
592 | ], |
593 | 'localizable' => FALSE, | |
e7a6b91a | 594 | 'sig' => 'civicrm_campaign::0::status_id', |
c3fc2621 CW |
595 | ], |
596 | 'UI_external_identifier' => [ | |
e7a6b91a | 597 | 'name' => 'UI_external_identifier', |
c3fc2621 | 598 | 'field' => [ |
e7a6b91a | 599 | 0 => 'external_identifier', |
c3fc2621 CW |
600 | ], |
601 | 'localizable' => FALSE, | |
602 | 'unique' => TRUE, | |
e7a6b91a | 603 | 'sig' => 'civicrm_campaign::1::external_identifier', |
c3fc2621 CW |
604 | ], |
605 | ]; | |
e7a6b91a AS |
606 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
607 | } | |
c3fc2621 | 608 | |
e501603b | 609 | } |