Fix any title or label that contain name of own entity
[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
8ab43c93 9 * (GenCodeChecksum:3b1b6ca6e815c02f3db8ccfe2a2ebb49)
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,
a9d0587b 234 'add' => '3.3',
c3fc2621
CW
235 ],
236 'name' => [
e501603b
TO
237 'name' => 'name',
238 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 239 'title' => ts('Campaign Name'),
215b423e 240 'description' => ts('Name of the Campaign.'),
c3fc2621 241 'required' => TRUE,
e501603b
TO
242 'maxlength' => 255,
243 'size' => CRM_Utils_Type::HUGE,
c3fc2621 244 'import' => TRUE,
e501603b 245 'where' => 'civicrm_campaign.name',
c3fc2621 246 'export' => TRUE,
522a26c9 247 'table_name' => 'civicrm_campaign',
248 'entity' => 'Campaign',
249 'bao' => 'CRM_Campaign_BAO_Campaign',
6a7e5e5d 250 'localizable' => 0,
c3fc2621 251 'html' => [
e501603b 252 'type' => 'Text',
c3fc2621 253 ],
a9d0587b 254 'add' => '3.3',
c3fc2621
CW
255 ],
256 'title' => [
e501603b
TO
257 'name' => 'title',
258 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 259 'title' => ts('Campaign Title'),
215b423e 260 'description' => ts('Title of the Campaign.'),
e501603b
TO
261 'maxlength' => 255,
262 'size' => CRM_Utils_Type::HUGE,
c3fc2621 263 'import' => TRUE,
e501603b 264 'where' => 'civicrm_campaign.title',
c3fc2621 265 'export' => TRUE,
522a26c9 266 'table_name' => 'civicrm_campaign',
267 'entity' => 'Campaign',
268 'bao' => 'CRM_Campaign_BAO_Campaign',
6a7e5e5d 269 'localizable' => 0,
c3fc2621 270 'html' => [
e501603b 271 'type' => 'Text',
c3fc2621 272 ],
a9d0587b 273 'add' => '3.3',
c3fc2621
CW
274 ],
275 'description' => [
e501603b
TO
276 'name' => 'description',
277 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 278 'title' => ts('Campaign Description'),
215b423e 279 'description' => ts('Full description of Campaign.'),
e501603b
TO
280 'rows' => 8,
281 'cols' => 60,
a36434b9 282 'where' => 'civicrm_campaign.description',
522a26c9 283 'table_name' => 'civicrm_campaign',
284 'entity' => 'Campaign',
285 'bao' => 'CRM_Campaign_BAO_Campaign',
6a7e5e5d 286 'localizable' => 0,
c3fc2621 287 'html' => [
e501603b 288 'type' => 'TextArea',
c3fc2621 289 ],
a9d0587b 290 'add' => '3.3',
c3fc2621
CW
291 ],
292 'start_date' => [
e501603b
TO
293 'name' => 'start_date',
294 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 295 'title' => ts('Campaign Start Date'),
215b423e 296 'description' => ts('Date and time that Campaign starts.'),
c3fc2621 297 'import' => TRUE,
e501603b
TO
298 'where' => 'civicrm_campaign.start_date',
299 'headerPattern' => '/^start|(s(tart\s)?date)$/i',
c3fc2621 300 'export' => TRUE,
522a26c9 301 'table_name' => 'civicrm_campaign',
302 'entity' => 'Campaign',
303 'bao' => 'CRM_Campaign_BAO_Campaign',
6a7e5e5d 304 'localizable' => 0,
c3fc2621 305 'html' => [
e501603b 306 'type' => 'Select Date',
efcda6b9 307 'formatType' => 'activityDateTime',
c3fc2621 308 ],
a9d0587b 309 'add' => '3.3',
c3fc2621
CW
310 ],
311 'end_date' => [
e501603b
TO
312 'name' => 'end_date',
313 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 314 'title' => ts('Campaign End Date'),
215b423e 315 'description' => ts('Date and time that Campaign ends.'),
c3fc2621 316 'import' => TRUE,
e501603b
TO
317 'where' => 'civicrm_campaign.end_date',
318 'headerPattern' => '/^end|(e(nd\s)?date)$/i',
c3fc2621 319 'export' => TRUE,
522a26c9 320 'table_name' => 'civicrm_campaign',
321 'entity' => 'Campaign',
322 'bao' => 'CRM_Campaign_BAO_Campaign',
6a7e5e5d 323 'localizable' => 0,
c3fc2621 324 'html' => [
e501603b 325 'type' => 'Select Date',
efcda6b9 326 'formatType' => 'activityDateTime',
c3fc2621 327 ],
a9d0587b 328 'add' => '3.3',
c3fc2621
CW
329 ],
330 'campaign_type_id' => [
e501603b
TO
331 'name' => 'campaign_type_id',
332 'type' => CRM_Utils_Type::T_INT,
c3fc2621 333 'title' => ts('Campaign Type'),
215b423e 334 'description' => ts('Campaign Type ID.Implicit FK to civicrm_option_value where option_group = campaign_type'),
c3fc2621 335 'import' => TRUE,
e501603b 336 'where' => 'civicrm_campaign.campaign_type_id',
c3fc2621 337 'export' => TRUE,
e501603b 338 'default' => 'NULL',
522a26c9 339 'table_name' => 'civicrm_campaign',
340 'entity' => 'Campaign',
341 'bao' => 'CRM_Campaign_BAO_Campaign',
6a7e5e5d 342 'localizable' => 0,
c3fc2621 343 'html' => [
e501603b 344 'type' => 'Select',
c3fc2621
CW
345 ],
346 'pseudoconstant' => [
e501603b
TO
347 'optionGroupName' => 'campaign_type',
348 'optionEditPath' => 'civicrm/admin/options/campaign_type',
e6ca0a57 349 ],
a9d0587b 350 'add' => '3.3',
c3fc2621
CW
351 ],
352 'status_id' => [
e501603b
TO
353 'name' => 'status_id',
354 'type' => CRM_Utils_Type::T_INT,
c3fc2621 355 'title' => ts('Campaign Status'),
215b423e 356 'description' => ts('Campaign status ID.Implicit FK to civicrm_option_value where option_group = campaign_status'),
c3fc2621 357 'import' => TRUE,
e501603b 358 'where' => 'civicrm_campaign.status_id',
c3fc2621 359 'export' => TRUE,
e501603b 360 'default' => 'NULL',
522a26c9 361 'table_name' => 'civicrm_campaign',
362 'entity' => 'Campaign',
363 'bao' => 'CRM_Campaign_BAO_Campaign',
6a7e5e5d 364 'localizable' => 0,
c3fc2621 365 'html' => [
e501603b 366 'type' => 'Select',
c3fc2621
CW
367 ],
368 'pseudoconstant' => [
e501603b
TO
369 'optionGroupName' => 'campaign_status',
370 'optionEditPath' => 'civicrm/admin/options/campaign_status',
e6ca0a57 371 ],
a9d0587b 372 'add' => '3.3',
c3fc2621
CW
373 ],
374 'external_identifier' => [
e501603b
TO
375 'name' => 'external_identifier',
376 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 377 'title' => ts('Campaign External ID'),
215b423e 378 'description' => ts('Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations.'),
e501603b
TO
379 'maxlength' => 32,
380 'size' => CRM_Utils_Type::MEDIUM,
c3fc2621 381 'import' => TRUE,
e501603b
TO
382 'where' => 'civicrm_campaign.external_identifier',
383 'headerPattern' => '/external\s?id/i',
384 'dataPattern' => '/^\d{11,}$/',
c3fc2621 385 'export' => TRUE,
522a26c9 386 'table_name' => 'civicrm_campaign',
387 'entity' => 'Campaign',
388 'bao' => 'CRM_Campaign_BAO_Campaign',
6a7e5e5d 389 'localizable' => 0,
c3fc2621 390 'html' => [
e501603b 391 'type' => 'Text',
c3fc2621 392 ],
a9d0587b 393 'add' => '3.3',
c3fc2621
CW
394 ],
395 'parent_id' => [
e501603b
TO
396 'name' => 'parent_id',
397 'type' => CRM_Utils_Type::T_INT,
c3fc2621 398 'title' => ts('Parent Campaign'),
215b423e 399 'description' => ts('Optional parent id for this Campaign.'),
c3fc2621 400 'import' => TRUE,
e501603b 401 'where' => 'civicrm_campaign.parent_id',
c3fc2621 402 'export' => TRUE,
e501603b 403 'default' => 'NULL',
522a26c9 404 'table_name' => 'civicrm_campaign',
405 'entity' => 'Campaign',
406 'bao' => 'CRM_Campaign_BAO_Campaign',
6a7e5e5d 407 'localizable' => 0,
e501603b 408 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
c3fc2621 409 'html' => [
e501603b 410 'type' => 'EntityRef',
c3fc2621 411 ],
a9d0587b 412 'add' => '3.3',
c3fc2621
CW
413 ],
414 'is_active' => [
e501603b
TO
415 'name' => 'is_active',
416 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 417 'title' => ts('Is Campaign Active?'),
215b423e 418 'description' => ts('Is this Campaign enabled or disabled/cancelled?'),
a36434b9 419 'where' => 'civicrm_campaign.is_active',
e501603b 420 'default' => '1',
522a26c9 421 'table_name' => 'civicrm_campaign',
422 'entity' => 'Campaign',
423 'bao' => 'CRM_Campaign_BAO_Campaign',
6a7e5e5d 424 'localizable' => 0,
c3fc2621 425 'html' => [
e501603b 426 'type' => 'CheckBox',
c3fc2621 427 ],
a9d0587b 428 'add' => '3.3',
c3fc2621
CW
429 ],
430 'created_id' => [
e501603b
TO
431 'name' => 'created_id',
432 'type' => CRM_Utils_Type::T_INT,
c3fc2621 433 'title' => ts('Campaign Created By'),
215b423e 434 'description' => ts('FK to civicrm_contact, who created this Campaign.'),
a36434b9 435 'where' => 'civicrm_campaign.created_id',
522a26c9 436 'table_name' => 'civicrm_campaign',
437 'entity' => 'Campaign',
438 'bao' => 'CRM_Campaign_BAO_Campaign',
6a7e5e5d 439 'localizable' => 0,
e501603b 440 'FKClassName' => 'CRM_Contact_DAO_Contact',
a9d0587b 441 'add' => '3.3',
c3fc2621
CW
442 ],
443 'created_date' => [
e501603b
TO
444 'name' => 'created_date',
445 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 446 'title' => ts('Campaign Created Date'),
215b423e 447 'description' => ts('Date and time that Campaign was created.'),
a36434b9 448 'where' => 'civicrm_campaign.created_date',
522a26c9 449 'table_name' => 'civicrm_campaign',
450 'entity' => 'Campaign',
451 'bao' => 'CRM_Campaign_BAO_Campaign',
6a7e5e5d 452 'localizable' => 0,
c3fc2621 453 'html' => [
e501603b 454 'type' => 'Select Date',
efcda6b9 455 'formatType' => 'activityDateTime',
c3fc2621 456 ],
a9d0587b 457 'add' => '3.3',
c3fc2621
CW
458 ],
459 'last_modified_id' => [
e501603b
TO
460 'name' => 'last_modified_id',
461 'type' => CRM_Utils_Type::T_INT,
c3fc2621 462 'title' => ts('Campaign Modified By'),
215b423e 463 'description' => ts('FK to civicrm_contact, who recently edited this Campaign.'),
a36434b9 464 'where' => 'civicrm_campaign.last_modified_id',
522a26c9 465 'table_name' => 'civicrm_campaign',
466 'entity' => 'Campaign',
467 'bao' => 'CRM_Campaign_BAO_Campaign',
6a7e5e5d 468 'localizable' => 0,
e501603b 469 'FKClassName' => 'CRM_Contact_DAO_Contact',
a9d0587b 470 'add' => '3.3',
c3fc2621
CW
471 ],
472 'last_modified_date' => [
e501603b
TO
473 'name' => 'last_modified_date',
474 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 475 'title' => ts('Campaign Modified Date'),
215b423e 476 'description' => ts('Date and time that Campaign was edited last time.'),
a36434b9 477 'where' => 'civicrm_campaign.last_modified_date',
522a26c9 478 'table_name' => 'civicrm_campaign',
479 'entity' => 'Campaign',
480 'bao' => 'CRM_Campaign_BAO_Campaign',
6a7e5e5d 481 'localizable' => 0,
a9d0587b 482 'add' => '3.3',
c3fc2621
CW
483 ],
484 'goal_general' => [
e501603b
TO
485 'name' => 'goal_general',
486 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 487 'title' => ts('Campaign Goals'),
215b423e 488 'description' => ts('General goals for Campaign.'),
a36434b9 489 'where' => 'civicrm_campaign.goal_general',
522a26c9 490 'table_name' => 'civicrm_campaign',
491 'entity' => 'Campaign',
492 'bao' => 'CRM_Campaign_BAO_Campaign',
6a7e5e5d 493 'localizable' => 0,
c3fc2621 494 'html' => [
e501603b 495 'type' => 'RichTextEditor',
c3fc2621 496 ],
a9d0587b 497 'add' => '3.4',
c3fc2621
CW
498 ],
499 'goal_revenue' => [
e501603b
TO
500 'name' => 'goal_revenue',
501 'type' => CRM_Utils_Type::T_MONEY,
c3fc2621 502 'title' => ts('Goal Revenue'),
215b423e 503 'description' => ts('The target revenue for this campaign.'),
c3fc2621 504 'precision' => [
e501603b 505 20,
fb607354 506 2,
c3fc2621 507 ],
a36434b9 508 'where' => 'civicrm_campaign.goal_revenue',
522a26c9 509 'table_name' => 'civicrm_campaign',
510 'entity' => 'Campaign',
511 'bao' => 'CRM_Campaign_BAO_Campaign',
6a7e5e5d 512 'localizable' => 0,
c3fc2621 513 'html' => [
e501603b 514 'type' => 'Text',
c3fc2621 515 ],
a9d0587b 516 'add' => '3.4',
c3fc2621
CW
517 ],
518 ];
346aaaba 519 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 520 }
346aaaba 521 return Civi::$statics[__CLASS__]['fields'];
e501603b 522 }
c3fc2621 523
e501603b 524 /**
bd8e0b14 525 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
526 *
527 * @return array
bd8e0b14 528 * Array(string $name => string $uniqueName).
e501603b 529 */
c3fc2621 530 public static function &fieldKeys() {
bd8e0b14
TO
531 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
532 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 533 }
bd8e0b14 534 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 535 }
c3fc2621 536
e501603b
TO
537 /**
538 * Returns the names of this table
539 *
540 * @return string
541 */
c3fc2621 542 public static function getTableName() {
e501603b
TO
543 return self::$_tableName;
544 }
c3fc2621 545
e501603b
TO
546 /**
547 * Returns if this table needs to be logged
548 *
c3fc2621 549 * @return bool
e501603b 550 */
c3fc2621 551 public function getLog() {
e501603b
TO
552 return self::$_log;
553 }
c3fc2621 554
e501603b
TO
555 /**
556 * Returns the list of fields that can be imported
557 *
558 * @param bool $prefix
559 *
560 * @return array
561 */
c3fc2621
CW
562 public static function &import($prefix = FALSE) {
563 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'campaign', $prefix, []);
60808919 564 return $r;
e501603b 565 }
c3fc2621 566
e501603b
TO
567 /**
568 * Returns the list of fields that can be exported
569 *
570 * @param bool $prefix
571 *
572 * @return array
573 */
c3fc2621
CW
574 public static function &export($prefix = FALSE) {
575 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'campaign', $prefix, []);
60808919 576 return $r;
e501603b 577 }
c3fc2621 578
e7a6b91a
AS
579 /**
580 * Returns the list of indices
c3fc2621
CW
581 *
582 * @param bool $localize
583 *
584 * @return array
e7a6b91a
AS
585 */
586 public static function indices($localize = TRUE) {
c3fc2621 587 $indices = [
4edfa3ea 588 'UI_campaign_name' => [
589 'name' => 'UI_campaign_name',
590 'field' => [
591 0 => 'name',
592 ],
593 'localizable' => FALSE,
594 'sig' => 'civicrm_campaign::0::name',
595 ],
c3fc2621 596 'UI_campaign_type_id' => [
e7a6b91a 597 'name' => 'UI_campaign_type_id',
c3fc2621 598 'field' => [
e7a6b91a 599 0 => 'campaign_type_id',
c3fc2621
CW
600 ],
601 'localizable' => FALSE,
e7a6b91a 602 'sig' => 'civicrm_campaign::0::campaign_type_id',
c3fc2621
CW
603 ],
604 'UI_campaign_status_id' => [
e7a6b91a 605 'name' => 'UI_campaign_status_id',
c3fc2621 606 'field' => [
e7a6b91a 607 0 => 'status_id',
c3fc2621
CW
608 ],
609 'localizable' => FALSE,
e7a6b91a 610 'sig' => 'civicrm_campaign::0::status_id',
c3fc2621
CW
611 ],
612 'UI_external_identifier' => [
e7a6b91a 613 'name' => 'UI_external_identifier',
c3fc2621 614 'field' => [
e7a6b91a 615 0 => 'external_identifier',
c3fc2621
CW
616 ],
617 'localizable' => FALSE,
618 'unique' => TRUE,
e7a6b91a 619 'sig' => 'civicrm_campaign::1::external_identifier',
c3fc2621
CW
620 ],
621 ];
e7a6b91a
AS
622 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
623 }
c3fc2621 624
e501603b 625}