Merge pull request #7969 from marcosgdf/bug-4875
FIX #4875 Remove external module code from Dolibarr core code - Introduce hook initSendToSocid instead
This commit is contained in:
commit
6cb0793d14
@ -129,38 +129,14 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
|||||||
{
|
{
|
||||||
$thirdparty=$object;
|
$thirdparty=$object;
|
||||||
if ($thirdparty->id > 0) $sendtosocid=$thirdparty->id;
|
if ($thirdparty->id > 0) $sendtosocid=$thirdparty->id;
|
||||||
elseif (! empty($conf->dolimail->enabled))
|
|
||||||
{
|
|
||||||
$dolimail = new Dolimail($db);
|
|
||||||
$possibleaccounts=$dolimail->get_societe_by_email($_POST['sendto'],"1");
|
|
||||||
$possibleuser=$dolimail->get_from_user_by_mail($_POST['sendto'],"1"); // suche in llx_societe and socpeople
|
|
||||||
if (!$possibleaccounts && !$possibleuser)
|
|
||||||
{
|
|
||||||
setEventMessages($langs->trans('ErrorFailedToFindSocieteRecord',$_POST['sendto']), null, 'errors');
|
|
||||||
}
|
|
||||||
elseif (count($possibleaccounts)>1)
|
|
||||||
{
|
|
||||||
$sendtosocid=$possibleaccounts[1]['id'];
|
|
||||||
$result=$object->fetch($sendtosocid);
|
|
||||||
|
|
||||||
setEventMessages($langs->trans('ErrorFoundMoreThanOneRecordWithEmail',$_POST['sendto'],$object->name), null, 'mesgs');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if($possibleaccounts){
|
|
||||||
$sendtosocid=$possibleaccounts[1]['id'];
|
|
||||||
$result=$object->fetch($sendtosocid);
|
|
||||||
}elseif($possibleuser){
|
|
||||||
$sendtosocid=$possibleuser[0]['id'];
|
|
||||||
|
|
||||||
$result=$uobject->fetch($sendtosocid);
|
|
||||||
$object=$uobject;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else dol_print_error('','Use actions_sendmails.in.php for an element/object that is not supported');
|
else dol_print_error('','Use actions_sendmails.in.php for an element/object that is not supported');
|
||||||
|
|
||||||
|
if (is_object($hookmanager))
|
||||||
|
{
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('initSendToSocid',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else $thirdparty = $mysoc;
|
else $thirdparty = $mysoc;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user