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