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