From e254b256fcb5bc18f95a3ce02bcfacdb4ebe328e Mon Sep 17 00:00:00 2001 From: ATM-Lucas Date: Fri, 24 Jan 2025 14:14:57 +0100 Subject: [PATCH] Ajout backport v22 mail depuis produit --- ChangeLogWeneos.md | 4 ++++ htdocs/core/tpl/card_presend.tpl.php | 6 ++++++ htdocs/product/card.php | 25 +++++++++++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/ChangeLogWeneos.md b/ChangeLogWeneos.md index 2b7dbc627d1ed..3acfa66e8e173 100644 --- a/ChangeLogWeneos.md +++ b/ChangeLogWeneos.md @@ -1,3 +1,7 @@ NEW : Backport d'un développement proposé dans le standard en develop (22.0) * https://github.com/Dolibarr/dolibarr/pull/32689 * A supprimer lors du passage en, 22.0 si le développement est mergé dans le standard + + * https://github.com/Dolibarr/dolibarr/pull/32773 + * Ajout de la possibilité d'envoyer un mail depuis un produit/service + * A supprimer lors du passage en, 22.0 si le développement est mergé dans le standard diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index 50efa0e961206..1a87ebc811fa5 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -102,6 +102,12 @@ } 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')) { + // START BACKPORT WENEOS - A SUPP EN V22.0 + $hidedetails = $hidedetails?$hidedetails:''; + $hidedesc = $hidedetails?$hidedetails:''; + $hideref = $hidedetails?$hidedetails:''; + // END BACKPORT WENEOS - A SUPP EN V22.0 + $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 c4dc0d6dcbe55..521b357c58f23 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1224,6 +1224,15 @@ setEventMessages($langs->trans("WarningSelectOneDocument"), null, 'warnings'); } } + + // START BACKPORT WENEOS - A SUPP EN V22.0 + // 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'; + // END BACKPORT WENEOS - A SUPP EN V22.0 } @@ -2831,6 +2840,11 @@ print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$object->id, '', $usercancreate); } + // START BACKPORT WENEOS - A SUPP EN V22.0 + //Send + print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init&token=' . newToken() . '#formmailbeforetitle'); + // END BACKPORT WENEOS - A SUPP EN V22.0 + if (!isset($object->no_button_copy) || $object->no_button_copy <> 1) { if (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) { $cloneProductUrl = ''; @@ -2998,6 +3012,17 @@ $somethingshown = $formactions->showactions($object, 'product', 0, 1, '', $MAXEVENT, '', $morehtmlcenter); // Show all action for product print ''; + + + // START BACKPORT WENEOS - A SUPP EN V22.0 + // 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 BACKPORT WENEOS - A SUPP EN V22.0 } // End of page