Add better message for notifications

This commit is contained in:
Laurent Destailleur 2010-06-02 22:50:49 +00:00
parent d3e54348e9
commit 3eb7bd2ed0
3 changed files with 43 additions and 8 deletions

View File

@ -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,11 +154,42 @@ class Notify
if (strlen($sendto))
{
$application=(defined('MAIN_APPLICATION_TITLE')?MAIN_APPLICATION_TITLE:'Dolibarr');
$subject = '['.$application.'] '.$langs->transnoentitiesnoconv("DolibarrNotification");
$message = $texte;
$filename = explode("/",$file);
$msgishtml=0;
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 = $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
);

View File

@ -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

View File

@ -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