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