From 1751b58ef8ab1dd0876dfed16851effd2fb3023e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Aug 2014 00:46:00 +0200 Subject: [PATCH] New: Can add __PROJECT_REF__ and __TIHRPARTY_NAME__ into email topic or content template. --- ChangeLog | 1 + htdocs/comm/propal.php | 8 ++++++-- htdocs/commande/fiche.php | 8 ++++++-- htdocs/compta/facture.php | 15 +++++++++++---- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 136d94828bc..aba40b26e58 100644 --- a/ChangeLog +++ b/ChangeLog @@ -33,6 +33,7 @@ For users: Differentiate text and img. Use label into quick search form. Use accesskey on form search. +- New: Can add __PROJECT_REF__ and __TIHRPARTY_NAME__ into email topic or content template. - Fix: [ bug #1487 ] PAYMENT_DELETE trigger does not intercept trigger action - Fix: [ bug #1470, #1472, #1473] User trigger problem - Fix: [ bug #1489, #1491 ] Intervention trigger problem diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index b1747ca066d..35ab381a35f 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -2289,6 +2289,8 @@ if ($action == 'create') { */ if ($action == 'presend') { + $object->fetch_projet(); + $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/')); @@ -2341,7 +2343,7 @@ if ($action == 'create') { if (empty($object->ref_client)) { $formmail->withtopic = $outputlangs->trans('SendPropalRef', '__PROPREF__'); } else if (! empty($object->ref_client)) { - $formmail->withtopic = $outputlangs->trans('SendPropalRef', '__PROPREF__(__REFCLIENT__)'); + $formmail->withtopic = $outputlangs->trans('SendPropalRef', '__PROPREF__ (__REFCLIENT__)'); } $formmail->withfile = 2; $formmail->withbody = 1; @@ -2352,6 +2354,8 @@ if ($action == 'create') { $formmail->substit ['__PROPREF__'] = $object->ref; $formmail->substit ['__SIGNATURE__'] = $user->signature; $formmail->substit ['__REFCLIENT__'] = $object->ref_client; + $formmail->substit ['__THIRPARTY_NAME__'] = $object->thirdparty->name; + $formmail->substit ['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:''); $formmail->substit ['__PERSONALIZED__'] = ''; $formmail->substit ['__CONTACTCIVNAME__'] = ''; @@ -2362,7 +2366,7 @@ if ($action == 'create') { if (is_array($contactarr) && count($contactarr) > 0) { foreach ($contactarr as $contact) { - if ($contact ['libelle'] == $langs->trans('TypeContact_propal_external_CUSTOMER')) { + if ($contact ['libelle'] == $langs->trans('TypeContact_propal_external_CUSTOMER')) { // TODO Use code and not label $contactstatic = new Contact($db); $contactstatic->fetch($contact ['id']); $custcontact = $contactstatic->getFullName($langs, 1); diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 05429abbd7e..1d59311404e 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -2431,6 +2431,8 @@ if ($action == 'create' && $user->rights->commande->creer) { */ if ($action == 'presend') { + $object->fetch_projet(); + $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/')); @@ -2483,7 +2485,7 @@ if ($action == 'create' && $user->rights->commande->creer) { if (empty($object->ref_client)) { $formmail->withtopic = $outputlangs->trans('SendOrderRef', '__ORDERREF__'); } else if (! empty($object->ref_client)) { - $formmail->withtopic = $outputlangs->trans('SendOrderRef', '__ORDERREF__(__REFCLIENT__)'); + $formmail->withtopic = $outputlangs->trans('SendOrderRef', '__ORDERREF__ (__REFCLIENT__)'); } $formmail->withfile = 2; $formmail->withbody = 1; @@ -2493,6 +2495,8 @@ if ($action == 'create' && $user->rights->commande->creer) { $formmail->substit ['__ORDERREF__'] = $object->ref; $formmail->substit ['__SIGNATURE__'] = $user->signature; $formmail->substit ['__REFCLIENT__'] = $object->ref_client; + $formmail->substit ['__THIRPARTY_NAME__'] = $object->thirdparty->name; + $formmail->substit ['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:''); $formmail->substit ['__PERSONALIZED__'] = ''; $formmail->substit ['__CONTACTCIVNAME__'] = ''; @@ -2502,7 +2506,7 @@ if ($action == 'create' && $user->rights->commande->creer) { if (is_array($contactarr) && count($contactarr) > 0) { foreach ($contactarr as $contact) { - if ($contact ['libelle'] == $langs->trans('TypeContact_commande_external_CUSTOMER')) { + if ($contact ['libelle'] == $langs->trans('TypeContact_commande_external_CUSTOMER')) { // TODO Use code and not label $contactstatic = new Contact($db); $contactstatic->fetch($contact ['id']); $custcontact = $contactstatic->getFullName($langs, 1); diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 989f7f46abd..de636bf5bdb 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -3638,11 +3638,15 @@ if ($action == 'create') $somethingshown = $formactions->showactions($object, 'invoice', $socid); print ''; - } else { + } + else + { /* - * Affiche formulaire mail + * Action presend (or prerelance) */ + $object->fetch_projet(); + // By default if $action=='presend' $titreform = 'SendBillByMail'; $topicmail = 'SendBillRef'; @@ -3710,8 +3714,9 @@ if ($action == 'create') if (empty($object->ref_client)) { $formmail->withtopic = $outputlangs->transnoentities($topicmail, '__FACREF__'); } else if (! empty($object->ref_client)) { - $formmail->withtopic = $outputlangs->transnoentities($topicmail, '__FACREF__(__REFCLIENT__)'); + $formmail->withtopic = $outputlangs->transnoentities($topicmail, '__FACREF__ (__REFCLIENT__)'); } + $formmail->withfile = 2; $formmail->withbody = 1; $formmail->withdeliveryreceipt = 1; @@ -3720,6 +3725,8 @@ if ($action == 'create') $formmail->substit ['__FACREF__'] = $object->ref; $formmail->substit ['__SIGNATURE__'] = $user->signature; $formmail->substit ['__REFCLIENT__'] = $object->ref_client; + $formmail->substit ['__THIRPARTY_NAME__'] = $object->thirdparty->name; + $formmail->substit ['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:''); $formmail->substit ['__PERSONALIZED__'] = ''; $formmail->substit ['__CONTACTCIVNAME__'] = ''; @@ -3730,7 +3737,7 @@ if ($action == 'create') if (is_array($contactarr) && count($contactarr) > 0) { foreach ($contactarr as $contact) { - if ($contact ['libelle'] == $langs->trans('TypeContact_facture_external_BILLING')) { + if ($contact ['libelle'] == $langs->trans('TypeContact_facture_external_BILLING')) { // TODO Use code and not label require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';