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