diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index d29932c2c20..9a5a12be721 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -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); diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 5de9cda0342..bcbe53236c5 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -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 ''; + + // 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