Skip to content
Snippets Groups Projects
Commit 3eb7bd2e authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Add better message for notifications

parent d3e54348
No related branches found
No related tags found
No related merge requests found
......@@ -120,11 +120,11 @@ class Notify
* \param objet_type Type of object the notification deals on (facture, order, propal, order_supplier...). Just for log in llx_notify.
* \param objet_id Id of object the notification deals on
* \param file Attach a file
* \return int <0 if KO or number of changes if OK
* \return int <0 if KO, or number of changes if OK
*/
function send($action, $socid, $texte, $objet_type, $objet_id, $file="")
{
global $conf,$langs;
global $conf,$langs,$mysoc,$dolibarr_main_url_root;
$langs->load("other");
......@@ -154,10 +154,41 @@ class Notify
if (strlen($sendto))
{
$application=(defined('MAIN_APPLICATION_TITLE')?MAIN_APPLICATION_TITLE:'Dolibarr');
include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
$application=($conf->global->MAIN_APPLICATION_TITLE?$conf->global->MAIN_APPLICATION_TITLE:'Dolibarr ERP/CRM');
$subject = '['.$application.'] '.$langs->transnoentitiesnoconv("DolibarrNotification");
$message = $texte;
$filename = explode("/",$file);
$message = $langs->transnoentities("YouReceiveMailBecauseOfNotification",$application,$mysoc->name)."\n";
$message = $langs->transnoentities("YouReceiveMailBecauseOfNotification2",$application,$mysoc->name)."\n";
$message.= "\n";
$message.= $texte;
// Add link
switch($objet_type)
{
case 'ficheinter':
$link=DOL_URL_ROOT.'/fichinter/fiche.php?id='.$objet_id;
break;
case 'propal':
$link=DOL_URL_ROOT.'/comm/propal.php?id='.$objet_id;
break;
case 'facture':
$link=DOL_URL_ROOT.'/facture/fiche.php?facid='.$objet_id;
break;
case 'order':
$link=DOL_URL_ROOT.'/commande/fiche.php?facid='.$objet_id;
break;
case 'order_supplier':
$link=DOL_URL_ROOT.'/fourn/commande/fiche.php?facid='.$objet_id;
break;
}
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',$dolibarr_main_url_root);
if ($link) $message.="\n".$urlwithouturlroot.$link;
$filename = basename($file);
$mimefile=dol_mimetype($file);
$msgishtml=0;
$replyto = $conf->notification->email_from;
......@@ -167,7 +198,7 @@ class Notify
$replyto,
$message,
array($file),
array("application/pdf"),
array($mimefile),
array($filename[sizeof($filename)-1]),
'', '', 0, $msgishtml
);
......
......@@ -131,6 +131,8 @@ NewHeight=New height
NewSizeAfterCropping=New size after cropping
DefineNewAreaToPick=Define new area on image to pick (left click on image then drag until you reach the opposite corner)
CurrentInformationOnImage=Informations on current image
YouReceiveMailBecauseOfNotification=You receive this message because your email has been added to list of targets to be informed of particular events into %s software of %s.
YouReceiveMailBecauseOfNotification2=This event is the following:
##### Bookmark #####
Bookmark=Bookmark
......
......@@ -131,6 +131,8 @@ NewHeight=Nouvelle hauteur
NewSizeAfterCropping=Nouvelles dimensions après recadrage
DefineNewAreaToPick=Définissez la zone d'image à conserver (clic gauche sur l'image puis drag vers les coins opposés)
CurrentInformationOnImage=Informations courantes sur l'image
YouReceiveMailBecauseOfNotification=Vous recevez ce message car votre email a été abonnée à certaines notifications automatiques pour vous informer d'évenements particuliers issus du logiciel %s de %s.
YouReceiveMailBecauseOfNotification2=L'évenement en question est le suivant:
##### Bookmark #####
Bookmark=Marque-page
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment