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