mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-09 01:12:33 +01:00
Adding sending mails on product
This commit is contained in:
@@ -115,6 +115,11 @@ if ($action == 'presend') {
|
||||
}
|
||||
if ($forcebuilddoc) { // If there is no default value for supplier invoice, we do not generate file, even if modelpdf was set by a manual generation
|
||||
if ((!$file || !is_readable($file)) && method_exists($object, 'generateDocument')) {
|
||||
|
||||
$hidedetails = $hidedetails?$hidedetails:'';
|
||||
$hidedesc = $hidedetails?$hidedetails:'';
|
||||
$hideref = $hidedetails?$hidedetails:'';
|
||||
|
||||
$result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if ($result < 0) {
|
||||
dol_print_error($db, $object->error, $object->errors);
|
||||
|
||||
@@ -1295,6 +1295,14 @@ if (empty($reshook)) {
|
||||
setEventMessages($langs->trans("WarningSelectOneDocument"), null, 'warnings');
|
||||
}
|
||||
}
|
||||
|
||||
// Actions to send emails
|
||||
$triggersendname = 'PRODUCT_SENTBYMAIL';
|
||||
$paramname = 'id';
|
||||
$autocopy = 'MAIN_MAIL_AUTOCOPY_PRODUCT_TO';
|
||||
$trackid = 'prod'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -3027,6 +3035,9 @@ if ($action != 'create' && $action != 'edit') {
|
||||
print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$object->id, '', $usercancreate);
|
||||
}
|
||||
|
||||
//Send
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init&token=' . newToken() . '#formmailbeforetitle');
|
||||
|
||||
if (!isset($hookmanager->resArray['no_button_copy']) || $hookmanager->resArray['no_button_copy'] != 1) {
|
||||
if (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) {
|
||||
$cloneProductUrl = '';
|
||||
@@ -3198,6 +3209,15 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete') {
|
||||
$somethingshown = $formactions->showactions($object, 'product', 0, 1, '', $MAXEVENT, '', $morehtmlcenter); // Show all action for product
|
||||
|
||||
print '</div></div>';
|
||||
|
||||
// Presend form
|
||||
$modelmail = 'product_send'; // Modèle d'e-mail pour les produits
|
||||
$defaulttopic = $object->label; // Sujet par défaut
|
||||
$diroutput = $conf->product->multidir_output[$object->entity]; // Répertoire de sortie
|
||||
$trackid = 'prod' . $object->id; // ID de suivi
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
||||
|
||||
}
|
||||
|
||||
// End of page
|
||||
|
||||
Reference in New Issue
Block a user