diff --git a/htdocs/includes/boxes/box_factures.php b/htdocs/includes/boxes/box_factures.php index c58bdeaa9a9..1ad95e4cdf3 100644 --- a/htdocs/includes/boxes/box_factures.php +++ b/htdocs/includes/boxes/box_factures.php @@ -20,39 +20,42 @@ * */ -$info_box_head = array(); -$info_box_head[] = array('text' => "Les 5 dernières factures"); - -$info_box_contents = array(); - -$sql = "SELECT s.nom,s.idp,f.facnumber,f.amount,".$db->pdate("f.datef")." as df,f.paye,f.rowid as facid"; -$sql .= " FROM llx_societe as s,llx_facture as f WHERE f.fk_soc = s.idp"; -$sql .= " ORDER BY f.datef DESC, f.facnumber DESC "; -$sql .= $db->plimit(5, 0); - -$result = $db->query($sql); - -if ($result) +if ($user->rights->facture->lire) { - $num = $db->num_rows(); - - $i = 0; - - while ($i < $num) + + $info_box_head = array(); + $info_box_head[] = array('text' => "Les 5 dernières factures"); + + $info_box_contents = array(); + + $sql = "SELECT s.nom,s.idp,f.facnumber,f.amount,".$db->pdate("f.datef")." as df,f.paye,f.rowid as facid"; + $sql .= " FROM llx_societe as s,llx_facture as f WHERE f.fk_soc = s.idp"; + $sql .= " ORDER BY f.datef DESC, f.facnumber DESC "; + $sql .= $db->plimit(5, 0); + + $result = $db->query($sql); + + if ($result) { - $objp = $db->fetch_object( $i); + $num = $db->num_rows(); - $info_box_contents[$i][0] = array('align' => 'left', - 'text' => $objp->facnumber, - 'url' => DOL_URL_ROOT."/compta/facture.php3?facid=".$objp->facid); - - $info_box_contents[$i][1] = array('align' => 'left', - 'text' => $objp->nom, - 'url' => DOL_URL_ROOT."/comm/fiche.php3?socid=".$objp->idp); - $i++; + $i = 0; + + while ($i < $num) + { + $objp = $db->fetch_object( $i); + + $info_box_contents[$i][0] = array('align' => 'left', + 'text' => $objp->facnumber, + 'url' => DOL_URL_ROOT."/compta/facture.php3?facid=".$objp->facid); + + $info_box_contents[$i][1] = array('align' => 'left', + 'text' => $objp->nom, + 'url' => DOL_URL_ROOT."/comm/fiche.php3?socid=".$objp->idp); + $i++; + } } + + new infoBox($info_box_head, $info_box_contents); } - -new infoBox($info_box_head, $info_box_contents); - ?> diff --git a/htdocs/includes/boxes/box_factures_imp.php b/htdocs/includes/boxes/box_factures_imp.php index 8641d6d021f..df79e4536e6 100644 --- a/htdocs/includes/boxes/box_factures_imp.php +++ b/htdocs/includes/boxes/box_factures_imp.php @@ -19,39 +19,42 @@ * $Source$ * */ - -$info_box_head = array(); -$info_box_head[] = array('text' => "Factures Impayées"); - -$info_box_contents = array(); - -$sql = "SELECT s.nom,s.idp,f.facnumber,f.amount,".$db->pdate("f.datef")." as df,f.paye,f.rowid as facid"; -$sql .= " FROM llx_societe as s,llx_facture as f WHERE f.fk_soc = s.idp AND f.paye=0 AND fk_statut = 1"; -$sql .= " ORDER BY f.datef DESC, f.facnumber DESC "; -$sql .= $db->plimit(5, 0); - -$result = $db->query($sql); -if ($result) +if ($user->rights->facture->lire) { - $num = $db->num_rows(); - - $i = 0; - - while ($i < $num) + + $info_box_head = array(); + $info_box_head[] = array('text' => "Factures Impayées"); + + $info_box_contents = array(); + + $sql = "SELECT s.nom,s.idp,f.facnumber,f.amount,".$db->pdate("f.datef")." as df,f.paye,f.rowid as facid"; + $sql .= " FROM llx_societe as s,llx_facture as f WHERE f.fk_soc = s.idp AND f.paye=0 AND fk_statut = 1"; + $sql .= " ORDER BY f.datef DESC, f.facnumber DESC "; + $sql .= $db->plimit(5, 0); + + $result = $db->query($sql); + if ($result) { - $objp = $db->fetch_object( $i); - - $info_box_contents[$i][0] = array('align' => 'left', - 'text' => $objp->facnumber, - 'url' => DOL_URL_ROOT."/compta/facture.php3?facid=".$objp->facid); - - $info_box_contents[$i][1] = array('align' => 'left', - 'text' => $objp->nom, - 'url' => DOL_URL_ROOT."/comm/fiche.php3?socid=".$objp->idp); - - $i++; + $num = $db->num_rows(); + + $i = 0; + + while ($i < $num) + { + $objp = $db->fetch_object( $i); + + $info_box_contents[$i][0] = array('align' => 'left', + 'text' => $objp->facnumber, + 'url' => DOL_URL_ROOT."/compta/facture.php3?facid=".$objp->facid); + + $info_box_contents[$i][1] = array('align' => 'left', + 'text' => $objp->nom, + 'url' => DOL_URL_ROOT."/comm/fiche.php3?socid=".$objp->idp); + + $i++; + } } + + new infoBox($info_box_head, $info_box_contents); } - -new infoBox($info_box_head, $info_box_contents); ?> diff --git a/htdocs/includes/boxes/box_propales.php b/htdocs/includes/boxes/box_propales.php index d4023794ecc..e6e2d506ed7 100644 --- a/htdocs/includes/boxes/box_propales.php +++ b/htdocs/includes/boxes/box_propales.php @@ -19,41 +19,41 @@ * $Source$ * */ - -$info_box_head = array(); -$info_box_head[] = array('text' => "Les 5 dernières propositions"); - -$info_box_contents = array(); - -$sql = "SELECT s.nom,s.idp,p.ref,".$db->pdate("p.datep")." as dp,p.rowid"; -$sql .= " FROM llx_societe as s,llx_propal as p WHERE p.fk_soc = s.idp"; -$sql .= " ORDER BY p.datep DESC, p.ref DESC "; -$sql .= $db->plimit(5, 0); - -$result = $db->query($sql); - -if ($result) +if ($user->rights->propale->lire) { - $num = $db->num_rows(); - - $i = 0; - - while ($i < $num) + + $info_box_head = array(); + $info_box_head[] = array('text' => "Les 5 dernières propositions"); + + $info_box_contents = array(); + + $sql = "SELECT s.nom,s.idp,p.ref,".$db->pdate("p.datep")." as dp,p.rowid"; + $sql .= " FROM llx_societe as s,llx_propal as p WHERE p.fk_soc = s.idp"; + $sql .= " ORDER BY p.datep DESC, p.ref DESC "; + $sql .= $db->plimit(5, 0); + + $result = $db->query($sql); + + if ($result) { - $objp = $db->fetch_object( $i); + $num = $db->num_rows(); - $info_box_contents[$i][0] = array('align' => 'center', - 'text' => $objp->ref, - 'url' => DOL_URL_ROOT."/comm/propal.php3?propalid=".$objp->rowid); - - $info_box_contents[$i][1] = array('align' => 'center', - 'text' => $objp->nom, - 'url' => DOL_URL_ROOT."/comm/fiche.php3?socid=".$objp->idp); - $i++; - } + $i = 0; + + while ($i < $num) + { + $objp = $db->fetch_object( $i); + + $info_box_contents[$i][0] = array('align' => 'center', + 'text' => $objp->ref, + 'url' => DOL_URL_ROOT."/comm/propal.php3?propalid=".$objp->rowid); + + $info_box_contents[$i][1] = array('align' => 'center', + 'text' => $objp->nom, + 'url' => DOL_URL_ROOT."/comm/fiche.php3?socid=".$objp->idp); + $i++; + } + } + new infoBox($info_box_head, $info_box_contents); } - - -new infoBox($info_box_head, $info_box_contents); - ?>