diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php
index 3a53fad67a8..633fcd1a10a 100644
--- a/htdocs/contact/list.php
+++ b/htdocs/contact/list.php
@@ -778,7 +778,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
// List of mass actions available
$arrayofmassactions = array(
-// 'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
+ 'presend' => img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
// 'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
);
//if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php
index 74852da84f7..23c2159bc8f 100644
--- a/htdocs/core/actions_massactions.inc.php
+++ b/htdocs/core/actions_massactions.inc.php
@@ -93,11 +93,11 @@ if (!$error && $massaction == 'confirm_presend') {
$objecttmp = new $objectclass($db);
if ($objecttmp->element == 'expensereport') {
$thirdparty = new User($db);
- }
- if ($objecttmp->element == 'partnership' && getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') == 'member') {
+ } elseif ($objecttmp->element == 'contact') {
+ $thirdparty = new Contact($db);
+ } elseif ($objecttmp->element == 'partnership' && getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') == 'member') {
$thirdparty = new Adherent($db);
- }
- if ($objecttmp->element == 'holiday') {
+ } elseif ($objecttmp->element == 'holiday') {
$thirdparty = new User($db);
}
@@ -110,14 +110,13 @@ if (!$error && $massaction == 'confirm_presend') {
$thirdpartyid = ($objecttmp->fk_soc ? $objecttmp->fk_soc : $objecttmp->socid);
if ($objecttmp->element == 'societe') {
$thirdpartyid = $objecttmp->id;
- }
- if ($objecttmp->element == 'expensereport') {
+ } elseif ($objecttmp->element == 'contact') {
+ $thirdpartyid = $objecttmp->id;
+ } elseif ($objecttmp->element == 'expensereport') {
$thirdpartyid = $objecttmp->fk_user_author;
- }
- if ($objecttmp->element == 'partnership' && getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') == 'member') {
+ } elseif ($objecttmp->element == 'partnership' && getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') == 'member') {
$thirdpartyid = $objecttmp->fk_member;
- }
- if ($objecttmp->element == 'holiday') {
+ } elseif ($objecttmp->element == 'holiday') {
$thirdpartyid = $objecttmp->fk_user;
}
if (empty($thirdpartyid)) {
@@ -268,6 +267,10 @@ if (!$error && $massaction == 'confirm_presend') {
$fuser = new User($db);
$fuser->fetch($objectobj->fk_user_author);
$sendto = $fuser->email;
+ } elseif ($objectobj->element == 'contact') {
+ $fcontact = new Contact($db);
+ $fcontact->fetch($objectobj->id);
+ $sendto = $fcontact->email;
} elseif ($objectobj->element == 'partnership' && getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') == 'member') {
$fadherent = new Adherent($db);
$fadherent->fetch($objectobj->fk_member);
@@ -510,31 +513,28 @@ if (!$error && $massaction == 'confirm_presend') {
$trackid = 'thi'.$thirdparty->id;
if ($objecttmp->element == 'expensereport') {
$trackid = 'use'.$thirdparty->id;
- }
- if ($objecttmp->element == 'holiday') {
+ } elseif ($objecttmp->element == 'contact') {
+ $trackid = 'ctc'.$thirdparty->id;
+ } elseif ($objecttmp->element == 'holiday') {
$trackid = 'use'.$thirdparty->id;
}
} else {
$trackid = strtolower(get_class($objecttmp));
- if (get_class($objecttmp) == 'Contrat') {
+ if (get_class($objecttmp) == 'Contact') {
+ $trackid = 'ctc';
+ } elseif (get_class($objecttmp) == 'Contrat') {
$trackid = 'con';
- }
- if (get_class($objecttmp) == 'Propal') {
+ } elseif (get_class($objecttmp) == 'Propal') {
$trackid = 'pro';
- }
- if (get_class($objecttmp) == 'Commande') {
+ } elseif (get_class($objecttmp) == 'Commande') {
$trackid = 'ord';
- }
- if (get_class($objecttmp) == 'Facture') {
+ } elseif (get_class($objecttmp) == 'Facture') {
$trackid = 'inv';
- }
- if (get_class($objecttmp) == 'Supplier_Proposal') {
+ } elseif (get_class($objecttmp) == 'Supplier_Proposal') {
$trackid = 'spr';
- }
- if (get_class($objecttmp) == 'CommandeFournisseur') {
+ } elseif (get_class($objecttmp) == 'CommandeFournisseur') {
$trackid = 'sor';
- }
- if (get_class($objecttmp) == 'FactureFournisseur') {
+ } elseif (get_class($objecttmp) == 'FactureFournisseur') {
$trackid = 'sin';
}
diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php
index 5124a1dce35..ad46d605f33 100644
--- a/htdocs/core/tpl/massactions_pre.tpl.php
+++ b/htdocs/core/tpl/massactions_pre.tpl.php
@@ -167,8 +167,9 @@ if ($massaction == 'presend') {
$thirdpartyid = ($objecttmp->fk_soc ? $objecttmp->fk_soc : $objecttmp->socid); // For proposal, order, invoice, conferenceorbooth, ...
if (in_array($objecttmp->element, array('societe', 'conferenceorboothattendee'))) {
$thirdpartyid = $objecttmp->id;
- }
- if ($objecttmp->element == 'expensereport') {
+ } elseif ($objecttmp->element == 'contact') {
+ $thirdpartyid = $objecttmp->id;
+ } elseif ($objecttmp->element == 'expensereport') {
$thirdpartyid = $objecttmp->fk_user_author;
}
if (empty($thirdpartyid)) {
@@ -205,6 +206,10 @@ if ($massaction == 'presend') {
$fuser = new User($db);
$fuser->fetch($thirdpartyid);
$liste['thirdparty'] = $fuser->getFullName($langs)." <".$fuser->email.">";
+ } elseif ($objecttmp->element == 'contact') {
+ $fcontact = new Contact($db);
+ $fcontact->fetch($thirdpartyid);
+ $liste['contact'] = $fcontact->getFullName($langs)." <".$fcontact->email.">";
} elseif ($objecttmp->element == 'partnership' && getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') == 'member') {
$fadherent = new Adherent($db);
$fadherent->fetch($objecttmp->fk_member);
@@ -236,17 +241,23 @@ if ($massaction == 'presend') {
} else {
$formmail->withtopic = 1;
}
- $formmail->withfile = 1; // $formmail->withfile = 2 to allow to upload files is not yet supported in mass action
- // Add a checkbox "Attach also main document"
- if (isset($withmaindocfilemail)) {
- $formmail->withmaindocfile = $withmaindocfilemail;
- } else { // Do an automatic definition of $formmail->withmaindocfile
- $formmail->withmaindocfile = 1;
- if ($objecttmp->element != 'societe') {
- $formmail->withfile = ''.$langs->trans("OnlyPDFattachmentSupported").'';
- $formmail->withmaindocfile = -1; // Add a checkbox "Attach also main document" but not checked by default
+ if ($objecttmp->element == 'contact') {
+ $formmail->withfile = 0;
+ $formmail->withmaindocfile = 0; // Add a checkbox "Attach also main document"
+ } else {
+ $formmail->withfile = 1; // $formmail->withfile = 2 to allow to upload files is not yet supported in mass action
+ // Add a checkbox "Attach also main document"
+ if (isset($withmaindocfilemail)) {
+ $formmail->withmaindocfile = $withmaindocfilemail;
+ } else { // Do an automatic definition of $formmail->withmaindocfile
+ $formmail->withmaindocfile = 1;
+ if ($objecttmp->element != 'societe') {
+ $formmail->withfile = '' . $langs->trans("OnlyPDFattachmentSupported") . '';
+ $formmail->withmaindocfile = -1; // Add a checkbox "Attach also main document" but not checked by default
+ }
}
}
+
$formmail->withbody = 1;
$formmail->withdeliveryreceipt = 1;
$formmail->withcancel = 1;