summaryrefslogtreecommitdiff
path: root/www/crm/wp-content/plugins/civicrm/civicrm/ext/api4/Civi/Api4/Action/Contact/Create.php
blob: 1bd0bcec83e2b146ea052d37f18b793ebd10c294 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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);
  }

}