Skip to content

Commit

Permalink
#185 [QuickCreation] fix: automatic contact creation condition
Browse files Browse the repository at this point in the history
  • Loading branch information
evarisk-theo committed Apr 12, 2023
1 parent 8fba520 commit 092eae1
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions class/actions_dolicar.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -698,26 +698,28 @@ public function quickCreationAction(&$parameters, &$object, &$action, $hookmanag
$createRegistrationCertificate = 1;
require_once __DIR__ . '/../core/tpl/dolicar_registrationcertificatefr_immatriculation_api_fetch_action.tpl.php';

if ($conf->global->DOLICAR_AUTOMATIC_CONTACT_CREATION > 0 && empty($conf->global->DOLICAR_CONTACT_QUICK_CREATION) && empty($parameters['$contactID'])) {
if ($conf->global->DOLICAR_AUTOMATIC_CONTACT_CREATION > 0 && empty($parameters['$contactID'])) {
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';

$thirdparty = new Societe($this->db);
$contact = new Contact($this->db);
if (isModEnabled('societe')) {
$thirdparty = new Societe($this->db);
$contact = new Contact($this->db);

$thirdpartyID = $parameters['thirdpartyID'];
$thirdpartyID = $parameters['thirdpartyID'];

$thirdparty->fetch($thirdpartyID);
$thirdparty->fetch($thirdpartyID);

$contact->socid = !empty($thirdpartyID) ? $thirdpartyID : '';
$contact->lastname = $thirdparty->name;
$contact->email = $thirdparty->email;
$contact->phone_pro = $thirdparty->phone;
$contact->socid = !empty($thirdpartyID) ? $thirdpartyID : '';
$contact->lastname = $thirdparty->name;
$contact->email = $thirdparty->email;
$contact->phone_pro = $thirdparty->phone;

$contactID = $contact->create($user);
if ($contactID < 0) {
setEventMessages($contact->error, $contact->errors, 'errors');
$error++;
$contactID = $contact->create($user);
if ($contactID < 0) {
setEventMessages($contact->error, $contact->errors, 'errors');
$error++;
}
}
}
if (dol_strlen($backtopage) > 0){
Expand Down

0 comments on commit 092eae1

Please sign in to comment.