diff --git a/htdocs/compta/fiche.php b/htdocs/compta/fiche.php
index 2643e2a1538..e340dd16f8b 100644
--- a/htdocs/compta/fiche.php
+++ b/htdocs/compta/fiche.php
@@ -148,8 +148,7 @@ if ($socid > 0)
{
$societe = new Societe($db, $socid);
-
- $sql = "SELECT s.idp, s.nom, ".$db->pdate("s.datec")." as dc, s.tel, s.fax, st.libelle as stcomm, s.fk_stcomm, s.url,s.address,s.cp,s.ville, s.note, t.libelle as typent, e.libelle as effectif, s.siren, s.prefix_comm, s.services,s.parent, s.description FROM llx_societe as s, c_stcomm as st, c_typent as t, c_effectif as e ";
+ $sql = "SELECT s.idp as idp, s.nom, ".$db->pdate("s.datec")." as dc, s.tel, s.fax, st.libelle as stcomm, s.fk_stcomm, s.url,s.address,s.cp,s.ville, s.note, t.libelle as typent, e.libelle as effectif, s.siren, s.prefix_comm, s.services,s.parent, s.description FROM llx_societe as s, c_stcomm as st, c_typent as t, c_effectif as e ";
$sql .= " WHERE s.fk_stcomm=st.id AND s.fk_typent = t.id AND s.fk_effectif = e.id";
if ($to == 'next')
@@ -167,6 +166,14 @@ if ($socid > 0)
if ($result) {
$objsoc = $db->fetch_object(0);
+ if (! $objsoc->idp) {
+ print("Cette societe n'existe pas ou plus");
+ $db->close();
+
+ llxFooter("Dernière modification $Date$ révision $Revision$");
+ exit;
+ }
+
$dac = strftime("%Y-%m-%d %H:%M", time());
if ($errmesg) {
print "$errmesg
";
@@ -182,11 +189,11 @@ if ($socid > 0)
if ($user->societe_id == 0)
{
print '
| ".number_format($objp->amount, 2, ',', ' ')." | \n"; $paye[1] = "payée"; - $paye[0] = "non payée"; + $paye[0] = "impayée"; print "".$paye[$objp->paye]." | \n"; print "\n"; $i++;