NEW ADD Send mail for reception / Delivery (#34829)

* Send mail for reception

* back pre-commit

* empty reshook
This commit is contained in:
atm-GregM
2025-07-31 21:59:35 +02:00
committed by GitHub
parent 94ec228978
commit e081e3be33
6 changed files with 55 additions and 18 deletions

View File

@@ -219,6 +219,7 @@ if (isModEnabled('invoice') && $user->hasRight('facture', 'lire')) {
}
if (isModEnabled("shipping")) {
$elementList['shipping_send'] = img_picto('', 'dolly', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendShipment'));
$elementList['reception_send'] = img_picto('', 'dolly', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendReception'));
}
if (isModEnabled("reception")) {
$elementList['reception_send'] = img_picto('', 'dollyrevert', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendReception'));

View File

@@ -626,7 +626,7 @@ class FormMail extends Form
$out .= '</div>';
} 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',
'shipping_send', 'reception_send', 'fichinter_send', 'supplier_proposal_send', 'order_supplier_send',
'invoice_supplier_send', 'thirdparty', 'contract', 'user', 'recruitmentcandidature_send', 'product_send', 'all'
))) {
// If list of template is empty
@@ -1818,6 +1818,8 @@ class FormMail extends Form
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendSupplierInvoice");
} elseif ($type_template == 'shipping_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendShipping");
} elseif ($type_template == 'reception_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendReception");
} elseif ($type_template == 'fichinter_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendFichInter");
} elseif ($type_template == 'actioncomm_send') {

View File

@@ -282,6 +282,15 @@ include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
// Actions to send emails
$triggersendname = 'RECEPTION_SENTBYMAIL';
$paramname = 'id';
$autocopy = 'MAIN_MAIL_AUTOCOPY_RECEPTION_TO';
$mode = 'emailfromreception';
$trackid = 'bl' . $object->id;
include DOL_DOCUMENT_ROOT . '/core/actions_sendmails.inc.php';
/*
* View
@@ -681,8 +690,10 @@ if ($action == 'create') {
print dolGetButtonAction('', $langs->trans('Validate'), 'default', $_SERVER["PHP_SELF"].'?action=valid&amp;token='.newToken().'&amp;id='.$object->id, '');
}
}
if ($user->hasRight('expedition', 'delivery', 'supprimer')) {
if ($user->hasRight('expedition', 'delivery', 'supprimer') && $action != 'presend') {
if ($object->status == Delivery::STATUS_VALIDATED && $action != 'presend' && $expedition->status == Expedition::STATUS_VALIDATED) {
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?action=presend&token='.newToken().'&id='.$object->id.'&mode=init#formmailbeforetitle', '');
}
if (getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION')) {
print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;expid='.$object->origin_id.'&amp;action=delete&amp;token='.newToken().'&amp;backtopage='.urlencode(DOL_URL_ROOT.'/expedition/card.php?id='.$object->origin_id), '');
} else {
@@ -699,26 +710,28 @@ if ($action == 'create') {
/*
* Documents generated
*/
if ($action != 'presend') {
$objectref = dol_sanitizeFileName($object->ref);
$filedir = $conf->expedition->dir_output."/receipt/".$objectref;
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
$objectref = dol_sanitizeFileName($object->ref);
$filedir = $conf->expedition->dir_output."/receipt/".$objectref;
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
$genallowed = $user->hasRight('expedition', 'delivery', 'lire');
$delallowed = $user->hasRight('expedition', 'delivery', 'creer');
$genallowed = $user->hasRight('expedition', 'delivery', 'lire');
$delallowed = $user->hasRight('expedition', 'delivery', 'creer');
print $formfile->showdocuments('delivery', $objectref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
print $formfile->showdocuments('delivery', $objectref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
/*
* Linked object block (of linked shipment)
*/
/*
* Linked object block (of linked shipment)
*/
if ($object->origin == 'expedition') {
$shipment = new Expedition($db);
$shipment->fetch($object->origin_id);
// Show links to link elements
print '</div><div class="fichehalfright">';
// Show links to link elements
//$tmparray = $form->showLinkToObjectBlock($object, null, array('order'), 1);
$somethingshown = $form->showLinkedObjectBlock($object, '');
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
//$tmparray = $form->showLinkToObjectBlock($object, null, array('order'), 1);
$somethingshown = $form->showLinkedObjectBlock($object, '');
}
@@ -735,6 +748,22 @@ if ($action == 'create') {
/* Expedition non trouvee */
print "Expedition inexistante ou access refuse";
}
/*
* Action presend
*/
//Select mail models is same action as presend
if (GETPOST('modelselected')) {
$action = 'presend';
}
// Presend form
$modelmail = 'reception_send';
$defaulttopic = 'SendReceptionRef';
$diroutput = $conf->expedition->dir_output.'/receipt';
$trackid = 'bl'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
}
// End of page

View File

@@ -80,6 +80,7 @@ Notify_FICHINTER_SENTBYMAIL=Intervention sent by mail
Notify_SHIPPING_MODIFY=Shipping modified
Notify_SHIPPING_VALIDATE=Shipping validated
Notify_SHIPPING_SENTBYMAIL=Shipping sent by mail
Notify_RECEPTION_SENTBYMAIL=Reception sent by mail
Notify_MEMBER_VALIDATE=Member validated
Notify_MEMBER_MODIFY=Member modified
Notify_MEMBER_SUBSCRIPTION=Member subscribed
@@ -112,6 +113,7 @@ PredefinedMailContentSendOrder=__(Hello)__\n\nPlease find order __REF__ attached
PredefinedMailContentSendSupplierOrder=__(Hello)__\n\nPlease find our order __REF__ attached\n\n\n__(Sincerely)__\n\n__SENDEREMAIL_SIGNATURE__
PredefinedMailContentSendSupplierInvoice=__(Hello)__\n\nPlease find invoice __REF__ attached\n\n\n__(Sincerely)__\n\n__SENDEREMAIL_SIGNATURE__
PredefinedMailContentSendShipping=__(Hello)__\n\nPlease find shipping __REF__ attached\n\n\n__(Sincerely)__\n\n__SENDEREMAIL_SIGNATURE__
PredefinedMailContentSendReception=__(Hello)__\n\nPlease find reception __REF__ attached\n\n\n__(Sincerely)__\n\n__SENDEREMAIL_SIGNATURE__
PredefinedMailContentSendFichInter=__(Hello)__\n\nPlease find intervention __REF__ attached\n\n\n__(Sincerely)__\n\n__SENDEREMAIL_SIGNATURE__
PredefinedMailContentLink=You can click on the link below to make your payment if it is not already done.\n\n%s\n\n
PredefinedMailContentGeneric=__(Hello)__\n\n\n__(Sincerely)__\n\n__SENDEREMAIL_SIGNATURE__

View File

@@ -80,6 +80,7 @@ Notify_FICHINTER_SENTBYMAIL=Envoi fiche d'intervention par email
Notify_SHIPPING_MODIFY=Expédition modifiée
Notify_SHIPPING_VALIDATE=Validation expédition
Notify_SHIPPING_SENTBYMAIL=Envoi expédition par email
Notify_RECEPTION_SENTBYMAIL=Envoi réception par email
Notify_MEMBER_VALIDATE=Validation adhérent
Notify_MEMBER_MODIFY=Adhérent modifié
Notify_MEMBER_SUBSCRIPTION=Adhésion
@@ -112,6 +113,7 @@ PredefinedMailContentSendOrder=__(Hello)__\n\nVeuillez trouver, ci-joint, la com
PredefinedMailContentSendSupplierOrder=__(Hello)__\n\nVeuillez trouver, ci-joint, notre commande __REF__\n\n\n__(Sincerely)__\n\n__SENDEREMAIL_SIGNATURE__
PredefinedMailContentSendSupplierInvoice=__(Hello)__\n\nVeuillez trouver, ci-joint, la facture __REF__\n\n\n__(Sincerely)__\n\n__SENDEREMAIL_SIGNATURE__
PredefinedMailContentSendShipping=__(Hello)__\n\nVeuillez trouver, ci-joint, le bon d'expédition __REF__\n\n\n__(Sincerely)__\n\n__SENDEREMAIL_SIGNATURE__
PredefinedMailContentSendReception=__(Hello)__\n\nVeuillez trouver, ci-joint, le bon de réception __REF__\n\n\n__(Sincerely)__\n\n__SENDEREMAIL_SIGNATURE__
PredefinedMailContentSendFichInter=__(Hello)__\n\nVeuillez trouver, ci-joint, la fiche intervention __REF__\n\n\n__(Sincerely)__\n\n__SENDEREMAIL_SIGNATURE__
PredefinedMailContentLink=Vous pouvez cliquer sur le lien ci-dessous pour effectuer votre paiement si ce n'est déjà fait.\n\n%s\n\n
PredefinedMailContentGeneric=__(Hello)__\n\n\n__(Sincerely)__\n\n__SENDEREMAIL_SIGNATURE__

View File

@@ -51,6 +51,7 @@ DateReceived=Date de réception réelle
ClassifyReception=Classer Reçu
SendShippingByEMail=Envoyer bon d'expédition par email
SendShippingRef=Envoi du bordereau d'expédition %s
SendReceptionRef=Envoi du bon de réception %s
ActionsOnShipping=Événements sur l'expédition
LinkToTrackYourPackage=Lien pour le suivi de votre colis
ShipmentCreationIsDoneFromOrder=Pour le moment, la création d'une nouvelle expédition se fait depuis la fiche commande client.