commit
e796c514aa
@ -260,10 +260,25 @@ class Contact extends CommonObject
|
|||||||
public $birthday;
|
public $birthday;
|
||||||
public $default_lang;
|
public $default_lang;
|
||||||
|
|
||||||
public $ref_facturation; // Reference number of invoice for which it is contact
|
/**
|
||||||
public $ref_contrat; // Nb de reference contrat pour lequel il est contact
|
* @var int Number of invoices for which he is contact
|
||||||
public $ref_commande; // Nb de reference commande pour lequel il est contact
|
*/
|
||||||
public $ref_propal; // Nb de reference propal pour lequel il est contact
|
public $ref_facturation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int Number of contracts for which he is contact
|
||||||
|
*/
|
||||||
|
public $ref_contrat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int Number of orders for which he is contact
|
||||||
|
*/
|
||||||
|
public $ref_commande;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int Number of proposals for which he is contact
|
||||||
|
*/
|
||||||
|
public $ref_propal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int user ID
|
* @var int user ID
|
||||||
@ -412,9 +427,15 @@ class Contact extends CommonObject
|
|||||||
$this->lastname = $this->lastname ?trim($this->lastname) : trim($this->name);
|
$this->lastname = $this->lastname ?trim($this->lastname) : trim($this->name);
|
||||||
$this->firstname = trim($this->firstname);
|
$this->firstname = trim($this->firstname);
|
||||||
$this->setUpperOrLowerCase();
|
$this->setUpperOrLowerCase();
|
||||||
if (empty($this->socid)) $this->socid = 0;
|
if (empty($this->socid)) {
|
||||||
if (empty($this->priv)) $this->priv = 0;
|
$this->socid = 0;
|
||||||
if (empty($this->statut)) $this->statut = 0; // This is to convert '' into '0' to avoid bad sql request
|
}
|
||||||
|
if (empty($this->priv)) {
|
||||||
|
$this->priv = 0;
|
||||||
|
}
|
||||||
|
if (empty($this->statut)) {
|
||||||
|
$this->statut = 0; // This is to convert '' into '0' to avoid bad sql request
|
||||||
|
}
|
||||||
|
|
||||||
$this->entity = ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity);
|
$this->entity = ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity);
|
||||||
|
|
||||||
@ -610,88 +631,72 @@ class Contact extends CommonObject
|
|||||||
$tmpobj = new User($this->db);
|
$tmpobj = new User($this->db);
|
||||||
$tmpobj->fetch($this->user_id);
|
$tmpobj->fetch($this->user_id);
|
||||||
$usermustbemodified = 0;
|
$usermustbemodified = 0;
|
||||||
if ($tmpobj->office_phone != $this->phone_pro)
|
if ($tmpobj->office_phone != $this->phone_pro) {
|
||||||
{
|
|
||||||
$tmpobj->office_phone = $this->phone_pro;
|
$tmpobj->office_phone = $this->phone_pro;
|
||||||
$usermustbemodified++;
|
$usermustbemodified++;
|
||||||
}
|
}
|
||||||
if ($tmpobj->office_fax != $this->fax)
|
if ($tmpobj->office_fax != $this->fax) {
|
||||||
{
|
|
||||||
$tmpobj->office_fax = $this->fax;
|
$tmpobj->office_fax = $this->fax;
|
||||||
$usermustbemodified++;
|
$usermustbemodified++;
|
||||||
}
|
}
|
||||||
if ($tmpobj->address != $this->address)
|
if ($tmpobj->address != $this->address) {
|
||||||
{
|
|
||||||
$tmpobj->address = $this->address;
|
$tmpobj->address = $this->address;
|
||||||
$usermustbemodified++;
|
$usermustbemodified++;
|
||||||
}
|
}
|
||||||
if ($tmpobj->town != $this->town)
|
if ($tmpobj->town != $this->town) {
|
||||||
{
|
|
||||||
$tmpobj->town = $this->town;
|
$tmpobj->town = $this->town;
|
||||||
$usermustbemodified++;
|
$usermustbemodified++;
|
||||||
}
|
}
|
||||||
if ($tmpobj->zip != $this->zip)
|
if ($tmpobj->zip != $this->zip) {
|
||||||
{
|
|
||||||
$tmpobj->zip = $this->zip;
|
$tmpobj->zip = $this->zip;
|
||||||
$usermustbemodified++;
|
$usermustbemodified++;
|
||||||
}
|
}
|
||||||
if ($tmpobj->zip != $this->zip)
|
if ($tmpobj->zip != $this->zip) {
|
||||||
{
|
|
||||||
$tmpobj->state_id = $this->state_id;
|
$tmpobj->state_id = $this->state_id;
|
||||||
$usermustbemodified++;
|
$usermustbemodified++;
|
||||||
}
|
}
|
||||||
if ($tmpobj->country_id != $this->country_id)
|
if ($tmpobj->country_id != $this->country_id) {
|
||||||
{
|
|
||||||
$tmpobj->country_id = $this->country_id;
|
$tmpobj->country_id = $this->country_id;
|
||||||
$usermustbemodified++;
|
$usermustbemodified++;
|
||||||
}
|
}
|
||||||
if ($tmpobj->email != $this->email)
|
if ($tmpobj->email != $this->email) {
|
||||||
{
|
|
||||||
$tmpobj->email = $this->email;
|
$tmpobj->email = $this->email;
|
||||||
$usermustbemodified++;
|
$usermustbemodified++;
|
||||||
}
|
}
|
||||||
if (!empty(array_diff($tmpobj->socialnetworks, $this->socialnetworks)))
|
if (!empty(array_diff($tmpobj->socialnetworks, $this->socialnetworks))) {
|
||||||
{
|
|
||||||
$tmpobj->socialnetworks = $this->socialnetworks;
|
$tmpobj->socialnetworks = $this->socialnetworks;
|
||||||
$usermustbemodified++;
|
$usermustbemodified++;
|
||||||
}
|
}
|
||||||
// if ($tmpobj->skype != $this->skype)
|
// if ($tmpobj->skype != $this->skype) {
|
||||||
// {
|
|
||||||
// $tmpobj->skype = $this->skype;
|
// $tmpobj->skype = $this->skype;
|
||||||
// $usermustbemodified++;
|
// $usermustbemodified++;
|
||||||
// }
|
// }
|
||||||
// if ($tmpobj->twitter != $this->twitter)
|
// if ($tmpobj->twitter != $this->twitter) {
|
||||||
// {
|
|
||||||
// $tmpobj->twitter = $this->twitter;
|
// $tmpobj->twitter = $this->twitter;
|
||||||
// $usermustbemodified++;
|
// $usermustbemodified++;
|
||||||
// }
|
// }
|
||||||
// if ($tmpobj->facebook != $this->facebook)
|
// if ($tmpobj->facebook != $this->facebook) {
|
||||||
// {
|
|
||||||
// $tmpobj->facebook = $this->facebook;
|
// $tmpobj->facebook = $this->facebook;
|
||||||
// $usermustbemodified++;
|
// $usermustbemodified++;
|
||||||
// }
|
// }
|
||||||
// if ($tmpobj->linkedin != $this->linkedin)
|
// if ($tmpobj->linkedin != $this->linkedin) {
|
||||||
// {
|
|
||||||
// $tmpobj->linkedin = $this->linkedin;
|
// $tmpobj->linkedin = $this->linkedin;
|
||||||
// $usermustbemodified++;
|
// $usermustbemodified++;
|
||||||
// }
|
// }
|
||||||
if ($usermustbemodified)
|
if ($usermustbemodified) {
|
||||||
{
|
|
||||||
$result = $tmpobj->update($user, 0, 1, 1, 1);
|
$result = $tmpobj->update($user, 0, 1, 1, 1);
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0) { $error++; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error && !$notrigger)
|
if (!$error && !$notrigger) {
|
||||||
{
|
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result = $this->call_trigger('CONTACT_MODIFY', $user);
|
$result = $this->call_trigger('CONTACT_MODIFY', $user);
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0) { $error++; }
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error)
|
if (!$error) {
|
||||||
{
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
@ -723,9 +728,13 @@ class Contact extends CommonObject
|
|||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $conf;
|
global $conf;
|
||||||
$dn = '';
|
$dn = '';
|
||||||
if ($mode == 0) $dn = $conf->global->LDAP_KEY_CONTACTS."=".$info[$conf->global->LDAP_KEY_CONTACTS].",".$conf->global->LDAP_CONTACT_DN;
|
if ($mode == 0) {
|
||||||
elseif ($mode == 1) $dn = $conf->global->LDAP_CONTACT_DN;
|
$dn = $conf->global->LDAP_KEY_CONTACTS."=".$info[$conf->global->LDAP_KEY_CONTACTS].",".$conf->global->LDAP_CONTACT_DN;
|
||||||
elseif ($mode == 2) $dn = $conf->global->LDAP_KEY_CONTACTS."=".$info[$conf->global->LDAP_KEY_CONTACTS];
|
} elseif ($mode == 1) {
|
||||||
|
$dn = $conf->global->LDAP_CONTACT_DN;
|
||||||
|
} elseif ($mode == 2) {
|
||||||
|
$dn = $conf->global->LDAP_KEY_CONTACTS."=".$info[$conf->global->LDAP_KEY_CONTACTS];
|
||||||
|
}
|
||||||
return $dn;
|
return $dn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -187,7 +187,7 @@ class SupplierProposalTest extends PHPUnit\Framework\TestCase
|
|||||||
/**
|
/**
|
||||||
* testSupplierProposalAddLine
|
* testSupplierProposalAddLine
|
||||||
*
|
*
|
||||||
* @param int $localobject Proposal
|
* @param SupplierProposal $localobject Proposal
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
* @depends testSupplierProposalFetch
|
* @depends testSupplierProposalFetch
|
||||||
|
|||||||
@ -174,7 +174,7 @@ class UserGroupTest extends PHPUnit\Framework\TestCase
|
|||||||
/**
|
/**
|
||||||
* testUserGroupUpdate
|
* testUserGroupUpdate
|
||||||
*
|
*
|
||||||
* @param Object $localobject Group
|
* @param UserGroup $localobject Group
|
||||||
* @return void
|
* @return void
|
||||||
* @depends testUserGroupFetch
|
* @depends testUserGroupFetch
|
||||||
* The depends says test is run only if previous is ok
|
* The depends says test is run only if previous is ok
|
||||||
@ -198,7 +198,7 @@ class UserGroupTest extends PHPUnit\Framework\TestCase
|
|||||||
/**
|
/**
|
||||||
* testUserGroupAddRight
|
* testUserGroupAddRight
|
||||||
*
|
*
|
||||||
* @param Object $localobject Object to show
|
* @param UserGroup $localobject Object to show
|
||||||
* @return void
|
* @return void
|
||||||
* @depends testUserGroupUpdate
|
* @depends testUserGroupUpdate
|
||||||
* The depends says test is run only if previous is ok
|
* The depends says test is run only if previous is ok
|
||||||
@ -221,7 +221,7 @@ class UserGroupTest extends PHPUnit\Framework\TestCase
|
|||||||
/**
|
/**
|
||||||
* testUserGroupDelRight
|
* testUserGroupDelRight
|
||||||
*
|
*
|
||||||
* @param Object $localobject Object
|
* @param UserGroup $localobject Object
|
||||||
* @return void
|
* @return void
|
||||||
* @depends testUserGroupAddRight
|
* @depends testUserGroupAddRight
|
||||||
* The depends says test is run only if previous is ok
|
* The depends says test is run only if previous is ok
|
||||||
@ -244,7 +244,7 @@ class UserGroupTest extends PHPUnit\Framework\TestCase
|
|||||||
/**
|
/**
|
||||||
* testUserGroupOther
|
* testUserGroupOther
|
||||||
*
|
*
|
||||||
* @param Object $localobject Object
|
* @param UserGroup $localobject Object
|
||||||
* @return void
|
* @return void
|
||||||
* @depends testUserGroupDelRight
|
* @depends testUserGroupDelRight
|
||||||
* The depends says test is run only if previous is ok
|
* The depends says test is run only if previous is ok
|
||||||
|
|||||||
@ -179,7 +179,7 @@ class UserTest extends PHPUnit\Framework\TestCase
|
|||||||
/**
|
/**
|
||||||
* testUserUpdate
|
* testUserUpdate
|
||||||
*
|
*
|
||||||
* @param Object $localobject User
|
* @param User $localobject User
|
||||||
* @return void
|
* @return void
|
||||||
* @depends testUserFetch
|
* @depends testUserFetch
|
||||||
* The depends says test is run only if previous is ok
|
* The depends says test is run only if previous is ok
|
||||||
@ -210,7 +210,7 @@ class UserTest extends PHPUnit\Framework\TestCase
|
|||||||
/**
|
/**
|
||||||
* testUserDisable
|
* testUserDisable
|
||||||
*
|
*
|
||||||
* @param Object $localobject User
|
* @param User $localobject User
|
||||||
* @return void
|
* @return void
|
||||||
* @depends testUserUpdate
|
* @depends testUserUpdate
|
||||||
* The depends says test is run only if previous is ok
|
* The depends says test is run only if previous is ok
|
||||||
@ -234,7 +234,7 @@ class UserTest extends PHPUnit\Framework\TestCase
|
|||||||
/**
|
/**
|
||||||
* testUserOther
|
* testUserOther
|
||||||
*
|
*
|
||||||
* @param Object $localobject User
|
* @param User $localobject User
|
||||||
* @return void
|
* @return void
|
||||||
* @depends testUserDisable
|
* @depends testUserDisable
|
||||||
* The depends says test is run only if previous is ok
|
* The depends says test is run only if previous is ok
|
||||||
@ -262,7 +262,7 @@ class UserTest extends PHPUnit\Framework\TestCase
|
|||||||
/**
|
/**
|
||||||
* testUserDelete
|
* testUserDelete
|
||||||
*
|
*
|
||||||
* @param Object $id User
|
* @param int $id User id
|
||||||
* @return void
|
* @return void
|
||||||
* @depends testUserOther
|
* @depends testUserOther
|
||||||
* The depends says test is run only if previous is ok
|
* The depends says test is run only if previous is ok
|
||||||
@ -287,7 +287,7 @@ class UserTest extends PHPUnit\Framework\TestCase
|
|||||||
/**
|
/**
|
||||||
* testUserAddPermission
|
* testUserAddPermission
|
||||||
*
|
*
|
||||||
* @param Object $id User
|
* @param int $id User id
|
||||||
* @return void
|
* @return void
|
||||||
* @depends testUserDelete
|
* @depends testUserDelete
|
||||||
* The depends says test is run only if previous is ok
|
* The depends says test is run only if previous is ok
|
||||||
@ -314,7 +314,7 @@ class UserTest extends PHPUnit\Framework\TestCase
|
|||||||
/**
|
/**
|
||||||
* Edit an object to test updates
|
* Edit an object to test updates
|
||||||
*
|
*
|
||||||
* @param mixed $localobject Object User
|
* @param Object $localobject Object User
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function changeProperties(&$localobject)
|
public function changeProperties(&$localobject)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user