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 'Commercial'; - print "idp\">Documents"; - print "idp&action=add\">[Bookmark]"; + print "[idp\">Documents]"; + print "[idp&action=add\">Bookmark]"; if ($user->rights->facture->creer) - print "[idp\">".translate("Facture")."]"; - print "idp\">Notes"; + print "[idp\">".translate("Facturer")."]"; + print "[idp\">Notes]"; print "[idp&action=create\">Déplacement]"; } print ""; @@ -232,7 +239,8 @@ if ($socid > 0) print ''; $var=!$var; $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 s.idp = $objsoc->idp ORDER BY f.datef DESC"; + $sql .= " FROM llx_societe as s,llx_facture as f WHERE f.fk_soc = s.idp AND s.idp = ".$objsoc->idp." ORDER BY f.datef DESC"; + if ( $db->query($sql) ) { $num = $db->num_rows(); $i = 0; @@ -258,7 +266,7 @@ if ($socid > 0) } print "\n"; $paye[1] = "payée"; - $paye[0] = "non payée"; + $paye[0] = "impayée"; print "\n"; print "\n"; $i++;
".number_format($objp->amount, 2, ',', ' ')."".$paye[$objp->paye]."