diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php
index 4f012710a39ab..7471c9da9627b 100644
--- a/htdocs/comm/card.php
+++ b/htdocs/comm/card.php
@@ -660,8 +660,6 @@
*/
if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
{
- $propal_static = new Propal($db);
-
$sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht";
$sql.= ", p.tva as total_tva";
$sql.= ", p.total as total_ttc";
@@ -676,9 +674,9 @@
$resql=$db->query($sql);
if ($resql)
{
- $var=true;
- $num = $db->num_rows($resql);
+ $propal_static = new Propal($db);
+ $num = $db->num_rows($resql);
if ($num > 0)
{
print '
';
@@ -727,8 +725,6 @@
*/
if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
{
- $commande_static=new Commande($db);
-
$sql = "SELECT s.nom, s.rowid";
$sql.= ", c.rowid as cid, c.total_ht";
$sql.= ", c.tva as total_tva";
@@ -744,9 +740,9 @@
$resql=$db->query($sql);
if ($resql)
{
- $var=true;
- $num = $db->num_rows($resql);
+ $commande_static=new Commande($db);
+ $num = $db->num_rows($resql);
if ($num > 0)
{
// Check if there are orders billable
@@ -808,9 +804,8 @@
/*
* Last shipments
*/
- if (! empty($conf->expedition->enabled) && $user->rights->expedition->lire) {
- $sendingstatic = new Expedition($db);
-
+ if (! empty($conf->expedition->enabled) && $user->rights->expedition->lire)
+ {
$sql = 'SELECT e.rowid as id';
$sql.= ', e.ref';
$sql.= ', e.date_creation';
@@ -829,10 +824,11 @@
$sql.= " ORDER BY e.date_creation DESC";
$resql = $db->query($sql);
- if ($resql) {
- $var = true;
- $num = $db->num_rows($resql);
- $i = 0;
+ if ($resql)
+ {
+ $sendingstatic = new Expedition($db);
+
+ $num = $db->num_rows($resql);
if ($num > 0) {
print '';
@@ -843,12 +839,16 @@
print '';
}
- while ($i < $num && $i < $MAXLIST) {
+ $i = 0;
+ while ($i < $num && $i < $MAXLIST)
+ {
$objp = $db->fetch_object($resql);
- print '';
- print '';
+
$sendingstatic->id = $objp->id;
$sendingstatic->ref = $objp->ref;
+
+ print ' |
';
+ print '';
print $sendingstatic->getNomUrl(1);
print ' | ';
if ($objp->date_creation > 0) {
@@ -875,9 +875,7 @@
*/
if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire)
{
- $contratstatic=new Contrat($db);
-
- $sql = "SELECT s.nom, s.rowid, c.rowid as id, c.ref as ref, c.statut, c.datec as dc, c.date_contrat as dcon, c.ref_supplier as refsup";
+ $sql = "SELECT s.nom, s.rowid, c.rowid as id, c.ref as ref, c.statut, c.datec as dc, c.date_contrat as dcon, c.ref_customer as refcus, c.ref_supplier as refsup";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c";
$sql.= " WHERE c.fk_soc = s.rowid ";
$sql.= " AND s.rowid = ".$object->id;
@@ -887,9 +885,10 @@
$resql=$db->query($sql);
if ($resql)
{
- $var=true;
+ $contrat=new Contrat($db);
+
$num = $db->num_rows($resql);
- if ($num >0 )
+ if ($num >0)
{
print '';
@@ -900,17 +899,19 @@
print '
';
print '
';
}
+
$i = 0;
while ($i < $num && $i < $MAXLIST)
{
- $contrat=new Contrat($db);
-
$objp = $db->fetch_object($resql);
- print '';
- print '';
$contrat->id=$objp->id;
$contrat->ref=$objp->ref?$objp->ref:$objp->id;
+ $contrat->ref_customer=$objp->refcus;
+ $contrat->ref_supplier=$objp->refsup;
+
+ print ' |
';
+ print '';
print $contrat->getNomUrl(1,12);
print " | \n";
print ''.dol_trunc($objp->refsup,12)." | \n";
@@ -946,12 +947,11 @@
$sql.= " AND f.entity = ".$conf->entity;
$sql.= " ORDER BY f.tms DESC";
- $fichinter_static=new Fichinter($db);
-
$resql=$db->query($sql);
if ($resql)
{
- $var=true;
+ $fichinter_static=new Fichinter($db);
+
$num = $db->num_rows($resql);
if ($num > 0)
{
@@ -962,8 +962,8 @@
print ''.img_picto($langs->trans("Statistics"),'stats').' | ';
print '
';
print '';
-
}
+
$i = 0;
while ($i < $num && $i < $MAXLIST)
{
@@ -996,8 +996,6 @@
*/
if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
{
- $invoicetemplate = new FactureRec($db);
-
$sql = 'SELECT f.rowid as id, f.titre as ref, f.amount';
$sql.= ', f.total as total_ht';
$sql.= ', f.tva as total_tva';
@@ -1020,9 +1018,9 @@
$resql=$db->query($sql);
if ($resql)
{
- $var=true;
+ $invoicetemplate = new FactureRec($db);
+
$num = $db->num_rows($resql);
- $i = 0;
if ($num > 0)
{
print '';
@@ -1033,12 +1031,11 @@
print '';
}
+ $i = 0;
while ($i < $num && $i < $MAXLIST)
{
$objp = $db->fetch_object($resql);
- print '';
- print '';
$invoicetemplate->id = $objp->id;
$invoicetemplate->ref = $objp->ref;
$invoicetemplate->suspended = $objp->suspended;
@@ -1047,6 +1044,9 @@
$invoicetemplate->total_ht = $objp->total_ht;
$invoicetemplate->total_tva = $objp->total_tva;
$invoicetemplate->total_ttc = $objp->total_ttc;
+
+ print ' |
';
+ print '';
print $invoicetemplate->getNomUrl(1);
print ' | ';
if ($objp->frequency && $objp->date_last_gen > 0)
@@ -1097,8 +1097,6 @@
*/
if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
{
- $facturestatic = new Facture($db);
-
$sql = 'SELECT f.rowid as facid, f.facnumber, f.type, f.amount';
$sql.= ', f.total as total_ht';
$sql.= ', f.tva as total_tva';
@@ -1118,9 +1116,9 @@
$resql=$db->query($sql);
if ($resql)
{
- $var=true;
+ $facturestatic = new Facture($db);
+
$num = $db->num_rows($resql);
- $i = 0;
if ($num > 0)
{
print '';
@@ -1132,18 +1130,20 @@
print '';
}
+ $i = 0;
while ($i < $num && $i < $MAXLIST)
{
$objp = $db->fetch_object($resql);
- print '';
- print '';
$facturestatic->id = $objp->facid;
$facturestatic->ref = $objp->facnumber;
$facturestatic->type = $objp->type;
- $facturestatic->total_ht = $objp->total_ht;
- $facturestatic->total_tva = $objp->total_tva;
- $facturestatic->total_ttc = $objp->total_ttc;
+ $facturestatic->total_ht = $objp->total_ht;
+ $facturestatic->total_tva = $objp->total_tva;
+ $facturestatic->total_ttc = $objp->total_ttc;
+
+ print ' |
';
+ print '';
print $facturestatic->getNomUrl(1);
print ' | ';
if ($objp->df > 0)