diff --git a/htdocs/fourn/fournisseur.facture.class.php b/htdocs/fourn/fournisseur.facture.class.php index ae9cca3e44c..1df9b39f0d2 100644 --- a/htdocs/fourn/fournisseur.facture.class.php +++ b/htdocs/fourn/fournisseur.facture.class.php @@ -143,9 +143,9 @@ class FactureFournisseur } } else - { - if ($this->db->errno() == DB_ERROR_RECORD_ALREADY_EXISTS) - { + { + if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') + { $this->error=$langs->trans("ErrorBillRefAlreadyExists"); $this->db->rollback(); return -1; @@ -482,13 +482,13 @@ class FactureFournisseur } } - /** - * \brief Renvoi le libellé court d'un statut donné - * \param paye etat paye - * \param statut id statut - * \param amount amount already payed - * \return string Libellé court du statut - */ + /** + * \brief Renvoi le libellé court d'un statut donné + * \param paye etat paye + * \param statut id statut + * \param amount amount already payed + * \return string Libellé court du statut + */ function PayedLibStatut($paye,$statut,$amount=0) { global $langs; @@ -505,6 +505,37 @@ class FactureFournisseur return $langs->trans("BillStatusPayed"); } } - + + + /** + * \brief Charge indicateurs this->nbtodo et this->nbtodolate de tableau de bord + * \return int <0 si ko, >0 si ok + */ + function load_board() + { + global $conf; + + $this->nbtodo=$this->nbtodolate=0; + $sql = "SELECT ff.rowid,".$this->db->pdate("ff.date_lim_reglement")." as datefin"; + $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as ff"; + $sql.= " WHERE ff.paye=0"; + $resql=$this->db->query($sql); + if ($resql) + { + while ($obj=$this->db->fetch_object($resql)) + { + $this->nbtodo++; + if ($obj->datefin < (time() - $conf->facture->fournisseur->warning_delay)) $this->nbtodolate++; + } + return 1; + } + else + { + dolibarr_print_error($this->db); + $this->error=$this->db->error(); + return -1; + } + } + } ?> diff --git a/htdocs/fourn/index.php b/htdocs/fourn/index.php index 6a9c748709f..0c61021903d 100644 --- a/htdocs/fourn/index.php +++ b/htdocs/fourn/index.php @@ -22,10 +22,10 @@ */ /** - \file htdocs/fourn/index.php - \ingroup fournisseur - \brief Page accueil de la zone fournisseurs - \version $Revision$ + \file htdocs/fourn/index.php + \ingroup fournisseur + \brief Page accueil de la zone fournisseurs + \version $Revision$ */ require("./pre.inc.php"); @@ -34,9 +34,12 @@ if (!$user->rights->societe->lire) accessforbidden(); -$page = $_GET["page"]; -$sortorder = $_GET["sortorder"]; -$sortfield = $_GET["sortfield"]; +$page = isset($_GET["page"])?$_GET["page"]:''; +$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:''; +$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:''; +$socname = isset($_GET["socname"])?$_GET["socname"]:''; +$search_nom = isset($_GET["search_nom"])?$_GET["search_nom"]:''; +$search_ville = isset($_GET["search_ville"])?$_GET["search_ville"]:''; $langs->load("suppliers"); $langs->load("orders"); @@ -44,9 +47,8 @@ $langs->load("companies"); llxHeader(); -/* - * Sécurité accés client - */ +// Sécurité accés client +$socidp=''; if ($user->societe_id > 0) { $action = ''; @@ -74,13 +76,13 @@ if ($socname) { $sortfield = "lower(s.nom)"; $sortorder = "ASC"; } -if (strlen($_GET["search_nom"])) +if ($search_nom) { - $sql .= " AND s.nom LIKE '%".$_GET["search_nom"]."%'"; + $sql .= " AND s.nom LIKE '%".$search_nom."%'"; } -if (strlen($_GET["search_ville"])) +if ($search_ville) { - $sql .= " AND s.ville LIKE '%".$_GET["search_ville"]."%'"; + $sql .= " AND s.ville LIKE '%".$search_ville."%'"; } $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); @@ -102,8 +104,8 @@ if ($resql) print ''; print '
'; - print ''; - print ''; + print ''; + print ''; print ''; print '
'; print ''; @@ -134,5 +136,5 @@ else $db->close(); -llxFooter("Dernière modification $Date$ révision $Revision$"); +llxFooter('$Date$ - $Revision$'); ?>