Fixing style errors.
This commit is contained in:
parent
1ae0e2a920
commit
b7045ef3a0
@ -549,7 +549,7 @@ if (empty($reshook)) {
|
||||
|
||||
$db->commit();
|
||||
$rowid = $object->id;
|
||||
$id = $object->id;
|
||||
$id = $object->id;
|
||||
} else {
|
||||
$db->rollback();
|
||||
|
||||
@ -561,37 +561,37 @@ if (empty($reshook)) {
|
||||
}
|
||||
// Auto-create thirdparty on member creation
|
||||
if (!empty($conf->global->ADHERENT_DEFAULT_CREATE_THIRDPARTY)) {
|
||||
if ($result > 0) {
|
||||
// User creation
|
||||
$company = new Societe($db);
|
||||
|
||||
$companyalias = '';
|
||||
$fullname = $object->getFullName($langs);
|
||||
|
||||
if ($object->morphy == 'mor') {
|
||||
$companyname = $object->company;
|
||||
if (!empty($fullname)) {
|
||||
$companyalias = $fullname;
|
||||
}
|
||||
} else {
|
||||
$companyname = $fullname;
|
||||
if (!empty($object->company)) {
|
||||
$companyalias = $object->company;
|
||||
}
|
||||
}
|
||||
|
||||
$result = $company->create_from_member($object, $companyname, $companyalias);
|
||||
|
||||
if ($result < 0) {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans($company->error), null, 'errors');
|
||||
setEventMessages($company->error, $company->errors, 'errors');
|
||||
}
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
if ($result > 0) {
|
||||
// User creation
|
||||
$company = new Societe($db);
|
||||
|
||||
$companyalias = '';
|
||||
$fullname = $object->getFullName($langs);
|
||||
|
||||
if ($object->morphy == 'mor') {
|
||||
$companyname = $object->company;
|
||||
if (!empty($fullname)) {
|
||||
$companyalias = $fullname;
|
||||
}
|
||||
} else {
|
||||
$companyname = $fullname;
|
||||
if (!empty($object->company)) {
|
||||
$companyalias = $object->company;
|
||||
}
|
||||
}
|
||||
|
||||
$result = $company->create_from_member($object, $companyname, $companyalias);
|
||||
|
||||
if ($result < 0) {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans($company->error), null, 'errors');
|
||||
setEventMessages($company->error, $company->errors, 'errors');
|
||||
}
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$action = ($result < 0 || !$error) ? '' : 'create';
|
||||
}
|
||||
|
||||
|
||||
@ -3796,23 +3796,23 @@ class Societe extends CommonObject
|
||||
$this->code_client = ($customercode ? $customercode : -1);
|
||||
$this->code_fournisseur = -1;
|
||||
$this->typent_id = ($member->morphy == 'phy' ? 8 : 0); // The type of thirdparty is private (individual) if the member is human (phy)
|
||||
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Cree et positionne $this->id
|
||||
$result = $this->create($user);
|
||||
|
||||
|
||||
if ($result >= 0) {
|
||||
// Auto-create contact on thirdparty creation
|
||||
if (!empty($conf->global->THIRDPARTY_DEFAULT_CREATE_CONTACT)) {
|
||||
if (!empty($conf->global->THIRDPARTY_DEFAULT_CREATE_CONTACT)) {
|
||||
// Fill fields needed by contact
|
||||
$this->name_bis = $member->lastname;
|
||||
$this->name_bis = $member->lastname;
|
||||
$this->firstname = $member->firstname;
|
||||
$this->civility_id = $member->civility_id;
|
||||
|
||||
dol_syslog("We ask to create a contact/address too", LOG_DEBUG);
|
||||
$result = $this->create_individual($user);
|
||||
|
||||
|
||||
if ($result < 0) {
|
||||
setEventMessages($this->error, $this->errors, 'errors');
|
||||
$this->db->rollback();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user