fix when there is no project
This commit is contained in:
parent
b32a9cc50e
commit
0aae40f8aa
@ -31,34 +31,13 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/CMailFile.class.php';
|
|||||||
*/
|
*/
|
||||||
class Notify
|
class Notify
|
||||||
{
|
{
|
||||||
/**
|
var $id;
|
||||||
* @var int ID
|
var $db;
|
||||||
*/
|
var $error;
|
||||||
public $id;
|
var $errors=array();
|
||||||
|
|
||||||
/**
|
|
||||||
* @var DoliDB Database handler.
|
|
||||||
*/
|
|
||||||
public $db;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string Error string
|
|
||||||
* @see errors
|
|
||||||
*/
|
|
||||||
public $error;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string[] Error codes (or messages)
|
|
||||||
*/
|
|
||||||
public $errors = array();
|
|
||||||
|
|
||||||
var $author;
|
var $author;
|
||||||
|
var $ref;
|
||||||
/**
|
|
||||||
* @var string Ref
|
|
||||||
*/
|
|
||||||
public $ref;
|
|
||||||
|
|
||||||
var $date;
|
var $date;
|
||||||
var $duree;
|
var $duree;
|
||||||
var $note;
|
var $note;
|
||||||
@ -341,12 +320,7 @@ class Notify
|
|||||||
|
|
||||||
$oldref=(empty($object->oldref)?$object->ref:$object->oldref);
|
$oldref=(empty($object->oldref)?$object->ref:$object->oldref);
|
||||||
$newref=(empty($object->newref)?$object->ref:$object->newref);
|
$newref=(empty($object->newref)?$object->ref:$object->newref);
|
||||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
|
||||||
if (! empty($object->fk_project))
|
|
||||||
{
|
|
||||||
$proj = new Project($this->db);
|
|
||||||
$proj->fetch($object->fk_project);
|
|
||||||
}
|
|
||||||
// Check notification per third party
|
// Check notification per third party
|
||||||
$sql = "SELECT 'tocontactid' as type_target, c.email, c.rowid as cid, c.lastname, c.firstname, c.default_lang,";
|
$sql = "SELECT 'tocontactid' as type_target, c.email, c.rowid as cid, c.lastname, c.firstname, c.default_lang,";
|
||||||
$sql.= " a.rowid as adid, a.label, a.code, n.rowid, n.type";
|
$sql.= " a.rowid as adid, a.label, a.code, n.rowid, n.type";
|
||||||
@ -376,6 +350,13 @@ class Notify
|
|||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$num = $this->db->num_rows($result);
|
$num = $this->db->num_rows($result);
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||||
|
if (! empty($object->fk_project))
|
||||||
|
{
|
||||||
|
$proj = new Project($this->db);
|
||||||
|
$proj->fetch($object->fk_project);
|
||||||
|
}
|
||||||
|
$projtitle=(empty($proj->title)?'':'['.$proj->title.']');
|
||||||
|
|
||||||
if ($num > 0)
|
if ($num > 0)
|
||||||
{
|
{
|
||||||
@ -397,8 +378,7 @@ class Notify
|
|||||||
$outputlangs->setDefaultLang($obj->default_lang);
|
$outputlangs->setDefaultLang($obj->default_lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
$projtitle=(empty($proj->title)?'':$proj->title);
|
$subject = '['.$mysoc->name.']'.$projtitle.' '.$outputlangs->transnoentitiesnoconv("DolibarrNotification");
|
||||||
$subject = '['.$mysoc->name.']['.$projtitle.'] '.$outputlangs->transnoentitiesnoconv("DolibarrNotification");
|
|
||||||
|
|
||||||
switch ($notifcode) {
|
switch ($notifcode) {
|
||||||
case 'BILL_VALIDATE':
|
case 'BILL_VALIDATE':
|
||||||
@ -580,7 +560,7 @@ class Notify
|
|||||||
$link = '';
|
$link = '';
|
||||||
$num++;
|
$num++;
|
||||||
|
|
||||||
$subject = '['.$mysoc->name.'] ['.$proj->title.'] '.$langs->transnoentitiesnoconv("DolibarrNotification");
|
$subject = '['.$mysoc->name.'] '.$projtitle.' '.$langs->transnoentitiesnoconv("DolibarrNotification");
|
||||||
|
|
||||||
switch ($notifcode) {
|
switch ($notifcode) {
|
||||||
case 'BILL_VALIDATE':
|
case 'BILL_VALIDATE':
|
||||||
@ -744,3 +724,4 @@ class Notify
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user