FIX #3534
This commit is contained in:
parent
7d8013b371
commit
313d9ddacd
@ -445,6 +445,7 @@ if ($id == 11)
|
|||||||
$langs->load("interventions");
|
$langs->load("interventions");
|
||||||
$elementList = array(
|
$elementList = array(
|
||||||
'' => '',
|
'' => '',
|
||||||
|
'societe' => $langs->trans('ThirdParty'),
|
||||||
// 'proposal' => $langs->trans('Proposal'),
|
// 'proposal' => $langs->trans('Proposal'),
|
||||||
// 'order' => $langs->trans('Order'),
|
// 'order' => $langs->trans('Order'),
|
||||||
// 'invoice' => $langs->trans('Bill'),
|
// 'invoice' => $langs->trans('Bill'),
|
||||||
|
|||||||
@ -1165,8 +1165,10 @@ if (empty($reshook))
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (! $error && ! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->commande->creer) {
|
if (! $error && ! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->commande->creer)
|
||||||
if ($action == 'addcontact') {
|
{
|
||||||
|
if ($action == 'addcontact')
|
||||||
|
{
|
||||||
if ($object->id > 0) {
|
if ($object->id > 0) {
|
||||||
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
||||||
$result = $object->add_contact($contactid, GETPOST('type'), GETPOST('source'));
|
$result = $object->add_contact($contactid, GETPOST('type'), GETPOST('source'));
|
||||||
@ -1186,7 +1188,8 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// bascule du statut d'un contact
|
// bascule du statut d'un contact
|
||||||
else if ($action == 'swapstatut') {
|
else if ($action == 'swapstatut')
|
||||||
|
{
|
||||||
if ($object->id > 0) {
|
if ($object->id > 0) {
|
||||||
$result = $object->swapContactStatus(GETPOST('ligne'));
|
$result = $object->swapContactStatus(GETPOST('ligne'));
|
||||||
} else {
|
} else {
|
||||||
@ -1195,7 +1198,8 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Efface un contact
|
// Efface un contact
|
||||||
else if ($action == 'deletecontact') {
|
else if ($action == 'deletecontact')
|
||||||
|
{
|
||||||
$result = $object->delete_contact($lineid);
|
$result = $object->delete_contact($lineid);
|
||||||
|
|
||||||
if ($result >= 0) {
|
if ($result >= 0) {
|
||||||
|
|||||||
@ -452,13 +452,15 @@ abstract class CommonObject
|
|||||||
// Check parameters
|
// Check parameters
|
||||||
if ($fk_socpeople <= 0)
|
if ($fk_socpeople <= 0)
|
||||||
{
|
{
|
||||||
$this->error=$langs->trans("ErrorWrongValueForParameter","1");
|
$langs->load("errors");
|
||||||
|
$this->error=$langs->trans("ErrorWrongValueForParameterX","1");
|
||||||
dol_syslog(get_class($this)."::add_contact ".$this->error,LOG_ERR);
|
dol_syslog(get_class($this)."::add_contact ".$this->error,LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (! $type_contact)
|
if (! $type_contact)
|
||||||
{
|
{
|
||||||
$this->error=$langs->trans("ErrorWrongValueForParameter","2");
|
$langs->load("errors");
|
||||||
|
$this->error=$langs->trans("ErrorWrongValueForParameterX","2");
|
||||||
dol_syslog(get_class($this)."::add_contact ".$this->error,LOG_ERR);
|
dol_syslog(get_class($this)."::add_contact ".$this->error,LOG_ERR);
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
@ -504,7 +506,11 @@ abstract class CommonObject
|
|||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
$result=$this->call_trigger(strtoupper($this->element).'_ADD_CONTACT', $user);
|
$result=$this->call_trigger(strtoupper($this->element).'_ADD_CONTACT', $user);
|
||||||
if ($result < 0) { $this->db->rollback(); return -1; }
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
|||||||
@ -72,7 +72,12 @@ $userstatic=new User($db);
|
|||||||
<div class="nowrap tagtd"><?php echo img_object('','user').' '.$langs->trans("Users"); ?></div>
|
<div class="nowrap tagtd"><?php echo img_object('','user').' '.$langs->trans("Users"); ?></div>
|
||||||
<div class="tagtd"><?php echo $conf->global->MAIN_INFO_SOCIETE_NOM; ?></div>
|
<div class="tagtd"><?php echo $conf->global->MAIN_INFO_SOCIETE_NOM; ?></div>
|
||||||
<div class="tagtd maxwidthonsmartphone"><?php echo $form->select_dolusers($user->id, 'userid', 0, (! empty($userAlreadySelected)?$userAlreadySelected:null), 0, null, null, 0, 56); ?></div>
|
<div class="tagtd maxwidthonsmartphone"><?php echo $form->select_dolusers($user->id, 'userid', 0, (! empty($userAlreadySelected)?$userAlreadySelected:null), 0, null, null, 0, 56); ?></div>
|
||||||
<div class="tagtd maxwidthonsmartphone"><?php echo $formcompany->selectTypeContact($object, '', 'type','internal'); ?></div>
|
<div class="tagtd maxwidthonsmartphone">
|
||||||
|
<?php
|
||||||
|
$tmpobject=$object;
|
||||||
|
if ($object->element == 'shipping' && is_object($objectsrc)) $tmpobject=$objectsrc;
|
||||||
|
echo $formcompany->selectTypeContact($tmpobject, '', 'type','internal');
|
||||||
|
?></div>
|
||||||
<div class="tagtd"> </div>
|
<div class="tagtd"> </div>
|
||||||
<div class="tagtd" align="right"><input type="submit" class="button" value="<?php echo $langs->trans("Add"); ?>"></div>
|
<div class="tagtd" align="right"><input type="submit" class="button" value="<?php echo $langs->trans("Add"); ?>"></div>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@ -77,7 +77,7 @@ if ($action == 'addcontact' && $user->rights->expedition->creer)
|
|||||||
{
|
{
|
||||||
if ($result > 0 && $id > 0)
|
if ($result > 0 && $id > 0)
|
||||||
{
|
{
|
||||||
$result = $objectsrc->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]);
|
$result = $objectsrc->add_contact(GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'), $_POST["type"], $_POST["source"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
@ -87,14 +87,15 @@ if ($action == 'addcontact' && $user->rights->expedition->creer)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($objectsrc->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
if ($objectsrc->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||||
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$mesg = $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType");
|
$mesg = $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType");
|
||||||
} else {
|
} else {
|
||||||
$mesg = $objectsrc->error;
|
$mesg = $objectsrc->error;
|
||||||
|
$mesgs = $objectsrc->errors;
|
||||||
}
|
}
|
||||||
|
setEventMessages($mesg, $mesgs, 'errors');
|
||||||
setEventMessage($mesg, 'errors');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,7 +237,6 @@ if ($id > 0 || ! empty($ref))
|
|||||||
// Lignes de contacts
|
// Lignes de contacts
|
||||||
echo '<br>';
|
echo '<br>';
|
||||||
|
|
||||||
|
|
||||||
// Contacts lines (modules that overwrite templates must declare this into descriptor)
|
// Contacts lines (modules that overwrite templates must declare this into descriptor)
|
||||||
$dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
|
$dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
|
||||||
foreach($dirtpls as $reldir)
|
foreach($dirtpls as $reldir)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user