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