mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Merge pull request #32773 from atm-lucasmantegari/NEW/Adding_Products_Mails
NEW Can send mails from product
This commit is contained in:
commit
df4c9fe250
|
|
@ -252,6 +252,9 @@ if (isModEnabled('eventorganization') && $user->hasRight('eventorganization', 'r
|
|||
if (isModEnabled('partnership') && $user->hasRight('partnership', 'read')) {
|
||||
$elementList['partnership_send'] = img_picto('', 'partnership', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToPartnership'));
|
||||
}
|
||||
if (isModEnabled('product') && !empty($user->rights->produit->lire)) {
|
||||
$elementList['product_send'] = img_picto('', 'product', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('Product'));
|
||||
}
|
||||
|
||||
$parameters = array('elementList' => $elementList);
|
||||
$reshook = $hookmanager->executeHooks('emailElementlist', $parameters); // Note that $action and $object may have been modified by some hooks
|
||||
|
|
|
|||
|
|
@ -624,7 +624,7 @@ class FormMail extends Form
|
|||
} elseif (!empty($this->param['models']) && in_array($this->param['models'], array(
|
||||
'propal_send', 'order_send', 'facture_send',
|
||||
'shipping_send', 'fichinter_send', 'supplier_proposal_send', 'order_supplier_send',
|
||||
'invoice_supplier_send', 'thirdparty', 'contract', 'user', 'recruitmentcandidature_send', 'all'
|
||||
'invoice_supplier_send', 'thirdparty', 'contract', 'user', 'recruitmentcandidature_send', 'product_send', 'all'
|
||||
))) {
|
||||
// If list of template is empty
|
||||
$out .= '<div class="center" style="padding: 0px 0 12px 0">'."\n";
|
||||
|
|
|
|||
|
|
@ -123,6 +123,10 @@ 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);
|
||||
|
|
|
|||
|
|
@ -1312,6 +1312,13 @@ 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';
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -3044,6 +3051,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 = '';
|
||||
|
|
@ -3183,6 +3193,10 @@ if (getDolGlobalString('PRODUCT_ADD_FORM_ADD_TO') && $object->id && ($action ==
|
|||
* Generated documents
|
||||
*/
|
||||
|
||||
if (GETPOST('modelselected')) {
|
||||
$action = 'presend';
|
||||
}
|
||||
|
||||
if ($action != 'create' && $action != 'edit' && $action != 'delete') {
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
print '<a name="builddoc"></a>'; // ancre
|
||||
|
|
@ -3215,6 +3229,14 @@ 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';
|
||||
$defaulttopic = $object->label;
|
||||
$diroutput = $conf->product->multidir_output[$object->entity];
|
||||
$trackid = 'prod' . $object->id;
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
||||
}
|
||||
|
||||
// End of page
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user