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