Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
34525f3ba9
@ -40,11 +40,11 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
|
||||
*/
|
||||
public function __construct($db, $dirmodule, $targetmodule, $canvas, $card)
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->db = $db;
|
||||
$this->dirmodule = $dirmodule;
|
||||
$this->targetmodule = $targetmodule;
|
||||
$this->canvas = $canvas;
|
||||
$this->card = $card;
|
||||
$this->targetmodule = $targetmodule;
|
||||
$this->canvas = $canvas;
|
||||
$this->card = $card;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -55,13 +55,19 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
|
||||
*/
|
||||
private function getTitle($action)
|
||||
{
|
||||
global $langs;
|
||||
global $langs, $conf;
|
||||
|
||||
$out = '';
|
||||
|
||||
if ($action == 'view') $out .= (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contact") : $langs->trans("ContactAddress"));
|
||||
if ($action == 'edit') $out .= (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("EditContact") : $langs->trans("EditContactAddress"));
|
||||
if ($action == 'create') $out .= (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("NewContact") : $langs->trans("NewContactAddress"));
|
||||
if ($action == 'view') {
|
||||
$out .= (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contact") : $langs->trans("ContactAddress"));
|
||||
}
|
||||
if ($action == 'edit') {
|
||||
$out .= (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("EditContact") : $langs->trans("EditContactAddress"));
|
||||
}
|
||||
if ($action == 'create') {
|
||||
$out .= (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("NewContact") : $langs->trans("NewContactAddress"));
|
||||
}
|
||||
|
||||
return $out;
|
||||
}
|
||||
@ -89,8 +95,7 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
|
||||
$this->tpl['error'] = $this->error;
|
||||
$this->tpl['errors'] = $this->errors;
|
||||
|
||||
if ($action == 'view')
|
||||
{
|
||||
if ($action == 'view') {
|
||||
// Card header
|
||||
$head = contact_prepare_head($this->object);
|
||||
$title = $this->getTitle($action);
|
||||
@ -106,14 +111,12 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
|
||||
$this->tpl['actionsdone'] = show_actions_done($conf, $langs, $db, $objsoc, $this->object, 1);
|
||||
} else {
|
||||
// Confirm delete contact
|
||||
if ($action == 'delete' && $user->rights->societe->contact->supprimer)
|
||||
{
|
||||
if ($action == 'delete' && $user->rights->societe->contact->supprimer) {
|
||||
$this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id, $langs->trans("DeleteContact"), $langs->trans("ConfirmDeleteContact"), "confirm_delete", '', 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'list')
|
||||
{
|
||||
if ($action == 'list') {
|
||||
$this->LoadListDatas($limit, $offset, $sortfield, $sortorder);
|
||||
}
|
||||
}
|
||||
|
||||
@ -260,10 +260,25 @@ class Contact extends CommonObject
|
||||
public $birthday;
|
||||
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
|
||||
public $ref_commande; // Nb de reference commande pour lequel il est contact
|
||||
public $ref_propal; // Nb de reference propal pour lequel il est contact
|
||||
/**
|
||||
* @var int Number of invoices for which he is 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
|
||||
@ -412,9 +427,15 @@ class Contact extends CommonObject
|
||||
$this->lastname = $this->lastname ?trim($this->lastname) : trim($this->name);
|
||||
$this->firstname = trim($this->firstname);
|
||||
$this->setUpperOrLowerCase();
|
||||
if (empty($this->socid)) $this->socid = 0;
|
||||
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
|
||||
if (empty($this->socid)) {
|
||||
$this->socid = 0;
|
||||
}
|
||||
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);
|
||||
|
||||
@ -610,88 +631,72 @@ class Contact extends CommonObject
|
||||
$tmpobj = new User($this->db);
|
||||
$tmpobj->fetch($this->user_id);
|
||||
$usermustbemodified = 0;
|
||||
if ($tmpobj->office_phone != $this->phone_pro)
|
||||
{
|
||||
if ($tmpobj->office_phone != $this->phone_pro) {
|
||||
$tmpobj->office_phone = $this->phone_pro;
|
||||
$usermustbemodified++;
|
||||
}
|
||||
if ($tmpobj->office_fax != $this->fax)
|
||||
{
|
||||
if ($tmpobj->office_fax != $this->fax) {
|
||||
$tmpobj->office_fax = $this->fax;
|
||||
$usermustbemodified++;
|
||||
}
|
||||
if ($tmpobj->address != $this->address)
|
||||
{
|
||||
if ($tmpobj->address != $this->address) {
|
||||
$tmpobj->address = $this->address;
|
||||
$usermustbemodified++;
|
||||
}
|
||||
if ($tmpobj->town != $this->town)
|
||||
{
|
||||
if ($tmpobj->town != $this->town) {
|
||||
$tmpobj->town = $this->town;
|
||||
$usermustbemodified++;
|
||||
}
|
||||
if ($tmpobj->zip != $this->zip)
|
||||
{
|
||||
if ($tmpobj->zip != $this->zip) {
|
||||
$tmpobj->zip = $this->zip;
|
||||
$usermustbemodified++;
|
||||
}
|
||||
if ($tmpobj->zip != $this->zip)
|
||||
{
|
||||
if ($tmpobj->zip != $this->zip) {
|
||||
$tmpobj->state_id = $this->state_id;
|
||||
$usermustbemodified++;
|
||||
}
|
||||
if ($tmpobj->country_id != $this->country_id)
|
||||
{
|
||||
if ($tmpobj->country_id != $this->country_id) {
|
||||
$tmpobj->country_id = $this->country_id;
|
||||
$usermustbemodified++;
|
||||
}
|
||||
if ($tmpobj->email != $this->email)
|
||||
{
|
||||
if ($tmpobj->email != $this->email) {
|
||||
$tmpobj->email = $this->email;
|
||||
$usermustbemodified++;
|
||||
}
|
||||
if (!empty(array_diff($tmpobj->socialnetworks, $this->socialnetworks)))
|
||||
{
|
||||
if (!empty(array_diff($tmpobj->socialnetworks, $this->socialnetworks))) {
|
||||
$tmpobj->socialnetworks = $this->socialnetworks;
|
||||
$usermustbemodified++;
|
||||
}
|
||||
// if ($tmpobj->skype != $this->skype)
|
||||
// {
|
||||
// if ($tmpobj->skype != $this->skype) {
|
||||
// $tmpobj->skype = $this->skype;
|
||||
// $usermustbemodified++;
|
||||
// }
|
||||
// if ($tmpobj->twitter != $this->twitter)
|
||||
// {
|
||||
// if ($tmpobj->twitter != $this->twitter) {
|
||||
// $tmpobj->twitter = $this->twitter;
|
||||
// $usermustbemodified++;
|
||||
// }
|
||||
// if ($tmpobj->facebook != $this->facebook)
|
||||
// {
|
||||
// if ($tmpobj->facebook != $this->facebook) {
|
||||
// $tmpobj->facebook = $this->facebook;
|
||||
// $usermustbemodified++;
|
||||
// }
|
||||
// if ($tmpobj->linkedin != $this->linkedin)
|
||||
// {
|
||||
// if ($tmpobj->linkedin != $this->linkedin) {
|
||||
// $tmpobj->linkedin = $this->linkedin;
|
||||
// $usermustbemodified++;
|
||||
// }
|
||||
if ($usermustbemodified)
|
||||
{
|
||||
if ($usermustbemodified) {
|
||||
$result = $tmpobj->update($user, 0, 1, 1, 1);
|
||||
if ($result < 0) { $error++; }
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error && !$notrigger)
|
||||
{
|
||||
if (!$error && !$notrigger) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('CONTACT_MODIFY', $user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
} else {
|
||||
@ -723,9 +728,13 @@ class Contact extends CommonObject
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
$dn = '';
|
||||
if ($mode == 0) $dn = $conf->global->LDAP_KEY_CONTACTS."=".$info[$conf->global->LDAP_KEY_CONTACTS].",".$conf->global->LDAP_CONTACT_DN;
|
||||
elseif ($mode == 1) $dn = $conf->global->LDAP_CONTACT_DN;
|
||||
elseif ($mode == 2) $dn = $conf->global->LDAP_KEY_CONTACTS."=".$info[$conf->global->LDAP_KEY_CONTACTS];
|
||||
if ($mode == 0) {
|
||||
$dn = $conf->global->LDAP_KEY_CONTACTS."=".$info[$conf->global->LDAP_KEY_CONTACTS].",".$conf->global->LDAP_CONTACT_DN;
|
||||
} 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;
|
||||
}
|
||||
|
||||
|
||||
@ -187,7 +187,7 @@ class SupplierProposalTest extends PHPUnit\Framework\TestCase
|
||||
/**
|
||||
* testSupplierProposalAddLine
|
||||
*
|
||||
* @param int $localobject Proposal
|
||||
* @param SupplierProposal $localobject Proposal
|
||||
* @return void
|
||||
*
|
||||
* @depends testSupplierProposalFetch
|
||||
|
||||
@ -174,7 +174,7 @@ class UserGroupTest extends PHPUnit\Framework\TestCase
|
||||
/**
|
||||
* testUserGroupUpdate
|
||||
*
|
||||
* @param Object $localobject Group
|
||||
* @param UserGroup $localobject Group
|
||||
* @return void
|
||||
* @depends testUserGroupFetch
|
||||
* The depends says test is run only if previous is ok
|
||||
@ -198,7 +198,7 @@ class UserGroupTest extends PHPUnit\Framework\TestCase
|
||||
/**
|
||||
* testUserGroupAddRight
|
||||
*
|
||||
* @param Object $localobject Object to show
|
||||
* @param UserGroup $localobject Object to show
|
||||
* @return void
|
||||
* @depends testUserGroupUpdate
|
||||
* The depends says test is run only if previous is ok
|
||||
@ -221,7 +221,7 @@ class UserGroupTest extends PHPUnit\Framework\TestCase
|
||||
/**
|
||||
* testUserGroupDelRight
|
||||
*
|
||||
* @param Object $localobject Object
|
||||
* @param UserGroup $localobject Object
|
||||
* @return void
|
||||
* @depends testUserGroupAddRight
|
||||
* The depends says test is run only if previous is ok
|
||||
@ -244,7 +244,7 @@ class UserGroupTest extends PHPUnit\Framework\TestCase
|
||||
/**
|
||||
* testUserGroupOther
|
||||
*
|
||||
* @param Object $localobject Object
|
||||
* @param UserGroup $localobject Object
|
||||
* @return void
|
||||
* @depends testUserGroupDelRight
|
||||
* The depends says test is run only if previous is ok
|
||||
|
||||
@ -179,7 +179,7 @@ class UserTest extends PHPUnit\Framework\TestCase
|
||||
/**
|
||||
* testUserUpdate
|
||||
*
|
||||
* @param Object $localobject User
|
||||
* @param User $localobject User
|
||||
* @return void
|
||||
* @depends testUserFetch
|
||||
* The depends says test is run only if previous is ok
|
||||
@ -210,7 +210,7 @@ class UserTest extends PHPUnit\Framework\TestCase
|
||||
/**
|
||||
* testUserDisable
|
||||
*
|
||||
* @param Object $localobject User
|
||||
* @param User $localobject User
|
||||
* @return void
|
||||
* @depends testUserUpdate
|
||||
* The depends says test is run only if previous is ok
|
||||
@ -234,7 +234,7 @@ class UserTest extends PHPUnit\Framework\TestCase
|
||||
/**
|
||||
* testUserOther
|
||||
*
|
||||
* @param Object $localobject User
|
||||
* @param User $localobject User
|
||||
* @return void
|
||||
* @depends testUserDisable
|
||||
* The depends says test is run only if previous is ok
|
||||
@ -262,7 +262,7 @@ class UserTest extends PHPUnit\Framework\TestCase
|
||||
/**
|
||||
* testUserDelete
|
||||
*
|
||||
* @param Object $id User
|
||||
* @param int $id User id
|
||||
* @return void
|
||||
* @depends testUserOther
|
||||
* The depends says test is run only if previous is ok
|
||||
@ -287,7 +287,7 @@ class UserTest extends PHPUnit\Framework\TestCase
|
||||
/**
|
||||
* testUserAddPermission
|
||||
*
|
||||
* @param Object $id User
|
||||
* @param int $id User id
|
||||
* @return void
|
||||
* @depends testUserDelete
|
||||
* 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
|
||||
*
|
||||
* @param mixed $localobject Object User
|
||||
* @param Object $localobject Object User
|
||||
* @return void
|
||||
*/
|
||||
public function changeProperties(&$localobject)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user