From 8be79ef68a5607454ab5d271ed41f921e2f109e2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 Jun 2005 22:46:19 +0000 Subject: [PATCH] Qual: Ne charge la classe Notify que si besoin --- htdocs/compta/facture.php | 21 +++--- htdocs/fichinter/fichinter.class.php | 104 +++++++++++++-------------- htdocs/master.inc.php | 1 - 3 files changed, 63 insertions(+), 63 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index e8143a9e727..3dac236fbdf 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -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 ''.img_object($langs->trans("ShowBill"),"bill").' '; - print ''.$objp->facnumber.''.$objp->increment."\n"; + print ''.$objp->facnumber.''.$objp->increment; + if ($objp->datelimite < (time() - $warning_delay) && ! $objp->paye && $objp->fk_statut == 1 && ! $objp->am) print img_warning($langs->trans("Late")); + print "\n"; if ($objp->df > 0 ) { diff --git a/htdocs/fichinter/fichinter.class.php b/htdocs/fichinter/fichinter.class.php index cf4c9d52d76..ec1120b434f 100644 --- a/htdocs/fichinter/fichinter.class.php +++ b/htdocs/fichinter/fichinter.class.php @@ -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; } } diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 758372190b0..ba42272a348 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -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");