Several fix for a better management of #6424
This commit is contained in:
parent
24c2675705
commit
92d9eb3c5d
@ -146,6 +146,14 @@ if (GETPOST('addassignedtouser') || GETPOST('updateassignedtouser'))
|
||||
$listUserAssignedUpdated = true;
|
||||
}
|
||||
|
||||
// Link to a project
|
||||
if ($action == 'classin' && ($user->rights->agenda->allactions->create ||
|
||||
(($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create)))
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->setProject(GETPOST('projectid'));
|
||||
}
|
||||
|
||||
// Action clone object
|
||||
if ($action == 'confirm_clone' && $confirm == 'yes')
|
||||
{
|
||||
@ -577,6 +585,8 @@ if ($action == 'mupdate')
|
||||
* View
|
||||
*/
|
||||
|
||||
$formproject=new FormProjets($db);
|
||||
|
||||
$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
|
||||
llxHeader('',$langs->trans("Agenda"),$help_url);
|
||||
|
||||
@ -744,7 +754,7 @@ if ($action == 'create')
|
||||
print '<br><br>';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Societe, contact
|
||||
// Related company
|
||||
print '<tr><td class="titlefieldcreate nowrap">'.$langs->trans("ActionOnCompany").'</td><td>';
|
||||
if (GETPOST('socid','int') > 0)
|
||||
{
|
||||
@ -755,7 +765,6 @@ if ($action == 'create')
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$events=array();
|
||||
$events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php?showempty=1',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled'));
|
||||
//For external user force the company to user company
|
||||
@ -768,6 +777,7 @@ if ($action == 'create')
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Related contact
|
||||
print '<tr><td class="nowrap">'.$langs->trans("ActionOnContact").'</td><td>';
|
||||
$form->select_contacts(GETPOST('socid','int'), GETPOST('contactid'), 'contactid', 1, '', '', 0, 'minwidth200');
|
||||
print '</td></tr>';
|
||||
@ -1090,10 +1100,10 @@ if ($id > 0)
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Thirdparty - Contact
|
||||
if ($conf->societe->enabled)
|
||||
{
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("ActionOnCompany").'</td>';
|
||||
// Related company
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("ActionOnCompany").'</td>';
|
||||
print '<td>';
|
||||
print '<div class="maxwidth200onsmartphone">';
|
||||
$events=array(); // 'method'=parameter action of url, 'url'=url to call that return new list of contacts
|
||||
@ -1104,8 +1114,8 @@ if ($id > 0)
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Contact
|
||||
print '<tr><td>'.$langs->trans("Contact").'</td><td>';
|
||||
// related contact
|
||||
print '<tr><td>'.$langs->trans("ActionOnContact").'</td><td>';
|
||||
print '<div class="maxwidth200onsmartphone">';
|
||||
$form->select_contacts($object->socid, $object->contactid, 'contactid', 1, '', '', 0, 'minwidth200');
|
||||
print '</div>';
|
||||
@ -1199,27 +1209,61 @@ if ($id > 0)
|
||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewDay").'</a>';
|
||||
$linkback.=$out;
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', '');
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
// Thirdparty
|
||||
//$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
//$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
$morehtmlref.=$langs->trans('Project') . ' ';
|
||||
if ($user->rights->agenda->allactions->create ||
|
||||
(($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create))
|
||||
{
|
||||
if ($action != 'classify')
|
||||
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
if ($proj->title) $morehtmlref.=' - '.$proj->title;
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', $morehtmlref);
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
// Affichage fiche action en mode visu
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
/*print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print $form->showrefnav($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', '');
|
||||
print '</td></tr>';*/
|
||||
|
||||
// Type
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
{
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Type").'</td><td colspan="3">'.$object->type.'</td></tr>';
|
||||
}
|
||||
|
||||
// Title
|
||||
//print '<tr><td>'.$langs->trans("Title").'</td><td colspan="3">'.dol_htmlentities($object->label).'</td></tr>';
|
||||
|
||||
// Full day event
|
||||
print '<tr><td class="titlefield">'.$langs->trans("EventOnFullDay").'</td><td colspan="3">'.yn($object->fulldayevent, 3).'</td></tr>';
|
||||
|
||||
@ -1241,11 +1285,6 @@ if ($id > 0)
|
||||
if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now- $delay_warning)) print img_warning($langs->trans("Late"));
|
||||
print '</td></tr>';
|
||||
|
||||
// Status
|
||||
/*print '<tr><td class="nowrap">'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td><td colspan="3">';
|
||||
print $object->getLibStatut(4);
|
||||
print '</td></tr>';*/
|
||||
|
||||
// Location
|
||||
if (empty($conf->global->AGENDA_DISABLE_LOCATION))
|
||||
{
|
||||
@ -1302,14 +1341,14 @@ if ($id > 0)
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br><br>';
|
||||
print '<br>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Third party - Contact
|
||||
if ($conf->societe->enabled)
|
||||
{
|
||||
print '<tr><td class="titlefield">'.$langs->trans("ActionOnCompany").'</td><td>'.($object->thirdparty->id?$object->thirdparty->getNomUrl(1):$langs->trans("None"));
|
||||
// Related company
|
||||
print '<tr><td class="titlefield">'.$langs->trans("ActionOnCompany").'</td><td colspan="3">'.($object->thirdparty->id?$object->thirdparty->getNomUrl(1):('<span class="opacitymedium">'.$langs->trans("None").'</span>'));
|
||||
if (is_object($object->thirdparty) && $object->thirdparty->id > 0 && $object->type_code == 'AC_TEL')
|
||||
{
|
||||
if ($object->thirdparty->fetch($object->thirdparty->id))
|
||||
@ -1317,9 +1356,11 @@ if ($id > 0)
|
||||
print "<br>".dol_print_phone($object->thirdparty->phone);
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>'.$langs->trans("Contact").'</td>';
|
||||
print '<td>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Related contact
|
||||
print '<tr><td>'.$langs->trans("ActionOnContact").'</td>';
|
||||
print '<td colspan="3">';
|
||||
if ($object->contactid > 0)
|
||||
{
|
||||
print $object->contact->getNomUrl(1);
|
||||
@ -1333,12 +1374,13 @@ if ($id > 0)
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("None");
|
||||
print '<span class="opacitymedium">'.$langs->trans("NoneOrSeveral").'</span>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Project
|
||||
/*
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Project").'</td><td colspan="3">';
|
||||
@ -1350,7 +1392,8 @@ if ($id > 0)
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
// Priority
|
||||
print '<tr><td class="nowrap" class="titlefield">'.$langs->trans("Priority").'</td><td colspan="3">';
|
||||
print ($object->priority?$object->priority:'');
|
||||
|
||||
@ -140,27 +140,41 @@ if ($object->id > 0)
|
||||
|
||||
$linkback.=$out;
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', '');
|
||||
$morehtmlref='<div class="refidno">';
|
||||
// Thirdparty
|
||||
//$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
//$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
$morehtmlref.=$langs->trans('Project') . ': ';
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
if ($proj->title) $morehtmlref.=' - '.$proj->title;
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', $morehtmlref);
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
// Affichage fiche action en mode visu
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
/*print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print $form->showrefnav($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', '');
|
||||
print '</td></tr>';*/
|
||||
|
||||
// Type
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
{
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Type").'</td><td colspan="3">'.$object->type.'</td></tr>';
|
||||
}
|
||||
|
||||
// Title
|
||||
//print '<tr><td>'.$langs->trans("Title").'</td><td colspan="3">'.$object->label.'</td></tr>';
|
||||
|
||||
// Full day event
|
||||
print '<tr><td class="titlefield">'.$langs->trans("EventOnFullDay").'</td><td colspan="3">'.yn($object->fulldayevent, 3).'</td></tr>';
|
||||
|
||||
@ -179,11 +193,6 @@ if ($object->id > 0)
|
||||
if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now- $delay_warning)) print img_warning($langs->trans("Late"));
|
||||
print '</td></tr>';
|
||||
|
||||
// Status
|
||||
/*print '<tr><td class="nowrap">'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td><td colspan="2">';
|
||||
print $object->getLibStatut(4);
|
||||
print '</td></tr>';*/
|
||||
|
||||
// Location
|
||||
if (empty($conf->global->AGENDA_DISABLE_LOCATION))
|
||||
{
|
||||
@ -227,71 +236,8 @@ if ($object->id > 0)
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br><br>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
|
||||
// Third party - Contact
|
||||
print '<tr><td class="titlefield">'.$langs->trans("ActionOnCompany").'</td><td>'.($object->thirdparty->id?$object->thirdparty->getNomUrl(1):$langs->trans("None"));
|
||||
if (is_object($object->thirdparty) && $object->thirdparty->id > 0 && $object->type_code == 'AC_TEL')
|
||||
{
|
||||
if ($object->thirdparty->fetch($object->thirdparty->id))
|
||||
{
|
||||
print "<br>".dol_print_phone($object->thirdparty->phone);
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>'.$langs->trans("Contact").'</td>';
|
||||
print '<td>';
|
||||
if ($object->contact->id > 0)
|
||||
{
|
||||
print $object->contact->getNomUrl(1);
|
||||
if ($object->contact->id && $object->type_code == 'AC_TEL')
|
||||
{
|
||||
if ($object->contact->fetch($object->contact->id))
|
||||
{
|
||||
print "<br>".dol_print_phone($object->contact->phone_pro);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("None");
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Project").'</td><td colspan="3">';
|
||||
if ($object->fk_project)
|
||||
{
|
||||
$project=new Project($db);
|
||||
$project->fetch($object->fk_project);
|
||||
print $project->getNomUrl(1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Priority
|
||||
print '<tr><td class="nowrap">'.$langs->trans("Priority").'</td><td colspan="3">';
|
||||
print ($object->priority?$object->priority:'');
|
||||
print '</td></tr>';
|
||||
|
||||
// Other attributes
|
||||
$parameters=array('colspan'=>' colspan="3"', 'colspanvalue'=>'3', 'id'=>$object->id);
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
||||
{
|
||||
print $object->showOptionals($extrafields,'edit');
|
||||
}
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br><br>';
|
||||
print '<br>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
|
||||
@ -28,6 +28,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
if (! empty($conf->projet->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
|
||||
}
|
||||
|
||||
$langs->load("commercial");
|
||||
|
||||
@ -74,7 +78,29 @@ $out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.do
|
||||
|
||||
$linkback.=$out;
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', '');
|
||||
$morehtmlref='<div class="refidno">';
|
||||
// Thirdparty
|
||||
//$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
//$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
$morehtmlref.=$langs->trans('Project') . ': ';
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
if ($proj->title) $morehtmlref.=' - '.$proj->title;
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', $morehtmlref);
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
|
||||
@ -112,7 +112,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
{
|
||||
$result=$object->fetch($id);
|
||||
|
||||
$sendtosocid=0;
|
||||
$sendtosocid=0; // Thirdparty on object
|
||||
if (method_exists($object,"fetch_thirdparty") && $object->element != 'societe')
|
||||
{
|
||||
$result=$object->fetch_thirdparty();
|
||||
@ -123,7 +123,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
{
|
||||
$thirdparty=$object;
|
||||
if ($thirdparty->id > 0) $sendtosocid=$thirdparty->id;
|
||||
elseif($conf->dolimail->enabled)
|
||||
elseif (! empty($conf->dolimail->enabled))
|
||||
{
|
||||
$dolimail = new Dolimail($db);
|
||||
$possibleaccounts=$dolimail->get_societe_by_email($_POST['sendto'],"1");
|
||||
@ -160,52 +160,72 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
$sendto='';
|
||||
$sendtocc='';
|
||||
$sendtobcc='';
|
||||
$sendtoid = array();
|
||||
|
||||
// Define $sendto
|
||||
$receiver=$_POST['receiver'];
|
||||
$sendto_array=array();
|
||||
|
||||
if (! is_array($receiver))
|
||||
{
|
||||
if ($receiver == '-1') $receiver=array();
|
||||
else $receiver=array($receiver);
|
||||
}
|
||||
$tmparray=array();
|
||||
if (trim($_POST['sendto']))
|
||||
{
|
||||
// Recipient is provided into free text
|
||||
$sendto = trim($_POST['sendto']);
|
||||
$sendtoid = array();
|
||||
// Recipients are provided into free text
|
||||
$tmparray[] = trim($_POST['sendto']);
|
||||
}
|
||||
elseif (count($receiver)>0)
|
||||
if (count($receiver)>0)
|
||||
{
|
||||
foreach($receiver as $key=>$val) {
|
||||
foreach($receiver as $key=>$val)
|
||||
{
|
||||
// Recipient was provided from combo list
|
||||
if ($val == 'thirdparty') // Id of third party
|
||||
{
|
||||
$sendto_array[] = $thirdparty->name.' <'.$thirdparty->email.'>';
|
||||
$sendtoid = array();
|
||||
$tmparray[] = $thirdparty->name.' <'.$thirdparty->email.'>';
|
||||
}
|
||||
else // Id du contact
|
||||
{
|
||||
$sendto_array[] = $thirdparty->contact_get_property((int) $val,'email');
|
||||
$tmparray[] = $thirdparty->contact_get_property((int) $val,'email');
|
||||
$sendtoid[] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
if (count($sendto_array)>0) {
|
||||
$sendto=implode(',',$sendto_array);
|
||||
}
|
||||
}
|
||||
$sendto=implode(',',$tmparray);
|
||||
|
||||
// Define $sendtocc
|
||||
$receivercc=$_POST['receivercc'];
|
||||
if (! is_array($receivercc))
|
||||
{
|
||||
if ($receivercc == '-1') $receivercc=array();
|
||||
else $receivercc=array($receivercc);
|
||||
}
|
||||
$tmparray=array();
|
||||
if (trim($_POST['sendtocc']))
|
||||
{
|
||||
$sendtocc = trim($_POST['sendtocc']);
|
||||
$tmparray[] = trim($_POST['sendtocc']);
|
||||
}
|
||||
elseif ($_POST['receivercc'] != '-1')
|
||||
if (count($receivercc) > 0)
|
||||
{
|
||||
// Recipient was provided from combo list
|
||||
if ($_POST['receivercc'] == 'thirdparty') // Id of third party
|
||||
foreach($receivercc as $key=>$val)
|
||||
{
|
||||
$sendtocc = $thirdparty->name.' <'.$thirdparty->email.'>';
|
||||
}
|
||||
else // Id du contact
|
||||
{
|
||||
$sendtocc = $thirdparty->contact_get_property((int) $_POST['receivercc'],'email');
|
||||
// Recipient was provided from combo list
|
||||
if ($val == 'thirdparty') // Id of third party
|
||||
{
|
||||
$tmparray[] = $thirdparty->name.' <'.$thirdparty->email.'>';
|
||||
}
|
||||
else // Id du contact
|
||||
{
|
||||
$tmparray[] = $thirdparty->contact_get_property((int) $val,'email');
|
||||
//$sendtoid[] = $val; TODO Add also id of contact in CC ?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sendtocc=implode(',',$tmparray);
|
||||
|
||||
if (dol_strlen($sendto))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||
@ -233,6 +253,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
|
||||
$replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>';
|
||||
$message = $_POST['message'];
|
||||
|
||||
$sendtobcc= GETPOST('sendtoccc');
|
||||
if ($mode == 'emailfromproposal') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO));
|
||||
if ($mode == 'emailfromorder') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO));
|
||||
@ -348,46 +369,22 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
// Initialisation of datas
|
||||
if (is_object($object))
|
||||
{
|
||||
//multiple contact sends
|
||||
if (count($sendtoid) >0) {
|
||||
foreach($sendtoid as $val_id) {
|
||||
$object->socid = $sendtosocid; // To link to a company
|
||||
$object->sendtoid = $val_id; // To link to a contact/address
|
||||
$object->actiontypecode = $actiontypecode;
|
||||
$object->actionmsg = $actionmsg; // Long text
|
||||
$object->actionmsg2 = $actionmsg2; // Short text
|
||||
$object->trackid = $trackid;
|
||||
$object->fk_element = $object->id;
|
||||
$object->elementtype = $object->element;
|
||||
$object->socid = $sendtosocid; // To link to a company
|
||||
$object->sendtoid = $sendtoid; // To link to contacts/addresses. This is an array.
|
||||
$object->actiontypecode = $actiontypecode;
|
||||
$object->actionmsg = $actionmsg; // Long text
|
||||
$object->actionmsg2 = $actionmsg2; // Short text
|
||||
$object->trackid = $trackid;
|
||||
$object->fk_element = $object->id;
|
||||
$object->elementtype = $object->element;
|
||||
|
||||
// Call of triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($db);
|
||||
$result=$interface->run_triggers($trigger_name,$object,$user,$langs,$conf);
|
||||
if ($result < 0) {
|
||||
$error++; $errors=$interface->errors;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//Thirdparty send
|
||||
$object->socid = $sendtosocid; // To link to a company
|
||||
$object->sendtoid = 0; // To link to a contact/address
|
||||
$object->actiontypecode = $actiontypecode;
|
||||
$object->actionmsg = $actionmsg; // Long text
|
||||
$object->actionmsg2 = $actionmsg2; // Short text
|
||||
$object->trackid = $trackid;
|
||||
$object->fk_element = $object->id;
|
||||
$object->elementtype = $object->element;
|
||||
|
||||
// Call of triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($db);
|
||||
$result=$interface->run_triggers($trigger_name,$object,$user,$langs,$conf);
|
||||
if ($result < 0) {
|
||||
$error++; $errors=$interface->errors;
|
||||
}
|
||||
}
|
||||
// End call of triggers
|
||||
// Call of triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($db);
|
||||
$result=$interface->run_triggers($trigger_name,$object,$user,$langs,$conf);
|
||||
if ($result < 0) {
|
||||
$error++; $errors=$interface->errors;
|
||||
}
|
||||
}
|
||||
|
||||
if ($error)
|
||||
|
||||
@ -1395,9 +1395,18 @@ abstract class CommonObject
|
||||
}
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
if ($projectid) $sql.= ' SET fk_projet = '.$projectid;
|
||||
else $sql.= ' SET fk_projet = NULL';
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
if ($this->table_element == 'actioncomm')
|
||||
{
|
||||
if ($projectid) $sql.= ' SET fk_project = '.$projectid;
|
||||
else $sql.= ' SET fk_project = NULL';
|
||||
$sql.= ' WHERE id = '.$this->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($projectid) $sql.= ' SET fk_projet = '.$projectid;
|
||||
else $sql.= ' SET fk_projet = NULL';
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::setProject", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
|
||||
@ -521,10 +521,17 @@ class FormMail extends Form
|
||||
if (! empty($this->withto) && is_array($this->withto))
|
||||
{
|
||||
if (! empty($this->withtofree)) $out.= " ".$langs->trans("or")." ";
|
||||
$out.= $form->multiselectarray("receiver", $this->withto, GETPOST("receiver"), null, null, null,null, "90%");
|
||||
// multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time
|
||||
$tmparray = $this->withto;
|
||||
foreach($tmparray as $key => $val)
|
||||
{
|
||||
$tmparray[$key]=dol_htmlentities($tmparray[$key], null, 'UTF-8', true);
|
||||
}
|
||||
$out.= $form->multiselectarray("receiver", $tmparray, GETPOST("receiver"), null, null, null,null, "90%");
|
||||
}
|
||||
if (isset($this->withtosocid) && $this->withtosocid > 0) // deprecated. TODO Remove this. Instead, fill withto with array before calling method.
|
||||
{
|
||||
dol_syslog("get_form was called with a deprecated way: ->withtosocid must not be defined, only ->withto", LOG_WARNING);
|
||||
$liste=array();
|
||||
$soc=new Societe($this->db);
|
||||
$soc->fetch($this->withtosocid);
|
||||
@ -533,6 +540,12 @@ class FormMail extends Form
|
||||
$liste[$key]=$value;
|
||||
}
|
||||
if ($this->withtofree) $out.= " ".$langs->trans("or")." ";
|
||||
// multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time
|
||||
$tmparray = $liste;
|
||||
foreach($tmparray as $key => $val)
|
||||
{
|
||||
$tmparray[$key]=dol_htmlentities($tmparray[$key], null, 'UTF-8', true);
|
||||
}
|
||||
$out.= $form->multiselectarray("receiver", $liste, GETPOST("receiver"), null, null, null,null, "90%");
|
||||
}
|
||||
}
|
||||
@ -555,7 +568,14 @@ class FormMail extends Form
|
||||
if (! empty($this->withtocc) && is_array($this->withtocc))
|
||||
{
|
||||
$out.= " ".$langs->trans("or")." ";
|
||||
$out.= $form->selectarray("receivercc", $this->withtocc, GETPOST("receivercc"), 1, 0, 0, '', 0, 0, 0, '', '', 0, '', $disablebademails);
|
||||
// multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time
|
||||
$tmparray = $this->withtocc;
|
||||
foreach($tmparray as $key => $val)
|
||||
{
|
||||
$tmparray[$key]=dol_htmlentities($tmparray[$key], null, 'UTF-8', true);
|
||||
}
|
||||
//$out.= $form->selectarray("receivercc", $this->withtocc, GETPOST("receivercc"), 1, 0, 0, '', 0, 0, 0, '', '', 0, '', $disablebademails);
|
||||
$out.= $form->multiselectarray("receivercc", $tmparray, GETPOST("receivercc"), null, null, null,null, "90%");
|
||||
}
|
||||
}
|
||||
$out.= "</td></tr>\n";
|
||||
@ -577,7 +597,14 @@ class FormMail extends Form
|
||||
if (! empty($this->withtoccc) && is_array($this->withtoccc))
|
||||
{
|
||||
$out.= " ".$langs->trans("or")." ";
|
||||
$out.= $form->selectarray("receiverccc", $this->withtoccc, GETPOST("receiverccc"), 1);
|
||||
// multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time
|
||||
$tmparray = $this->withtoccc;
|
||||
foreach($tmparray as $key => $val)
|
||||
{
|
||||
$tmparray[$key]=dol_htmlentities($tmparray[$key], null, 'UTF-8', true);
|
||||
}
|
||||
//$out.= $form->selectarray("receiverccc", $this->withtoccc, GETPOST("receiverccc"), 1);
|
||||
$out.= $form->multiselectarray("receiverccc", $tmparray, GETPOST("receiverccc"), null, null, null,null, "90%");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
* $object->actiontypecode (translation action code: AC_OTH, ...)
|
||||
* $object->actionmsg (note, long text)
|
||||
* $object->actionmsg2 (label, short text)
|
||||
* $object->sendtoid (id of contact)
|
||||
* $object->sendtoid (id of contact or array of ids)
|
||||
* $object->socid
|
||||
* $object->fk_project
|
||||
* $object->fk_element
|
||||
@ -819,7 +819,16 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
$contactforaction=new Contact($this->db);
|
||||
$societeforaction=new Societe($this->db);
|
||||
if ($object->sendtoid > 0) $contactforaction->fetch($object->sendtoid);
|
||||
// Set contactforaction if there is only 1 contact.
|
||||
if (is_array($object->sendtoid))
|
||||
{
|
||||
if (count($object->sendtoid) == 1) $contactforaction->fetch(reset($object->sendtoid));
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($object->sendtoid > 0) $contactforaction->fetch($object->sendtoid);
|
||||
}
|
||||
// Set societeforaction.
|
||||
if ($object->socid > 0) $societeforaction->fetch($object->socid);
|
||||
|
||||
// Insertion action
|
||||
|
||||
@ -453,6 +453,7 @@ NextStep=Next step
|
||||
Datas=Data
|
||||
None=None
|
||||
NoneF=None
|
||||
NoneOrSeveral=None or several
|
||||
Late=Late
|
||||
LateDesc=Delay to define if a record is late or not depends on your setup. Ask your admin to change delay from menu Home - Setup - Alerts.
|
||||
Photo=Picture
|
||||
|
||||
@ -31,6 +31,10 @@ if (! $res) die("Include of main fails");
|
||||
require_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
|
||||
if (! empty($conf->projet->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
|
||||
}
|
||||
|
||||
// Load traductions files requiredby by page
|
||||
$langs->load("resource");
|
||||
@ -212,7 +216,29 @@ else
|
||||
|
||||
$linkback.=$out;
|
||||
|
||||
dol_banner_tab($act, 'element_id', $linkback, ($user->societe_id?0:1), 'id', 'ref', '', '&element='.$element, 0, '', '');
|
||||
$morehtmlref='<div class="refidno">';
|
||||
// Thirdparty
|
||||
//$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
//$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
$morehtmlref.=$langs->trans('Project') . ': ';
|
||||
if (! empty($act->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($act->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $act->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
if ($proj->title) $morehtmlref.=' - '.$proj->title;
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
dol_banner_tab($act, 'element_id', $linkback, ($user->societe_id?0:1), 'id', 'ref', $morehtmlref, '&element='.$element, 0, '', '');
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
|
||||
@ -2026,8 +2026,9 @@ class Societe extends CommonObject
|
||||
if ($this->email && $addthirdparty)
|
||||
{
|
||||
if (empty($this->name)) $this->name=$this->nom;
|
||||
$contact_emails['thirdparty']=$langs->trans("ThirdParty").': '.dol_trunc($this->name,16)." (".$this->email.")";
|
||||
$contact_emails['thirdparty']=$langs->trans("ThirdParty").': '.dol_trunc($this->name,16)." <".$this->email.">";
|
||||
}
|
||||
//var_dump($contact_emails)
|
||||
return $contact_emails;
|
||||
}
|
||||
|
||||
|
||||
@ -2447,7 +2447,7 @@ else
|
||||
$liste=array();
|
||||
foreach ($object->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value;
|
||||
$formmail->withto=GETPOST('sendto')?GETPOST('sendto'):$liste;
|
||||
$formmail->withtofree=0;
|
||||
$formmail->withtofree=1;
|
||||
$formmail->withtocc=$liste;
|
||||
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
|
||||
$formmail->withfile=2;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user