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