Qual: Ne charge la classe Notify que si besoin
This commit is contained in:
parent
f477365b48
commit
8be79ef68a
@ -1572,10 +1572,7 @@ else
|
||||
|
||||
$fac=new Facture($db);
|
||||
|
||||
if ($page == -1)
|
||||
{
|
||||
$page = 0 ;
|
||||
}
|
||||
if ($page == -1) $page = 0 ;
|
||||
|
||||
if ($user->rights->facture->lire)
|
||||
{
|
||||
@ -1585,11 +1582,13 @@ else
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield) $sortfield="f.datef";
|
||||
|
||||
$sql = "SELECT s.nom,s.idp,f.facnumber,f.increment,f.total,f.total_ttc,".$db->pdate("f.datef")." as df, f.paye as paye, f.rowid as facid, f.fk_statut, sum(pf.amount) as am";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= ",".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid=pf.fk_facture ";
|
||||
$sql .= " WHERE f.fk_soc = s.idp";
|
||||
$sql = "SELECT s.nom,s.idp,f.facnumber,f.increment,f.total,f.total_ttc,";
|
||||
$sql.= $db->pdate("f.datef")." as df, ".$db->pdate("f.date_lim_reglement")." as datelimite, ";
|
||||
$sql.= " f.paye as paye, f.rowid as facid, f.fk_statut, sum(pf.amount) as am";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ",".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid=pf.fk_facture ";
|
||||
$sql.= " WHERE f.fk_soc = s.idp";
|
||||
|
||||
if ($socidp) $sql .= " AND s.idp = $socidp";
|
||||
if ($month > 0) $sql .= " AND date_format(f.datef, '%m') = $month";
|
||||
@ -1715,7 +1714,9 @@ else
|
||||
}
|
||||
|
||||
print '<td><a href="facture.php?facid='.$objp->facid.'">'.img_object($langs->trans("ShowBill"),"bill").'</a> ';
|
||||
print '<a href="facture.php?facid='.$objp->facid.'">'.$objp->facnumber.'</a>'.$objp->increment."</td>\n";
|
||||
print '<a href="facture.php?facid='.$objp->facid.'">'.$objp->facnumber.'</a>'.$objp->increment;
|
||||
if ($objp->datelimite < (time() - $warning_delay) && ! $objp->paye && $objp->fk_statut == 1 && ! $objp->am) print img_warning($langs->trans("Late"));
|
||||
print "</td>\n";
|
||||
|
||||
if ($objp->df > 0 )
|
||||
{
|
||||
|
||||
@ -202,57 +202,57 @@ class Fichinter
|
||||
*/
|
||||
function valid($userid, $outputdir)
|
||||
{
|
||||
$action_notify = 1; // ne pas modifier cette valeur
|
||||
|
||||
$this->fetch($this->id);
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter SET fk_statut = 1, date_valid=now(), fk_user_valid=$userid";
|
||||
$sql .= " WHERE rowid = $this->id AND fk_statut = 0 ;";
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
/*
|
||||
* Set generates files readonly
|
||||
*
|
||||
*/
|
||||
umask(0);
|
||||
$file = $outputdir . "/$this->ref/$this->ref.tex";
|
||||
if (is_writeable($file))
|
||||
{
|
||||
chmod($file, 0444);
|
||||
}
|
||||
$file = $outputdir . "/$this->ref/$this->ref.ps";
|
||||
if (is_writeable($file))
|
||||
{
|
||||
chmod($file, 0444);
|
||||
}
|
||||
$filepdf = $conf->fichinter->dir_output . "/$this->ref/$this->ref.pdf";
|
||||
if (is_writeable($filepdf))
|
||||
{
|
||||
chmod($filepdf, 0444);
|
||||
}
|
||||
|
||||
/*
|
||||
* Notify
|
||||
*
|
||||
*/
|
||||
$mesg = "La fiche d'intervention ".$this->ref." a été validée.\n";
|
||||
|
||||
$notify = New Notify($this->db);
|
||||
$notify->send($action_notify, $this->societe_id, $mesg, "ficheinter", $this->id, $filepdf);
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->error() . ' in ' . $sql;
|
||||
}
|
||||
|
||||
$action_notify = 1; // ne pas modifier cette valeur
|
||||
|
||||
$this->fetch($this->id);
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter SET fk_statut = 1, date_valid=now(), fk_user_valid=$userid";
|
||||
$sql .= " WHERE rowid = $this->id AND fk_statut = 0 ;";
|
||||
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
/*
|
||||
* Set generates files readonly
|
||||
*
|
||||
*/
|
||||
umask(0);
|
||||
$file = $outputdir . "/$this->ref/$this->ref.tex";
|
||||
if (is_writeable($file))
|
||||
{
|
||||
chmod($file, 0444);
|
||||
}
|
||||
$file = $outputdir . "/$this->ref/$this->ref.ps";
|
||||
if (is_writeable($file))
|
||||
{
|
||||
chmod($file, 0444);
|
||||
}
|
||||
$filepdf = $conf->fichinter->dir_output . "/$this->ref/$this->ref.pdf";
|
||||
if (is_writeable($filepdf))
|
||||
{
|
||||
chmod($filepdf, 0444);
|
||||
}
|
||||
|
||||
/*
|
||||
* Notify
|
||||
*/
|
||||
$mesg = "La fiche d'intervention ".$this->ref." a été validée.\n";
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT ."/notify.class.php");
|
||||
$notify = New Notify($this->db);
|
||||
$notify->send($action_notify, $this->societe_id, $mesg, "ficheinter", $this->id, $filepdf);
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->error() . ' in ' . $sql;
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* \brief Charge la liste des clients depuis la base
|
||||
*
|
||||
*/
|
||||
function fetch_client()
|
||||
{
|
||||
@ -265,11 +265,11 @@ class Fichinter
|
||||
* \brief Charge les infos du projet depuis la base
|
||||
*
|
||||
*/
|
||||
function fetch_projet()
|
||||
{
|
||||
$projet = new Project($this->db);
|
||||
$projet->fetch($this->projet_id);
|
||||
$this->projet = $projet->title;
|
||||
function fetch_projet()
|
||||
{
|
||||
$projet = new Project($this->db);
|
||||
$projet->fetch($this->projet_id);
|
||||
$this->projet = $projet->title;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -106,7 +106,6 @@ require_once(DOL_DOCUMENT_ROOT ."/user.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT ."/lib/functions.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT ."/html.form.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT ."/menu.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT ."/notify.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT ."/address.class.php");
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user