diff options
author | Yaco <franco@reevo.org> | 2020-06-04 11:01:00 -0300 |
---|---|---|
committer | Yaco <franco@reevo.org> | 2020-06-04 11:01:00 -0300 |
commit | fc7369835258467bf97eb64f184b93691f9a9fd5 (patch) | |
tree | daabd60089d2dd76d9f5fb416b005fbe159c799d /www/crm/wp-content/plugins/civicrm/civicrm/ext/api4/Civi/Api4/Action/Contact/Create.php |
first commit
Diffstat (limited to 'www/crm/wp-content/plugins/civicrm/civicrm/ext/api4/Civi/Api4/Action/Contact/Create.php')
-rw-r--r-- | www/crm/wp-content/plugins/civicrm/civicrm/ext/api4/Civi/Api4/Action/Contact/Create.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/www/crm/wp-content/plugins/civicrm/civicrm/ext/api4/Civi/Api4/Action/Contact/Create.php b/www/crm/wp-content/plugins/civicrm/civicrm/ext/api4/Civi/Api4/Action/Contact/Create.php new file mode 100644 index 00000000..1bd0bcec --- /dev/null +++ b/www/crm/wp-content/plugins/civicrm/civicrm/ext/api4/Civi/Api4/Action/Contact/Create.php @@ -0,0 +1,22 @@ +<?php + +namespace Civi\Api4\Action\Contact; + +/** + * @inheritDoc + */ +class Create extends \Civi\Api4\Generic\DAOCreateAction { + + protected function fillDefaults(&$params) { + // Guess which type of contact is being created + if (empty($params['contact_type']) && !empty($params['organization_name'])) { + $params['contact_type'] = 'Organization'; + } + if (empty($params['contact_type']) && !empty($params['household_name'])) { + $params['contact_type'] = 'Household'; + } + // Will default to Individual per fieldSpec + parent::fillDefaults($params); + } + +} |