From 3af2f86bf2169c7025493d49295f21de172b1204 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 17 May 2006 18:55:46 +0000 Subject: [PATCH] Modif look page propal compta --- htdocs/compta/propal.php | 8 ++++---- htdocs/propal.class.php | 31 ++++++++++++++++++++++++------- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/htdocs/compta/propal.php b/htdocs/compta/propal.php index e9dab363905..d591c1c8095 100644 --- a/htdocs/compta/propal.php +++ b/htdocs/compta/propal.php @@ -579,7 +579,7 @@ if ($_GET["propalid"] > 0) print '".$langs->trans("BuildBill").""; } - if ($obj->statut == 2 && sizeof($propal->facture_liste_array())) + if ($obj->statut == 2 && sizeof($propal->getFactureListeArray())) { print '".$langs->trans("ClassifyBilled").""; } @@ -603,7 +603,7 @@ if ($_GET["propalid"] > 0) $var=true; - $html->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed); + $somethingshown=$html->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed); /* @@ -618,7 +618,7 @@ if ($_GET["propalid"] > 0) $staticcommande=new Commande($db); $total=0; - print '
'; + if ($somethingshown) { print '
'; $somethingshown=1; } print_titre($langs->trans('RelatedOrders')); print ''; print ''; @@ -655,7 +655,7 @@ if ($_GET["propalid"] > 0) { $num_fac_asso = $db->num_rows($resql); $i = 0; $total = 0; - print "
"; + if ($somethingshown) { print '
'; $somethingshown=1; } if ($num_fac_asso > 1) print_titre($langs->trans("RelatedBills")); else print_titre($langs->trans("RelatedBill")); print '
'; diff --git a/htdocs/propal.class.php b/htdocs/propal.class.php index 82bf0fd8934..0b5c03a4fc1 100644 --- a/htdocs/propal.class.php +++ b/htdocs/propal.class.php @@ -1263,15 +1263,26 @@ class Propal } /** - * \brief Renvoie un tableau contenant les numéros de factures associées + * \brief Renvoie un tableau contenant les numéros de factures associées + * \return array Tableau des id de factures */ - function facture_liste_array () + function getFactureListeArray () + { + return $this->FactureListeArray($this->id); + } + + /** + * \brief Renvoie un tableau contenant les numéros de factures associées + * \param id Id propal + * \return array Tableau des id de factures + */ + function FactureListeArray($id) { $ga = array(); $sql = "SELECT fk_facture FROM ".MAIN_DB_PREFIX."fa_pr as fp"; - $sql .= " WHERE fk_propal = " . $this->id; - if ($this->db->query($sql) ) + $sql .= " WHERE fk_propal = " . $id; + if ($this->db->query($sql)) { $nump = $this->db->num_rows(); @@ -1290,7 +1301,7 @@ class Propal } else { - dolibarr_print_error($this->db); + return -1; } } @@ -1567,7 +1578,7 @@ class Propal global $conf, $user; $this->nbtodo=$this->nbtodolate=0; - $sql ="SELECT p.rowid,".$this->db->pdate("p.datec")." as datec,".$this->db->pdate("p.fin_validite")." as datefin"; + $sql ="SELECT p.rowid, p.ref, ".$this->db->pdate("p.datec")." as datec,".$this->db->pdate("p.fin_validite")." as datefin"; if (!$user->rights->commercial->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user"; $sql.=" FROM ".MAIN_DB_PREFIX."propal as p"; if (!$user->rights->commercial->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -1581,7 +1592,13 @@ class Propal while ($obj=$this->db->fetch_object($resql)) { $this->nbtodo++; - if ($obj->datefin < (time() - $conf->propal->cloture->warning_delay)) $this->nbtodolate++; + if ($obj->datefin < (time() - $conf->propal->cloture->warning_delay)) + { + if ($mode == 'opened') $this->nbtodolate++; + if ($mode == 'signed') $this->nbtodolate++; +// \todo Definir règle des propales à facturer en retard +// if ($mode == 'signed' && ! sizeof($this->FactureListeArray($obj->rowid))) $this->nbtodolate++; + } } return 1; }