Skip to content

Commit

Permalink
Fix generic text must be set before specific for notification
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jan 9, 2017
1 parent 8ab0ad3 commit a9354e5
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions htdocs/core/class/notify.class.php
Expand Up @@ -321,18 +321,7 @@ function send($notifcode, $object)

// Check notification per user
$sql.= "\nUNION\n";
/*
$sql.= "SELECT 1 as user, c.email, c.rowid as cid, c.lastname, c.firstname, '$langs->defaultlang' as default_lang,";
$sql.= " a.rowid as adid, a.label, a.code, n.rowid, n.type";
$sql.= " FROM ".MAIN_DB_PREFIX."user as c,";
$sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,";
$sql.= " ".MAIN_DB_PREFIX."notify_def as n,";
$sql.= " ".MAIN_DB_PREFIX."element_contact as ec";
$sql.= " WHERE n.fk_user = c.rowid AND a.rowid = n.fk_action";
$sql.= " AND n.fk_user = ec.fk_socpeople";
if (is_numeric($notifcode)) $sql.= " AND n.fk_action = ".$notifcode; // Old usage
else $sql.= " AND a.code = '".$notifcode."'"; // New usage
$sql .= " AND ec.element_id = ".$object->id;*/

$sql.= "SELECT 'touserid' as type_target, c.email, c.rowid as cid, c.lastname, c.firstname, c.lang as default_lang,";
$sql.= " a.rowid as adid, a.label, a.code, n.rowid, n.type";
$sql.= " FROM ".MAIN_DB_PREFIX."user as c,";
Expand Down Expand Up @@ -367,6 +356,8 @@ function send($notifcode, $object)
$outputlangs->setDefaultLang($obj->default_lang);
}

$subject = '['.$application.'] '.$outputlangs->transnoentitiesnoconv("DolibarrNotification");

switch ($notifcode) {
case 'BILL_VALIDATE':
$link='/compta/facture.php?facid='.$object->id;
Expand Down Expand Up @@ -446,8 +437,6 @@ function send($notifcode, $object)
$filepdf = $pdf_path;
}

$subject = '['.$application.'] '.$outputlangs->transnoentitiesnoconv("DolibarrNotification");

$message = $outputlangs->transnoentities("YouReceiveMailBecauseOfNotification",$application,$mysoc->name)."\n";
$message.= $outputlangs->transnoentities("YouReceiveMailBecauseOfNotification2",$application,$mysoc->name)."\n";
$message.= "\n";
Expand Down Expand Up @@ -535,7 +524,9 @@ function send($notifcode, $object)
$link = '';
$num++;

switch ($notifcode) {
$subject = '['.$application.'] '.$langs->transnoentitiesnoconv("DolibarrNotification");

switch ($notifcode) {
case 'BILL_VALIDATE':
$link='/compta/facture.php?facid='.$object->id;
$dir_output = $conf->facture->dir_output;
Expand Down Expand Up @@ -622,8 +613,6 @@ function send($notifcode, $object)
$filepdf = $pdf_path;
}

$subject = '['.$application.'] '.$langs->transnoentitiesnoconv("DolibarrNotification");

$message = $langs->transnoentities("YouReceiveMailBecauseOfNotification",$application,$mysoc->name)."\n";
$message.= $langs->transnoentities("YouReceiveMailBecauseOfNotification2",$application,$mysoc->name)."\n";
$message.= "\n";
Expand Down

0 comments on commit a9354e5

Please sign in to comment.