| '.$langs->trans("ActionOnContact").' | ';
print ' ';
$form->select_contacts($object->socid, $object->contactid, 'contactid', 1, '', '', 0, 'minwidth200');
print ' ';
@@ -1199,27 +1209,61 @@ if ($id > 0)
$out.=''.$langs->trans("ViewDay").'';
$linkback.=$out;
- dol_banner_tab($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', '');
+
+ $morehtmlref='';
+ // Thirdparty
+ //$morehtmlref.=' '.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
+ // Project
+ if (! empty($conf->projet->enabled))
+ {
+ $langs->load("projects");
+ //$morehtmlref.=' '.$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.=' ' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : ';
+ if ($action == 'classify') {
+ //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
+ $morehtmlref.=' ';
+ } 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.=' ';
+ $morehtmlref.=$proj->ref;
+ $morehtmlref.='';
+ if ($proj->title) $morehtmlref.=' - '.$proj->title;
+ } else {
+ $morehtmlref.='';
+ }
+ }
+ }
+ $morehtmlref.=' ';
+
+
+ dol_banner_tab($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', $morehtmlref);
print '';
// Affichage fiche action en mode visu
print '';
- // Ref
- /*print '| '.$langs->trans("Ref").' | ';
- print $form->showrefnav($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', '');
- print ' | ';*/
-
// Type
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
{
print '| '.$langs->trans("Type").' | '.$object->type.' | ';
}
- // Title
- //print '| '.$langs->trans("Title").' | '.dol_htmlentities($object->label).' | ';
-
// Full day event
print '| '.$langs->trans("EventOnFullDay").' | '.yn($object->fulldayevent, 3).' | ';
@@ -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 '';
- // Status
- /*print '| '.$langs->trans("Status").' / '.$langs->trans("Percentage").' | ';
- print $object->getLibStatut(4);
- print ' | ';*/
-
// Location
if (empty($conf->global->AGENDA_DISABLE_LOCATION))
{
@@ -1302,14 +1341,14 @@ if ($id > 0)
print ' ';
- print '
';
+ print ' ';
print '';
- // Third party - Contact
if ($conf->societe->enabled)
{
- print '| '.$langs->trans("ActionOnCompany").' | '.($object->thirdparty->id?$object->thirdparty->getNomUrl(1):$langs->trans("None"));
+ // Related company
+ print ' | | '.$langs->trans("ActionOnCompany").' | '.($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))
@@ -1317,9 +1356,11 @@ if ($id > 0)
print " ".dol_print_phone($object->thirdparty->phone);
}
}
- print ' | ';
- print ''.$langs->trans("Contact").' | ';
- print '';
+ print ' | ';
+
+ // Related contact
+ print '| '.$langs->trans("ActionOnContact").' | ';
+ print '';
if ($object->contactid > 0)
{
print $object->contact->getNomUrl(1);
@@ -1333,12 +1374,13 @@ if ($id > 0)
}
else
{
- print $langs->trans("None");
+ print ''.$langs->trans("NoneOrSeveral").'';
}
print ' | ';
}
// Project
+ /*
if (! empty($conf->projet->enabled))
{
print '| '.$langs->trans("Project").' | ';
@@ -1350,7 +1392,8 @@ if ($id > 0)
}
print ' | ';
}
-
+ */
+
// Priority
print '| '.$langs->trans("Priority").' | ';
print ($object->priority?$object->priority:'');
diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php
index 4691673a831..241843623c2 100644
--- a/htdocs/comm/action/document.php
+++ b/htdocs/comm/action/document.php
@@ -140,27 +140,41 @@ if ($object->id > 0)
$linkback.=$out;
- dol_banner_tab($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', '');
+ $morehtmlref='';
+ // Thirdparty
+ //$morehtmlref.=' '.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
+ // Project
+ if (! empty($conf->projet->enabled))
+ {
+ $langs->load("projects");
+ //$morehtmlref.=' '.$langs->trans('Project') . ' ';
+ $morehtmlref.=$langs->trans('Project') . ': ';
+ if (! empty($object->fk_project)) {
+ $proj = new Project($db);
+ $proj->fetch($object->fk_project);
+ $morehtmlref.=' ';
+ $morehtmlref.=$proj->ref;
+ $morehtmlref.='';
+ if ($proj->title) $morehtmlref.=' - '.$proj->title;
+ } else {
+ $morehtmlref.='';
+ }
+ }
+ $morehtmlref.=' ';
+
+ dol_banner_tab($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', $morehtmlref);
print '';
// Affichage fiche action en mode visu
print '';
- // Ref
- /*print '| '.$langs->trans("Ref").' | ';
- print $form->showrefnav($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', '');
- print ' | ';*/
-
// Type
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
{
print '| '.$langs->trans("Type").' | '.$object->type.' | ';
}
- // Title
- //print '| '.$langs->trans("Title").' | '.$object->label.' | ';
-
// Full day event
print '| '.$langs->trans("EventOnFullDay").' | '.yn($object->fulldayevent, 3).' | ';
@@ -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 '';
- // Status
- /*print '| '.$langs->trans("Status").' / '.$langs->trans("Percentage").' | ';
- print $object->getLibStatut(4);
- print ' | ';*/
-
// Location
if (empty($conf->global->AGENDA_DISABLE_LOCATION))
{
@@ -227,71 +236,8 @@ if ($object->id > 0)
print ' ';
- print '
';
-
- print '';
-
- // Third party - Contact
- print '| '.$langs->trans("ActionOnCompany").' | '.($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 " ".dol_print_phone($object->thirdparty->phone);
- }
- }
- print ' | ';
- print ''.$langs->trans("Contact").' | ';
- print '';
- 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 " ".dol_print_phone($object->contact->phone_pro);
- }
- }
- }
- else
- {
- print $langs->trans("None");
- }
-
- print ' | ';
-
- // Project
- if (! empty($conf->projet->enabled))
- {
- print '| '.$langs->trans("Project").' | ';
- if ($object->fk_project)
- {
- $project=new Project($db);
- $project->fetch($object->fk_project);
- print $project->getNomUrl(1);
- }
- print ' | ';
- }
-
- // Priority
- print '| '.$langs->trans("Priority").' | ';
- print ($object->priority?$object->priority:'');
- print ' | ';
-
- // 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 ' ';
-
- print '
';
+ print ' ';
print '';
diff --git a/htdocs/comm/action/info.php b/htdocs/comm/action/info.php
index d1338142173..2ad3f424b12 100644
--- a/htdocs/comm/action/info.php
+++ b/htdocs/comm/action/info.php
@@ -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.='';
+// Thirdparty
+//$morehtmlref.=' '.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
+// Project
+if (! empty($conf->projet->enabled))
+{
+ $langs->load("projects");
+ //$morehtmlref.=' '.$langs->trans('Project') . ' ';
+ $morehtmlref.=$langs->trans('Project') . ': ';
+ if (! empty($object->fk_project)) {
+ $proj = new Project($db);
+ $proj->fetch($object->fk_project);
+ $morehtmlref.='';
+ $morehtmlref.=$proj->ref;
+ $morehtmlref.='';
+ if ($proj->title) $morehtmlref.=' - '.$proj->title;
+ } else {
+ $morehtmlref.='';
+ }
+}
+$morehtmlref.='';
+
+dol_banner_tab($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', $morehtmlref);
print '';
diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php
index aad57a90894..f403f526d46 100644
--- a/htdocs/core/actions_sendmails.inc.php
+++ b/htdocs/core/actions_sendmails.inc.php
@@ -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)
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 8bfda274d80..d6a1588acbe 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -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))
diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index acb7572ff7e..bdae838f61e 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -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.= "\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%");
}
}
diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php
index bce6cd02eee..a2501867b56 100644
--- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php
+++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php
@@ -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
diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang
index 705355c16b4..1452e078bed 100644
--- a/htdocs/langs/en_US/main.lang
+++ b/htdocs/langs/en_US/main.lang
@@ -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
diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php
index 14475c58203..a09e9d3db39 100644
--- a/htdocs/resource/element_resource.php
+++ b/htdocs/resource/element_resource.php
@@ -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='';
+ // Thirdparty
+ //$morehtmlref.=' '.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
+ // Project
+ if (! empty($conf->projet->enabled))
+ {
+ $langs->load("projects");
+ //$morehtmlref.=' '.$langs->trans('Project') . ' ';
+ $morehtmlref.=$langs->trans('Project') . ': ';
+ if (! empty($act->fk_project)) {
+ $proj = new Project($db);
+ $proj->fetch($act->fk_project);
+ $morehtmlref.=' ';
+ $morehtmlref.=$proj->ref;
+ $morehtmlref.='';
+ if ($proj->title) $morehtmlref.=' - '.$proj->title;
+ } else {
+ $morehtmlref.='';
+ }
+ }
+ $morehtmlref.=' ';
+
+ dol_banner_tab($act, 'element_id', $linkback, ($user->societe_id?0:1), 'id', 'ref', $morehtmlref, '&element='.$element, 0, '', '');
print '';
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index 656a886c13c..5aac6fdec85 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -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;
}
diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php
index 3da099390ac..79a8d9cae94 100644
--- a/htdocs/societe/soc.php
+++ b/htdocs/societe/soc.php
@@ -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;
| |