foreach ($contactarr as $contact) { if ($contact['libelle'] == $langs->trans('TypeContact_facture_external_BILLING')) { // TODO Use code and not label require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; $contactstatic = new Contact($db); $contactstatic->fetch($contact['id']); $custcontact = $contactstatic->getFullName($langs, 1); } } if (!empty($custcontact)) { $formmail->substit['__CONTACTCIVNAME__'] = $custcontact; } } // Tableau des parametres complementaires du post $formmail->param['action'] = $action; $formmail->param['models'] = $modelmail; $formmail->param['models_id'] = GETPOST('modelmailselected', 'int'); $formmail->param['facid'] = $object->id; $formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id; // Init list of files if (GETPOST("mode") == 'init') { $formmail->clear_attached_files(); $formmail->add_attached_files($file, basename($file), dol_mimetype($file)); } print $formmail->get_form(); dol_fiche_end(); } } } llxFooter(); $db->close();
$formmail->withto = !empty($_POST['sendto']) ? $_POST['sendto'] : ($user->email ? $user->email : 1); $formmail->withtocc = !empty($_POST['sendtocc']) ? $_POST['sendtocc'] : 1; // ! empty to keep field if empty $formmail->withtoccc = !empty($_POST['sendtoccc']) ? $_POST['sendtoccc'] : 1; // ! empty to keep field if empty $formmail->withtopic = isset($_POST['subject']) ? $_POST['subject'] : $langs->trans("Test"); $formmail->withtopicreadonly = 0; $formmail->withfile = 2; $formmail->withbody = isset($_POST['message']) ? $_POST['message'] : ($action == 'testhtml' ? $langs->transnoentities("PredefinedMailTestHtml") : $langs->transnoentities("PredefinedMailTest")); $formmail->withbodyreadonly = 0; $formmail->withcancel = 1; $formmail->withdeliveryreceipt = 1; $formmail->withfckeditor = $action == 'testhtml' ? 1 : 0; $formmail->ckeditortoolbar = 'dolibarr_mailings'; // Tableau des substitutions $formmail->substit = $substitutionarrayfortest; // Tableau des parametres complementaires du post $formmail->param["action"] = $action == 'testhtml' ? "sendhtml" : "send"; $formmail->param["models"] = "body"; $formmail->param["mailid"] = 0; $formmail->param["returnurl"] = $_SERVER["PHP_SELF"]; // Init list of files if (GETPOST("mode") == 'init') { $formmail->clear_attached_files(); } print $formmail->get_form($action == 'testhtml' ? 'addfilehtml' : 'addfile', $action == 'testhtml' ? 'removefilehtml' : 'removefile'); print '<br>'; } } llxFooter(); $db->close();