From f4161b457bf351c176e80ba557d8f878fd2586f2 Mon Sep 17 00:00:00 2001 From: frederic34 Date: Wed, 21 Jan 2015 01:06:04 +0100 Subject: [PATCH] Add dol_escape_htmltag and start to adapt boxes --- htdocs/adherents/class/adherent.class.php | 2 +- .../adherents/class/adherent_type.class.php | 2 +- htdocs/adherents/class/cotisation.class.php | 2 +- htdocs/categories/class/categorie.class.php | 2 +- htdocs/comm/action/class/actioncomm.class.php | 4 +- htdocs/comm/index.php | 9 +- htdocs/comm/propal/class/propal.class.php | 4 +- htdocs/commande/class/commande.class.php | 4 +- htdocs/compta/bank/class/account.class.php | 4 +- .../deplacement/class/deplacement.class.php | 2 +- htdocs/compta/dons/class/don.class.php | 2 +- .../facture/class/facture-rec.class.php | 2 +- htdocs/compta/facture/class/facture.class.php | 2 +- .../compta/localtax/class/localtax.class.php | 2 +- .../cheque/class/remisecheque.class.php | 2 +- .../compta/paiement/class/paiement.class.php | 2 +- .../class/bonprelevement.class.php | 4 +- .../salaries/class/paymentsalary.class.php | 2 +- .../sociales/class/chargesociales.class.php | 2 +- .../class/paymentsocialcontribution.class.php | 2 +- htdocs/compta/tva/class/tva.class.php | 2 +- htdocs/contact/class/contact.class.php | 4 +- htdocs/contrat/class/contrat.class.php | 4 +- htdocs/core/boxes/box_actions.php | 91 +-- htdocs/core/boxes/box_activity.php | 610 +++++++++++------- htdocs/core/boxes/box_bookmarks.php | 84 +-- htdocs/core/boxes/box_clients.php | 31 +- htdocs/core/boxes/box_commandes.php | 111 ++-- htdocs/core/boxes/box_comptes.php | 134 ++-- htdocs/core/boxes/box_contacts.php | 88 ++- htdocs/core/boxes/box_contracts.php | 94 +-- htdocs/core/boxes/box_external_rss.php | 42 +- htdocs/core/boxes/box_factures.php | 99 +-- htdocs/core/boxes/box_factures_fourn.php | 110 ++-- htdocs/core/boxes/modules_boxes.php | 16 +- htdocs/core/class/discount.class.php | 10 +- htdocs/ecm/class/ecmdirectory.class.php | 4 +- htdocs/expedition/class/expedition.class.php | 2 +- htdocs/fichinter/class/fichinter.class.php | 2 +- .../class/fournisseur.commande.class.php | 2 +- .../fourn/class/fournisseur.facture.class.php | 4 +- htdocs/fourn/class/paiementfourn.class.php | 2 +- htdocs/holiday/class/holiday.class.php | 2 +- htdocs/livraison/class/livraison.class.php | 2 +- htdocs/product/class/product.class.php | 2 +- htdocs/product/stock/class/entrepot.class.php | 2 +- htdocs/projet/class/project.class.php | 2 +- htdocs/projet/class/task.class.php | 2 +- htdocs/resource/class/resource.class.php | 2 +- htdocs/societe/class/address.class.php | 2 +- htdocs/societe/class/societe.class.php | 2 +- htdocs/user/class/user.class.php | 4 +- 52 files changed, 964 insertions(+), 661 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 7c65e1a5cb1..70b0fb00b4c 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1560,7 +1560,7 @@ class Adherent extends CommonObject $result=''; $label=$langs->trans("ShowMember").': '.$this->ref; - $linkclose = '" title="'.$label.'" class="classfortooltip">'; + $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; if ($option == 'card') { diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 44333f58322..a8ab42b6301 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -272,7 +272,7 @@ class AdherentType extends CommonObject $result=''; $label=$langs->trans("ShowTypeCard",$this->libelle); - $lien = ''; + $lien = ''; $lienfin=''; $picto='group'; diff --git a/htdocs/adherents/class/cotisation.class.php b/htdocs/adherents/class/cotisation.class.php index 48970abace4..c7faf97e748 100644 --- a/htdocs/adherents/class/cotisation.class.php +++ b/htdocs/adherents/class/cotisation.class.php @@ -266,7 +266,7 @@ class Cotisation extends CommonObject $result=''; $label=$langs->trans("ShowSubscription").': '.$this->ref; - $lien = ''; + $lien = ''; $lienfin=''; $picto='payment'; diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 7e29f6ccf38..efcee0d756d 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1276,7 +1276,7 @@ class Categorie extends CommonObject $result=''; $label=$langs->trans("ShowCategory").': '. ($this->ref?$this->ref:$this->label); - $lien = ''; + $lien = ''; $lienfin=''; $picto='category'; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 25a9803e63e..d7f63d31872 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -898,8 +898,8 @@ class ActionComm extends CommonObject $result=''; $label=$this->label; - if (empty($label)) $label=$this->libelle; // For backward compatibility - $linkclose = '" title="'.$label.'" class="classfortooltip">'; + if (empty($label)) $label=$this->libelle; // For backward compatibility + $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; if ($option=='birthday') $lien = 'rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -172,6 +172,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) print ''; $propalstatic->id=$obj->rowid; $propalstatic->ref=$obj->ref; + $propalstatic->ref_client=$obj->ref_client; print $propalstatic->getNomUrl(1); print ''; print ''; @@ -209,7 +210,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) { $langs->load("orders"); - $sql = "SELECT c.rowid, c.ref, c.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas"; + $sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas"; $sql.= " FROM ".MAIN_DB_PREFIX."commande as c"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -239,6 +240,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) print ''; $orderstatic->id=$obj->rowid; $orderstatic->ref=$obj->ref; + $orderstatic->ref_client=$obj->ref_client; print $orderstatic->getNomUrl(1); print ''; print ''; @@ -467,7 +469,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) { $langs->load("propal"); - $sql = "SELECT s.nom as name, s.rowid, p.rowid as propalid, p.total as total_ttc, p.total_ht, p.ref, p.fk_statut, p.datep as dp, p.fin_validite as dfv"; + $sql = "SELECT s.nom as name, s.rowid, p.rowid as propalid, p.total as total_ttc, p.total_ht, p.ref, p.ref_client, p.fk_statut, p.datep as dp, p.fin_validite as dfv"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."propal as p"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -503,6 +505,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) $propalstatic->id=$obj->propalid; $propalstatic->ref=$obj->ref; + $propalstatic->ref_client=$obj->ref_client; print ''; print '"; + print "\n"; } print "\n"; diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index 8861bf556ba..a8862ab5ed2 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -433,18 +433,16 @@ class DiscountAbsolute $result=''; - if ($option == 'invoice') - { + if ($option == 'invoice') { $label=$langs->trans("ShowDiscount").': '.$this->ref_facture_source; - $lien = ''; + $lien = ''; $lienfin=''; $ref=$this->ref_facture_source; $picto='bill'; } - if ($option == 'discount') - { + if ($option == 'discount') { $label=$langs->trans("Discount"); - $lien = ''; + $lien = ''; $lienfin=''; $ref=$langs->trans("Discount"); $picto='generic'; diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php index b4821dc2895..5edd4c3ce11 100644 --- a/htdocs/ecm/class/ecmdirectory.class.php +++ b/htdocs/ecm/class/ecmdirectory.class.php @@ -417,13 +417,13 @@ class EcmDirectory // extends CommonObject //$newref=str_replace('_',' ',$this->ref); $newref=$this->ref; $newlabel=$langs->trans("ShowECMSection").': '.$newref; - $linkclose='"'.($more?' '.$more:'').' title="'.$newlabel.'" class="classfortooltip">'; + $linkclose='"'.($more?' '.$more:'').' title="'.dol_escape_htmltag($newlabel, 1).'" class="classfortooltip">'; $lien = ''; + $linkstart = ''; $linkend=''; $picto='sending'; diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index eca71601e7d..58c0efdda9a 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -549,7 +549,7 @@ class Fichinter extends CommonObject $result=''; $label=$langs->trans("Show").': '.$this->ref; - $lien = ''; + $lien = ''; $lienfin=''; $picto='intervention'; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index c2743a8e3ad..ef25be9469f 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -533,7 +533,7 @@ class CommandeFournisseur extends CommonOrder $result=''; $label=$langs->trans("ShowOrder").': '.$this->ref; - $lien = ''; + $lien = ''; $lienfin=''; $picto='order'; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 5034204154a..842fe9fcf0b 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1477,12 +1477,12 @@ class FactureFournisseur extends CommonInvoice if ($option == 'document') { - $lien = ''; + $lien = ''; $lienfin=''; } else { - $lien = ''; + $lien = ''; $lienfin=''; } diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index 3c3f9abba76..3cd3ec0496c 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -495,7 +495,7 @@ class PaiementFourn extends Paiement } $label = $langs->trans("ShowPayment").': '.$text; - $lien = ''; + $lien = ''; $lienfin=''; diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 43c074a5781..280efd4addc 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -660,7 +660,7 @@ class Holiday extends CommonObject $result=''; $label=$langs->trans("Show").': '.$this->ref; - $lien = ''; + $lien = ''; $lienfin=''; $picto='holiday'; diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php index 2de166e4837..ccde9484b0d 100644 --- a/htdocs/livraison/class/livraison.class.php +++ b/htdocs/livraison/class/livraison.class.php @@ -663,7 +663,7 @@ class Livraison extends CommonObject $label=$langs->trans("ShowReceiving").': '.$this->ref; - $lien = ''; + $lien = ''; $lienfin=''; $picto='sending'; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index a2b34eb2862..a889136de01 100755 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2816,7 +2816,7 @@ class Product extends CommonObject if ($maxlength) $newref=dol_trunc($newref,$maxlength,'middle'); if ($this->type == 0) $label = $langs->trans("ShowProduct").': '.$this->ref.' '.$this->label; if ($this->type == 1) $label = $langs->trans("ShowService").': '.$this->ref.' '.$this->label; - $linkclose = '" title="'.$label.'" class="classfortooltip">'; + $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; if ($option == 'supplier') { $lien = 'libelle; - $lien=''; + $lien=''; $lienfin=''; if ($withpicto) $result.=($lien.img_object($label, 'stock', 'class="classfortooltip"').$lienfin.' '); diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 88b71cecc19..d423bc48ae1 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -790,7 +790,7 @@ class Project extends CommonObject $lien = ''; $lienfin = ''; $label = $langs->trans("ShowProject") . ': ' . $this->ref . ($this->title ? ' - ' . $this->title : ''); - $linkclose = '" title="'.$label.'" class="classfortooltip">'; + $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; if ($option != 'nolink') { if (preg_match('/\.php$/',$option)) { diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 497dabdc69f..5dde5e21b88 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -507,7 +507,7 @@ class Task extends CommonObject $result=''; $label=$langs->trans("ShowTask").': '.$this->ref.($this->label?' - '.$this->label:''); - $lien = ''; + $lien = ''; $lienfin=''; $picto='projecttask'; diff --git a/htdocs/resource/class/resource.class.php b/htdocs/resource/class/resource.class.php index fec44b3e2b7..498291c1cc1 100644 --- a/htdocs/resource/class/resource.class.php +++ b/htdocs/resource/class/resource.class.php @@ -873,7 +873,7 @@ class Resource extends CommonObject if ($option == '') { - $lien = ''; + $lien = ''; $picto='resource@resource'; $label=$langs->trans("ShowResource").': '.$this->ref; diff --git a/htdocs/societe/class/address.class.php b/htdocs/societe/class/address.class.php index ac1e28a0657..06be3f501fb 100644 --- a/htdocs/societe/class/address.class.php +++ b/htdocs/societe/class/address.class.php @@ -424,7 +424,7 @@ class Address $result=''; $label = $langs->trans("ShowAddress").': '.$this->label; - $lien = ''; + $lien = ''; $lienfin=''; if ($withpicto) $result.=($lien.img_object($langs->trans("ShowAddress").': '.$this->label, 'address', 'class="classfortooltip"').$lienfin.' '); diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index bcf5ae3104a..ab28cace102 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1749,7 +1749,7 @@ class Societe extends CommonObject } // Add type of canvas - $lien.=(!empty($this->canvas)?'&canvas='.$this->canvas:'').'" title="'.$name.'" class="classfortooltip">'; + $lien.=(!empty($this->canvas)?'&canvas='.$this->canvas:'').'" title="'.dol_escape_htmltag($name, 1).'" class="classfortooltip">'; $lienfin=''; if ($withpicto) $result.=($lien.img_object($langs->trans("ShowCompany").': '.$name, 'company', 'class="classfortooltip"').$lienfin); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index c5733d5724f..11eaa8afb45 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1788,12 +1788,12 @@ class User extends CommonObject $result=''; $label = $langs->trans("ShowUser").': '.$this->getFullName($langs,'','',24); - $lien = ''; + $lien = ''; $lienfin=''; if ($withpicto) { $result.=($lien.img_object($label, 'user', 'class="classfortooltip"').$lienfin); - if ($withpicto != 2) $result.=' '; + if ($withpicto != 2) $result.=' '; } $result.=$lien.$this->getFullName($langs,'','',24).$lienfin; return $result;
'; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 34bda84ae6e..e8ace86cf73 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2606,7 +2606,9 @@ class Propal extends CommonObject $result=''; $label=$langs->trans("ShowPropal").': '.$this->ref; - $linkclose = '" title="'.$label.'" class="classfortooltip">'; + if (! empty($this->ref_client)) + $label.= '
'.$langs->trans('RefCustomer').': '.$this->ref_client; + $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; if ($option == '') { $lien = 'ref; + if (! empty($this->ref_client)) + $label.= '
'.$langs->trans('RefCustomer').': '.$this->ref_client; - $linkstart = '
'; + $linkstart = ''; $linkend=''; if ($withpicto) $result.=($linkstart.img_object($label, $picto, 'class="classfortooltip"').$linkend); diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index b2e3dc79f78..5ecca4047e6 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -935,7 +935,7 @@ class Account extends CommonObject global $langs; $result=''; - $linkclose = '" title="'.$this->label.'" class="classfortooltip">'; + $linkclose = '" title="'.dol_escape_htmltag($this->label, 1).'" class="classfortooltip">'; if (empty($mode)) { @@ -1485,7 +1485,7 @@ class AccountLine extends CommonObject $result=''; $label=$langs->trans("ShowTransaction").': '.$this->rowid; - $lien = ''; + $lien = ''; $lienfin=''; if ($withpicto) $result.=($lien.img_object($label, 'account', 'class="classfortooltip"').$lienfin.' '); diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index e7a3350f2f3..b54ac75bc23 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -359,7 +359,7 @@ class Deplacement extends CommonObject $result=''; $label=$langs->trans("Show").': '.$this->ref; - $lien = ''; + $lien = ''; $lienfin=''; $picto='trip'; diff --git a/htdocs/compta/dons/class/don.class.php b/htdocs/compta/dons/class/don.class.php index c2f800f4a13..69a84831b90 100644 --- a/htdocs/compta/dons/class/don.class.php +++ b/htdocs/compta/dons/class/don.class.php @@ -713,7 +713,7 @@ class Don extends CommonObject $result=''; $label=$langs->trans("ShowDonation").': '.$this->id; - $lien = ''; + $lien = ''; $lienfin=''; $picto='generic'; diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 1a8e22a14bc..cadce3db632 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -560,7 +560,7 @@ class FactureRec extends Facture $result=''; $label=$langs->trans("ShowInvoice").': '.$this->ref; - $lien = ''; + $lien = ''; $lienfin=''; $picto='bill'; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 03b927d28a3..32d7fa13122 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -865,7 +865,7 @@ class Facture extends CommonInvoice if ($this->type == self::TYPE_SITUATION) $label=$langs->transnoentitiesnoconv("ShowInvoiceSituation").': '.$this->ref; if ($moretitle) $label.=' - '.$moretitle; - $linkstart=''; + $linkstart=''; $linkend=''; if ($withpicto) $result.=($linkstart.img_object(($max?dol_trunc($label,$max):$label), $picto, 'class="classfortooltip"').$linkend); diff --git a/htdocs/compta/localtax/class/localtax.class.php b/htdocs/compta/localtax/class/localtax.class.php index e6c3c6e0942..1512d0d39ac 100644 --- a/htdocs/compta/localtax/class/localtax.class.php +++ b/htdocs/compta/localtax/class/localtax.class.php @@ -587,7 +587,7 @@ class Localtax extends CommonObject $result=''; $label=$langs->trans("ShowVatPayment").': '.$this->ref; - $lien = ''; + $lien = ''; $lienfin=''; $picto='payment'; diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index a1d3c53052c..11a61874e7e 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -771,7 +771,7 @@ class RemiseCheque extends CommonObject $result=''; $label = $langs->trans("ShowCheckReceipt").': '.$this->ref; - $lien = ''; + $lien = ''; $lienfin=''; if ($withpicto) $result.=($lien.img_object($label, 'payment', 'class="classfortooltip"').$lienfin); diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index b303420dd15..b73eb490296 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -750,7 +750,7 @@ class Paiement extends CommonObject $result=''; $label = $langs->trans("ShowPayment").': '.$this->ref; - $lien = ''; + $lien = ''; $lienfin=''; if ($withpicto) $result.=($lien.img_object($langs->trans("ShowPayment"), 'payment', 'class="classfortooltip"').$lienfin); diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 3a30cf690d3..22e0a078c23 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1120,12 +1120,12 @@ class BonPrelevement extends CommonObject $result=''; $label = $langs->trans("ShowWithdraw").': '.$this->ref; - $lien = ''; + $lien = ''; $lienfin=''; if ($option == 'xxx') { - $lien = ''; + $lien = ''; $lienfin=''; } diff --git a/htdocs/compta/salaries/class/paymentsalary.class.php b/htdocs/compta/salaries/class/paymentsalary.class.php index 1e2d437793c..83a1c937545 100644 --- a/htdocs/compta/salaries/class/paymentsalary.class.php +++ b/htdocs/compta/salaries/class/paymentsalary.class.php @@ -488,7 +488,7 @@ class PaymentSalary extends CommonObject $result=''; $label=$langs->trans("ShowSalaryPayment").': '.$this->ref; - $lien = ''; + $lien = ''; $lienfin=''; $picto='payment'; diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index d0fe9b11ea3..af8eedb617c 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -422,7 +422,7 @@ class ChargeSociales extends CommonObject if (empty($this->ref)) $this->ref=$this->lib; $label = $langs->trans("ShowSocialContribution").': '.$this->ref; - $lien = ''; + $lien = ''; $lienfin=''; if ($withpicto) $result.=($lien.img_object($label, 'bill', 'class="classfortooltip"').$lienfin.' '); diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 55316e15b22..cf407e091f4 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -589,7 +589,7 @@ class PaymentSocialContribution extends CommonObject if (!empty($this->id)) { - $lien = ''; + $lien = ''; $lienfin=''; if ($withpicto) $result.=($lien.img_object($label, 'payment', 'class="classfortooltip"').$lienfin.' '); diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index 4730d72e596..c32297a7e12 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -640,7 +640,7 @@ class Tva extends CommonObject $result=''; $label=$langs->trans("ShowVatPayment").': '.$this->ref; - $lien = ''; + $lien = ''; $lienfin=''; $picto='payment'; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 40be02a3ef1..f3cbeccd586 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -889,12 +889,12 @@ class Contact extends CommonObject $result=''; $label = $langs->trans("ShowContact").': '.$this->getFullName($langs); - $lien = ''; + $lien = ''; $lienfin=''; if ($option == 'xxx') { - $lien = ''; + $lien = ''; $lienfin=''; } diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 00dce5b3336..4d455f79369 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1684,7 +1684,7 @@ class Contrat extends CommonObject $result=''; $label=$langs->trans("ShowContract").': '.$this->ref; - $lien = ''; + $lien = ''; $lienfin=''; $picto='contract'; @@ -2213,7 +2213,7 @@ class ContratLigne extends CommonObject $result=''; $label=$langs->trans("ShowContractOfService").': '.$this->label; - $lien = ''; + $lien = ''; $lienfin=''; $picto='contract'; diff --git a/htdocs/core/boxes/box_actions.php b/htdocs/core/boxes/box_actions.php index 89d05b92b79..ed5e731d896 100644 --- a/htdocs/core/boxes/box_actions.php +++ b/htdocs/core/boxes/box_actions.php @@ -60,8 +60,7 @@ class box_actions extends ModeleBoxes $this->info_box_head = array('text' => $langs->trans("BoxTitleLastActionsToDo",$max)); - if ($user->rights->agenda->myactions->read) - { + if ($user->rights->agenda->myactions->read) { $sql = "SELECT a.id, a.label, a.datep as dp, a.percent as percentage,"; $sql.= " ta.code, ta.libelle as type_label,"; $sql.= " s.nom as name, s.rowid as socid"; @@ -80,15 +79,13 @@ class box_actions extends ModeleBoxes dol_syslog("Box_actions::loadBox", LOG_DEBUG); $result = $db->query($sql); - if ($result) - { + if ($result) { $now=dol_now(); $delay_warning=$conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60; $num = $db->num_rows($result); $i = 0; - while ($i < $num) - { + while ($i < $num) { $late = ''; $objp = $db->fetch_object($result); $datelimite=$db->jdate($objp->dp); @@ -98,48 +95,68 @@ class box_actions extends ModeleBoxes //($langs->transnoentities("Action".$objp->code)!=("Action".$objp->code) ? $langs->transnoentities("Action".$objp->code) : $objp->label) $label=empty($objp->label)?$objp->type_label:$objp->label; - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', - 'logo' => ("action"), - 'url' => DOL_URL_ROOT."/comm/action/card.php?id=".$objp->id); + $this->info_box_contents[$i][0] = array( + 'td' => 'align="left" width="16"', + 'logo' => ("action"), + 'tooltip' => $langs->trans('Action'.$objp->code).': '.$label, + 'url' => DOL_URL_ROOT."/comm/action/card.php?id=".$objp->id, + ); - $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' => dol_trunc($label,32), - 'text2'=> $late, - 'url' => DOL_URL_ROOT."/comm/action/card.php?id=".$objp->id); + $this->info_box_contents[$i][1] = array( + 'td' => 'align="left"', + 'text' => dol_trunc($label,32), + 'text2'=> $late, + 'tooltip' => $langs->trans('Action'.$objp->code).': '.$label, + 'url' => DOL_URL_ROOT."/comm/action/card.php?id=".$objp->id, + ); - $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', - 'logo' => ($objp->socid?'company':''), - 'url' => ($objp->socid?DOL_URL_ROOT."/societe/soc.php?socid=".$objp->socid:'')); + $this->info_box_contents[$i][2] = array( + 'td' => 'align="left" width="16"', + 'logo' => ($objp->socid?'company':''), + 'tooltip' => $langs->trans('Customer').': '.$objp->name, + 'url' => ($objp->socid?DOL_URL_ROOT."/societe/soc.php?socid=".$objp->socid:''), + ); - $this->info_box_contents[$i][3] = array('td' => 'align="left"', - 'text' => dol_trunc($objp->name,24), - 'url' => DOL_URL_ROOT."/societe/soc.php?socid=".$objp->socid); + $this->info_box_contents[$i][3] = array( + 'td' => 'align="left"', + 'text' => dol_trunc($objp->name,24), + 'tooltip' => $langs->trans('Customer').': '.$objp->name, + 'url' => DOL_URL_ROOT."/societe/soc.php?socid=".$objp->socid, + ); - $this->info_box_contents[$i][4] = array('td' => 'align="left" class="nowrap"', - 'text' => dol_print_date($datelimite, "dayhour")); + $this->info_box_contents[$i][4] = array( + 'td' => 'align="left" class="nowrap"', + 'text' => dol_print_date($datelimite, "dayhour"), + ); - $this->info_box_contents[$i][5] = array('td' => 'align="right"', - 'text' => ($objp->percentage>= 0?$objp->percentage.'%':'')); + $this->info_box_contents[$i][5] = array( + 'td' => 'align="right"', + 'text' => ($objp->percentage>= 0?$objp->percentage.'%':''), + ); - $this->info_box_contents[$i][6] = array('td' => 'align="right" width="18"', - 'text' => $actionstatic->LibStatut($objp->percentage,3)); + $this->info_box_contents[$i][6] = array( + 'td' => 'align="right" width="18"', + 'text' => $actionstatic->LibStatut($objp->percentage,3), + ); - $i++; - } + $i++; + } if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoActionsToDo")); $db->free($result); - } - else { - $this->info_box_contents[0][0] = array( 'td' => 'align="left"', - 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql)); - } - } - else { - $this->info_box_contents[0][0] = array('align' => 'left', - 'text' => $langs->trans("ReadPermissionNotAllowed")); + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql), + ); + } + } else { + $this->info_box_contents[0][0] = array( + 'align' => 'left', + 'text' => $langs->trans("ReadPermissionNotAllowed"), + ); } } diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index d118bc8a4bc..9eaeb1d8cb4 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -1,6 +1,7 @@ - * Copyright (C) 2005-2013 Laurent Destailleur + * Copyright (C) 2005-2013 Laurent Destailleur + * Copyright (C) 2014 Frederic France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,9 +18,9 @@ */ /** - * \file htdocs/core/boxes/box_activity.php - * \ingroup societes - * \brief Module to show box of bills, orders & propal of the current year + * \file htdocs/core/boxes/box_activity.php + * \ingroup societes + * \brief Module to show box of bills, orders & propal of the current year */ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php'; @@ -29,275 +30,416 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php'; */ class box_activity extends ModeleBoxes { - var $boxcode="activity"; - var $boximg="object_bill"; - var $boxlabel='BoxGlobalActivity'; - var $depends = array("facture"); + var $boxcode="activity"; + var $boximg="object_bill"; + var $boxlabel='BoxGlobalActivity'; + var $depends = array("facture"); - var $db; - var $param; - var $enabled = 1; + var $db; + var $param; + var $enabled = 1; - var $info_box_head = array(); - var $info_box_contents = array(); + var $info_box_head = array(); + var $info_box_contents = array(); - /** - * Constructor - * - * @param DoliDB $db Database handler - * @param string $param More parameters - */ - function __construct($db,$param) - { - global $conf; + /** + * Constructor + * + * @param DoliDB $db Database handler + * @param string $param More parameters + */ + function __construct($db,$param) + { + global $conf; - $this->db=$db; - // FIXME: Use a cache to save data because this slow down too much main home page. This box slow down too seriously software. - // FIXME: Removed number_format (not compatible with all languages) - // FIXME: Pb into some status - $this->enabled=$conf->global->MAIN_FEATURES_LEVEL; // Not enabled by default due to bugs (see previous comments) - } + $this->db=$db; + // FIXME: Pb into some status + $this->enabled=$conf->global->MAIN_FEATURES_LEVEL; // Not enabled by default due to bugs (see previous comments) + } - /** - * Charge les donnees en memoire pour affichage ulterieur - * - * @param int $max Maximum number of records to load - * @return void - */ - function loadBox($max=5) - { - global $conf, $user, $langs, $db; + /** + * Charge les donnees en memoire pour affichage ulterieur + * + * @param int $max Maximum number of records to load + * @return void + */ + function loadBox($max=5) + { + global $conf, $user, $langs, $db; - $totalMnt = 0; - $totalnb = 0; - $i = 0; + include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + $totalMnt = 0; + $totalnb = 0; + $i = 0; + $cachetime = 3600; + $fileid = '-e'.$conf->entity.'-u'.$user->id.'-s'.$user->societe_id.'-r'.($user->rights->societe->client->voir?'1':'0').'.cache'; + $now = dol_now(); + $nbofyears=2; - $nbofyears=2; - if (! empty($conf->global->MAIN_BOX_ACTIVITY_DURATION)) $nbofyears=$conf->global->MAIN_BOX_ACTIVITY_DURATION; - $textHead = $langs->trans("Activity").' ('.$nbofyears.' '.$langs->trans("DurationYears").')'; - $this->info_box_head = array('text' => $textHead, 'limit'=> dol_strlen($textHead)); + if (! empty($conf->global->MAIN_BOX_ACTIVITY_DURATION)) $nbofyears=$conf->global->MAIN_BOX_ACTIVITY_DURATION; + $textHead = $langs->trans("Activity").' '.$nbofyears.' '.$langs->trans("DurationYears").''; + $this->info_box_head = array( + 'text' => $textHead, + 'limit'=> dol_strlen($textHead), + ); - // compute the year limit to show - $tmpdate= dol_time_plus_duree(dol_now(), -1*$nbofyears, "y"); + // compute the year limit to show + $tmpdate= dol_time_plus_duree(dol_now(), -1*$nbofyears, "y"); - // list the summary of the bills - if (! empty($conf->facture->enabled) && $user->rights->facture->lire) - { - include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; - $facturestatic=new Facture($db); + // list the summary of the bills + if (! empty($conf->facture->enabled) && $user->rights->facture->lire) { + include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; + $facturestatic=new Facture($db); - $sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb"; - $sql.= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= ")"; - $sql.= " WHERE f.entity = ".$conf->entity; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; - $sql.= " AND f.fk_soc = s.rowid"; - $sql.= " AND f.datef >= '".$db->idate($tmpdate)."' AND paye=1"; - $sql.= " GROUP BY f.fk_statut"; - $sql.= " ORDER BY f.fk_statut DESC"; + $cachefile = DOL_DATA_ROOT.'/facture/temp/boxactivity-invoice'.$fileid; + $refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile); + $data = array(); + if ($refresh) { + $sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb"; + $sql.= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; + if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql.= ")"; + $sql.= " WHERE f.entity = ".$conf->entity; + if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; + $sql.= " AND f.fk_soc = s.rowid"; + $sql.= " AND f.datef >= '".$db->idate($tmpdate)."' AND paye=1"; + $sql.= " GROUP BY f.fk_statut"; + $sql.= " ORDER BY f.fk_statut DESC"; - $result = $db->query($sql); - if ($result) - { - $num = $db->num_rows($result); - while ($i < $num) - { - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => 'bill'); - $objp = $db->fetch_object($result); + $result = $db->query($sql); + if ($result) { + $num = $db->num_rows($result); + $j=0; + while ($j < $num) { + $data[$j]=$db->fetch_object($result); + $j++; + } + file_put_contents($cachefile,serialize($data),LOCK_EX); + $db->free($result); + } else { + dol_print_error($db); + } + } else { + $data = unserialize(file_get_contents($cachefile)); + } + if (! empty($data)) { + $j=0; + while ($i < count($data)) { + $billurl="viewstatut=2&paye=1&year=".$data[$j]->annee; + $this->info_box_contents[$i][0] = array( + 'td' => 'align="left" width="16"', + 'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(1,$data[$j]->fk_statut,0), + 'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills", + 'logo' => 'bill', + ); - $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $langs->trans("Bills")." ".$facturestatic->LibStatut(1,$objp->fk_statut,0)." ".$objp->annee); - $billurl="viewstatut=2&paye=1&year=".$objp->annee; + $this->info_box_contents[$i][1] = array( + 'td' => 'align="left"', + 'text' => $langs->trans("Bills")." ".$facturestatic->LibStatut(1,$data[$j]->fk_statut,0)." ".$data[$j]->annee, + ); - $this->info_box_contents[$i][2] = array('td' => 'align="right"', - 'text' => $objp->nb, 'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills" - ); + $this->info_box_contents[$i][2] = array( + 'td' => 'align="right"', + 'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(1,$data[$j]->fk_statut,0), + 'text' => $data[$j]->nb, + 'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills", + ); - $this->info_box_contents[$i][3] = array('td' => 'align="right"', - 'text' => price($objp->Mnttot,1,$langs,0,0,-1,$conf->currency) - ); + $this->info_box_contents[$i][3] = array( + 'td' => 'align="right"', + 'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency) + ); - // We add only for the current year - if ($objp->annee == date("Y")) - { - $totalnb += $objp->nb; - $totalMnt += $objp->Mnttot; - } - $this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"', 'text' => $facturestatic->LibStatut(1,$objp->fk_statut,3) ); - $i++; - } - if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedInvoices")); + // We add only for the current year + if ($data[$j]->annee == date("Y")) { + $totalnb += $data[$j]->nb; + $totalMnt += $data[$j]->Mnttot; + } + $this->info_box_contents[$i][4] = array( + 'td' => 'align="right" width="18"', + 'text' => $facturestatic->LibStatut(1,$data[$j]->fk_statut,3), + ); + $i++; + $j++; + } + if (count($data)==0) + $this->info_box_contents[$i][0] = array( + 'td' => 'align="center"', + 'text'=>$langs->trans("NoRecordedInvoices"), + ); + } - $db->free($result); - } - else dol_print_error($db); + $cachefile = DOL_DATA_ROOT.'/facture/temp/boxactivity-invoice2'.$fileid; + $refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile); - $sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb"; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; - $sql.= " WHERE f.entity = ".$conf->entity; - $sql.= " AND f.fk_soc = s.rowid"; - $sql.= " AND paye=0"; - $sql.= " GROUP BY f.fk_statut"; - $sql.= " ORDER BY f.fk_statut DESC"; + if ($refresh) { + $sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb"; + $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; + $sql.= " WHERE f.entity = ".$conf->entity; + $sql.= " AND f.fk_soc = s.rowid"; + $sql.= " AND paye=0"; + $sql.= " GROUP BY f.fk_statut"; + $sql.= " ORDER BY f.fk_statut DESC"; - $result = $db->query($sql); - if ($result) - { - $num = $db->num_rows($result) + $i; - $now=dol_now(); + $result = $db->query($sql); + if ($result) { + $num = $db->num_rows($result) + $i; + $j=0; + while ($j < $num) { + $data[$j]=$db->fetch_object($result); + $j++; + } + file_put_contents($cachefile,serialize($data),LOCK_EX); + $db->free($result); + } else { + dol_print_error($db); + } + } else { + $data = unserialize(file_get_contents($cachefile)); + } + if (! empty($data)) { + $j=0; - while ($i < $num) - { - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', - 'logo' => 'bill'); - $objp = $db->fetch_object($result); + while ($i < count($data)) { + $billurl="viewstatut=".$data[$j]->fk_statut."&paye=0"; + $this->info_box_contents[$i][0] = array( + 'td' => 'align="left" width="16"', + 'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(0,$data[$j]->fk_statut,0), + 'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills", + 'logo' => 'bill', + ); - $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' => $langs->trans("Bills")." ".$facturestatic->LibStatut(0,$objp->fk_statut,0)); + $this->info_box_contents[$i][1] = array( + 'td' => 'align="left"', + 'text' => $langs->trans("Bills")." ".$facturestatic->LibStatut(0,$data[$j]->fk_statut,0), + ); - $billurl="viewstatut=".$objp->fk_statut."&paye=0"; - $this->info_box_contents[$i][2] = array('td' => 'align="right"', - 'text' => $objp->nb, 'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills" - ); - $totalnb += $objp->nb; - $this->info_box_contents[$i][3] = array('td' => 'align="right"', - 'text' => price($objp->Mnttot,1,$langs,0,0,-1,$conf->currency) - ); - $totalMnt += $objp->Mnttot; - $this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"', - 'text' => $facturestatic->LibStatut(0,$objp->fk_statut,3) - ); - $i++; - } - if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedInvoices")); - } else { - $this->info_box_contents[0][0] = array( 'td' => 'align="left"', 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql)); - } - } + $this->info_box_contents[$i][2] = array( + 'td' => 'align="right"', + 'text' => $data[$j]->nb, + 'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(0,$data[$j]->fk_statut,0), + 'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills", + ); + $totalnb += $data[$j]->nb; + $this->info_box_contents[$i][3] = array( + 'td' => 'align="right"', + 'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency), + ); + $totalMnt += $objp->Mnttot; + $this->info_box_contents[$i][4] = array( + 'td' => 'align="right" width="18"', + 'text' => $facturestatic->LibStatut(0,$data[$j]->fk_statut,3), + ); + $i++; + $j++; + } + if ($num==0) + $this->info_box_contents[$i][0] = array( + 'td' => 'align="center"', + 'text'=>$langs->trans("NoRecordedInvoices"), + ); + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql), + ); + } + } - // list the summary of the orders - if (! empty($conf->commande->enabled) && $user->rights->commande->lire) - { - include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; - $commandestatic=new Commande($db); + // list the summary of the orders + if (! empty($conf->commande->enabled) && $user->rights->commande->lire) { + include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; + $commandestatic=new Commande($db); - $sql = "SELECT c.fk_statut, sum(c.total_ttc) as Mnttot, count(*) as nb"; - $sql.= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= ")"; - $sql.= " WHERE c.entity = ".$conf->entity; - $sql.= " AND c.fk_soc = s.rowid"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; - $sql.= " AND c.date_commande >= '".$db->idate($tmpdate)."'"; - $sql.= " AND c.facture=0"; - $sql.= " GROUP BY c.fk_statut"; - $sql.= " ORDER BY c.fk_statut DESC"; + $cachefile = DOL_DATA_ROOT.'/commande/temp/boxactivity-order'.$fileid; + $refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile); + $data = array(); + if ($refresh) { - $result = $db->query($sql); + $sql = "SELECT c.fk_statut, sum(c.total_ttc) as Mnttot, count(*) as nb"; + $sql.= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c"; + if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql.= ")"; + $sql.= " WHERE c.entity = ".$conf->entity; + $sql.= " AND c.fk_soc = s.rowid"; + if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; + $sql.= " AND c.date_commande >= '".$db->idate($tmpdate)."'"; + $sql.= " AND c.facture=0"; + $sql.= " GROUP BY c.fk_statut"; + $sql.= " ORDER BY c.fk_statut DESC"; - if ($result) - { - $num = $db->num_rows($result) + $i; - while ($i < $num) - { - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"','logo' => 'object_order'); + $result = $db->query($sql); - $objp = $db->fetch_object($result); - $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' =>$langs->trans("Orders")." ".$commandestatic->LibStatut($objp->fk_statut,0,0) - ); + if ($result) { + $num = $db->num_rows($result) + $i; + $j=0; + while ($j < $num) { + $data[$j]=$db->fetch_object($result); + $j++; + } + file_put_contents($cachefile,serialize($data),LOCK_EX); + $db->free($result); + } else { + dol_print_error($db); + } + } else { + $data = unserialize(file_get_contents($cachefile)); + } + if (! empty($data)) { + $j=0; + while ($i < count($data)) { + $this->info_box_contents[$i][0] = array( + 'td' => 'align="left" width="16"', + 'url' => DOL_URL_ROOT."/commande/list.php?mainmenu=commercial&leftmenu=orders&viewstatut=".$data[$j]->fk_statut, + 'tooltip' => $langs->trans("Orders")." ".$commandestatic->LibStatut($data[$j]->fk_statut,0,0), + 'logo' => 'object_order', + ); - $this->info_box_contents[$i][2] = array('td' => 'align="right"', - 'text' => $objp->nb, - 'url' => DOL_URL_ROOT."/commande/list.php?mainmenu=commercial&leftmenu=orders&viewstatut=".$objp->fk_statut - ); - $totalnb += $objp->nb; + $this->info_box_contents[$i][1] = array( + 'td' => 'align="left"', + 'text' =>$langs->trans("Orders")." ".$commandestatic->LibStatut($data[$j]->fk_statut,0,0), + ); - $this->info_box_contents[$i][3] = array('td' => 'align="right"', - 'text' => price($objp->Mnttot,1,$langs,0,0,-1,$conf->currency) - ); - $totalMnt += $objp->Mnttot; - $this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"', 'text' => $commandestatic->LibStatut($objp->fk_statut,0,3)); + $this->info_box_contents[$i][2] = array( + 'td' => 'align="right"', + 'text' => $data[$j]->nb, + 'tooltip' => $langs->trans("Orders")." ".$commandestatic->LibStatut($data[$j]->fk_statut,0,0), + 'url' => DOL_URL_ROOT."/commande/list.php?mainmenu=commercial&leftmenu=orders&viewstatut=".$data[$j]->fk_statut, + ); + $totalnb += $data[$j]->nb; - $i++; - } - } - else dol_print_error($db); - } + $this->info_box_contents[$i][3] = array( + 'td' => 'align="right"', + 'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency), + ); + $totalMnt += $data[$j]->Mnttot; + $this->info_box_contents[$i][4] = array( + 'td' => 'align="right" width="18"', + 'text' => $commandestatic->LibStatut($data[$j]->fk_statut,0,3), + ); - // list the summary of the propals - if (! empty($conf->propal->enabled) && $user->rights->propal->lire) - { - include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; - $propalstatic=new Propal($db); + $i++; + $j++; + } + } + } - $sql = "SELECT p.fk_statut, SUM(p.total) as Mnttot, COUNT(*) as nb"; - $sql.= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= ")"; - $sql.= " WHERE p.entity = ".$conf->entity; - $sql.= " AND p.fk_soc = s.rowid"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; - $sql.= " AND p.datep >= '".$db->idate($tmpdate)."'"; - $sql.= " AND p.date_cloture IS NULL"; // just unclosed - $sql.= " GROUP BY p.fk_statut"; - $sql.= " ORDER BY p.fk_statut DESC"; + // list the summary of the propals + if (! empty($conf->propal->enabled) && $user->rights->propal->lire) { + include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; + $propalstatic=new Propal($db); - $result = $db->query($sql); + $cachefile = DOL_DATA_ROOT.'/propale/temp/boxactivity-propal'.$fileid; + $refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile); + $data = array(); + if ($refresh) { + $sql = "SELECT p.fk_statut, SUM(p.total) as Mnttot, COUNT(*) as nb"; + $sql.= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p"; + if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql.= ")"; + $sql.= " WHERE p.entity = ".$conf->entity; + $sql.= " AND p.fk_soc = s.rowid"; + if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; + $sql.= " AND p.datep >= '".$db->idate($tmpdate)."'"; + $sql.= " AND p.date_cloture IS NULL"; // just unclosed + $sql.= " GROUP BY p.fk_statut"; + $sql.= " ORDER BY p.fk_statut DESC"; - if ($result) - { - $num = $db->num_rows($result) + $i; - while ($i < $num) - { - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"','logo' => 'object_propal'); + $result = $db->query($sql); - $objp = $db->fetch_object($result); - $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' =>$langs->trans("Proposals")." ".$propalstatic->LibStatut($objp->fk_statut,0) - ); + if ($result) { + $num = $db->num_rows($result) + $i; + $j=0; + while ($j < $num) { + $data[$j]=$db->fetch_object($result); + $j++; + } + file_put_contents($cachefile,serialize($data),LOCK_EX); + $db->free($result); + } else { + dol_print_error($db); + } + } else { + $data = unserialize(file_get_contents($cachefile)); + } + if (! empty($data)) { + $j=0; + while ($i < count($data)) { + $this->info_box_contents[$i][0] = array( + 'td' => 'align="left" width="16"', + 'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&viewstatut=".$data[$j]->fk_statut, + 'tooltip' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0), + 'logo' => 'object_propal' + ); - $this->info_box_contents[$i][2] = array('td' => 'align="right"', - 'text' => $objp->nb, - 'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&viewstatut=".$objp->fk_statut - ); - $totalnb += $objp->nb; + $objp = $db->fetch_object($result); + $this->info_box_contents[$i][1] = array( + 'td' => 'align="left"', + 'text' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0), + ); - $this->info_box_contents[$i][3] = array('td' => 'align="right"', - 'text' => price($objp->Mnttot,1,$langs,0,0,-1,$conf->currency) - ); - $totalMnt += $objp->Mnttot; - $this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"', 'text' => $propalstatic->LibStatut($objp->fk_statut,3)); + $this->info_box_contents[$i][2] = array( + 'td' => 'align="right"', + 'text' => $data[$j]->nb, + 'tooltip' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0), + 'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&viewstatut=".$data[$j]->fk_statut, + ); + $totalnb += $data[$j]->nb; - $i++; - } - } - else dol_print_error($db); - } + $this->info_box_contents[$i][3] = array( + 'td' => 'align="right"', + 'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency), + ); + $totalMnt += $data[$j]->Mnttot; + $this->info_box_contents[$i][4] = array( + 'td' => 'align="right" width="18"', + 'text' => $propalstatic->LibStatut($data[$j]->fk_statut,3), + ); - // Add the sum in the bottom of the boxes - $this->info_box_contents[$i][1] = array('td' => 'align="left" ', 'text' => $langs->trans("Total")." ".$textHead); - $this->info_box_contents[$i][2] = array('td' => 'align="right" ', 'text' => $totalnb); - $this->info_box_contents[$i][3] = array('td' => 'align="right" ', 'text' => price($totalMnt,1,$langs,0,0,-1,$conf->currency)); - $this->info_box_contents[$i][4] = array('td' => 'align="right" ', 'text' => ""); - $this->info_box_contents[$i][5] = array('td' => 'align="right"', 'text' => ""); - } + $i++; + $j++; + } + } + } - /** - * Method to show box - * - * @param array $head Array with properties of box title - * @param array $contents Array with properties of box lines - * @return void - */ - function showBox($head = null, $contents = null) - { - parent::showBox($this->info_box_head, $this->info_box_contents); - } + // Add the sum in the bottom of the boxes + $this->info_box_contents[$i][1] = array( + 'td' => 'align="left" ', + 'text' => $langs->trans("Total")." ".$textHead, + ); + $this->info_box_contents[$i][2] = array( + 'td' => 'align="right" ', + 'text' => $totalnb, + ); + $this->info_box_contents[$i][3] = array( + 'td' => 'align="right" ', + 'text' => price($totalMnt,1,$langs,0,0,-1,$conf->currency) + ); + $this->info_box_contents[$i][4] = array( + 'td' => 'align="right" ', + 'text' => "", + ); + $this->info_box_contents[$i][5] = array( + 'td' => 'align="right"', + 'text' => "", + ); + } + + /** + * Method to show box + * + * @param array $head Array with properties of box title + * @param array $contents Array with properties of box lines + * @return void + */ + function showBox($head = null, $contents = null) + { + parent::showBox($this->info_box_head, $this->info_box_contents); + } } diff --git a/htdocs/core/boxes/box_bookmarks.php b/htdocs/core/boxes/box_bookmarks.php index 968eefef4b9..5250108f76c 100644 --- a/htdocs/core/boxes/box_bookmarks.php +++ b/htdocs/core/boxes/box_bookmarks.php @@ -52,10 +52,11 @@ class box_bookmarks extends ModeleBoxes $this->max=$max; - $this->info_box_head = array('text' => $langs->trans("BoxMyLastBookmarks",$max), - 'sublink' => DOL_URL_ROOT.'/bookmarks/list.php'); - if ($user->rights->bookmark->creer) - { + $this->info_box_head = array( + 'text' => $langs->trans("BoxMyLastBookmarks",$max), + 'sublink' => DOL_URL_ROOT.'/bookmarks/list.php', + ); + if ($user->rights->bookmark->creer) { $this->info_box_head['subpicto']='object_bookmark'; $this->info_box_head['subtext']=$langs->trans("BookmarksManagement"); } @@ -81,43 +82,52 @@ class box_bookmarks extends ModeleBoxes $i = 0; - while ($i < $num) - { - $objp = $db->fetch_object($result); + while ($i < $num) { + $objp = $db->fetch_object($result); - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'url' => $objp->url, - 'target' => $objp->target?'newtab':''); - $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' => $objp->title, - 'url' => $objp->url, - 'target' => $objp->target?'newtab':''); + $this->info_box_contents[$i][0] = array( + 'td' => 'align="left" width="16"', + 'logo' => $this->boximg, + 'url' => $objp->url, + 'tooltip' => $objp->title, + 'target' => $objp->target?'newtab':'', + ); + $this->info_box_contents[$i][1] = array( + 'td' => 'align="left"', + 'text' => $objp->title, + 'url' => $objp->url, + 'tooltip' => $objp->title, + 'target' => $objp->target?'newtab':'', + ); - $i++; - } + $i++; + } - if ($num==0) - { - $mytxt=$langs->trans("NoRecordedBookmarks"); - if ($user->rights->bookmark->creer) $mytxt.=' '.$langs->trans("ClickToAdd"); - $this->info_box_contents[$i][0] = array('td' => 'align="center" colspan="2"', 'url'=> DOL_URL_ROOT.'/bookmarks/list.php', 'text'=>$mytxt); - } + if ($num==0) { + $mytxt=$langs->trans("NoRecordedBookmarks"); + if ($user->rights->bookmark->creer) $mytxt.=' '.$langs->trans("ClickToAdd"); + $this->info_box_contents[$i][0] = array( + 'td' => 'align="center" colspan="2"', + 'tooltip' => $mytxt, + 'url'=> DOL_URL_ROOT.'/bookmarks/list.php', 'text'=>$mytxt, + ); + } - $db->free($result); - } - else - { - $this->info_box_contents[0][0] = array( 'td' => 'align="left"', - 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql)); - } - } - else { - $this->info_box_contents[0][0] = array('align' => 'left', - 'text' => $langs->trans("ReadPermissionNotAllowed")); - } - } + $db->free($result); + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql), + ); + } + } else { + $this->info_box_contents[0][0] = array( + 'align' => 'left', + 'text' => $langs->trans("ReadPermissionNotAllowed"), + ); + } + } /** * Method to show box diff --git a/htdocs/core/boxes/box_clients.php b/htdocs/core/boxes/box_clients.php index 4e651e8bdcc..01e0dc92635 100644 --- a/htdocs/core/boxes/box_clients.php +++ b/htdocs/core/boxes/box_clients.php @@ -104,19 +104,28 @@ class box_clients extends ModeleBoxes $datec=$db->jdate($objp->datec); $datem=$db->jdate($objp->tms); - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'url' => $url.$objp->socid); + $this->info_box_contents[$i][0] = array( + 'td' => 'align="left" width="16"', + 'logo' => $this->boximg, + 'tooltip' => $langs->trans('Customer').': '.$objp->name, + 'url' => $url.$objp->socid + ); + $this->info_box_contents[$i][1] = array( + 'td' => 'align="left"', + 'text' => $objp->name, + 'tooltip' => $langs->trans('Customer').': '.$objp->name, + 'url' => $url.$objp->socid + ); - $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' => $objp->name, - 'url' => $url.$objp->socid); + $this->info_box_contents[$i][2] = array( + 'td' => 'align="right"', + 'text' => dol_print_date($datem, "day") + ); - $this->info_box_contents[$i][2] = array('td' => 'align="right"', - 'text' => dol_print_date($datem, "day")); - - $this->info_box_contents[$i][3] = array('td' => 'align="right" width="18"', - 'text' => $thirdpartystatic->LibStatut($objp->status,3)); + $this->info_box_contents[$i][3] = array( + 'td' => 'align="right" width="18"', + 'text' => $thirdpartystatic->LibStatut($objp->status,3) + ); $i++; } diff --git a/htdocs/core/boxes/box_commandes.php b/htdocs/core/boxes/box_commandes.php index 1bb6fe9b27a..670a5358d20 100644 --- a/htdocs/core/boxes/box_commandes.php +++ b/htdocs/core/boxes/box_commandes.php @@ -80,70 +80,85 @@ class box_commandes extends ModeleBoxes $sql.= $db->plimit($max, 0); $result = $db->query($sql); - if ($result) - { + if ($result) { $num = $db->num_rows($result); $i = 0; - while ($i < $num) - { + while ($i < $num) { $objp = $db->fetch_object($result); $date=$db->jdate($objp->date_commande); - $datem=$db->jdate($objp->tms); + $datem=$db->jdate($objp->tms); - $this->info_box_contents[$i][] = array('td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'url' => DOL_URL_ROOT."/commande/card.php?id=".$objp->rowid); - - $this->info_box_contents[$i][] = array('td' => 'align="left"', - 'text' => $objp->ref, - 'url' => DOL_URL_ROOT."/commande/card.php?id=".$objp->rowid); - - $this->info_box_contents[$i][] = array('td' => 'align="left" width="16"', - 'logo' => 'company', - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); - - $this->info_box_contents[$i][] = array('td' => 'align="left"', - 'text' => $objp->name, - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); - - $this->info_box_contents[$i][] = array('td' => 'align="right"', - 'text' => price($objp->total_ht), - ); - - if (! empty($conf->global->ORDER_BOX_LAST_ORDERS_SHOW_VALIDATE_USER)) - { - if ($objp->fk_user_valid > 0) $userstatic->fetch($objp->fk_user_valid); - $this->info_box_contents[$i][] = array('td' => 'align="right"', - 'text' => (($objp->fk_user_valid > 0)?$userstatic->getNomUrl(1):''), - 'url' => (($objp->fk_user_valid > 0)?DOL_URL_ROOT.'/user/card.php?id='.$objp->fk_user_valid:'') - ); - } - - $this->info_box_contents[$i][] = array('td' => 'align="right"', - 'text' => dol_print_date($date,'day'), + $this->info_box_contents[$i][] = array( + 'td' => 'align="left" width="16"', + 'logo' => $this->boximg, + 'tooltip' => $langs->trans('Order').': '.$objp->ref, + 'url' => DOL_URL_ROOT."/commande/card.php?id=".$objp->rowid, ); - $this->info_box_contents[$i][] = array('td' => 'align="right" width="18"', - 'text' => $commandestatic->LibStatut($objp->fk_statut,$objp->facture,3)); + $this->info_box_contents[$i][] = array( + 'td' => 'align="left"', + 'text' => $objp->ref, + 'tooltip' => $langs->trans('Order').': '.$objp->ref, + 'url' => DOL_URL_ROOT."/commande/card.php?id=".$objp->rowid, + ); + $this->info_box_contents[$i][] = array( + 'td' => 'align="left" width="16"', + 'logo' => 'company', + 'tooltip' => $langs->trans('Customer').': '.$objp->name, + 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid, + ); + + $this->info_box_contents[$i][] = array( + 'td' => 'align="left"', + 'text' => $objp->name, + 'tooltip' => $langs->trans('Customer').': '.$objp->name, + 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid, + ); + + $this->info_box_contents[$i][] = array( + 'td' => 'align="right"', + 'text' => price($objp->total_ht), + ); + + if (! empty($conf->global->ORDER_BOX_LAST_ORDERS_SHOW_VALIDATE_USER)) { + if ($objp->fk_user_valid > 0) $userstatic->fetch($objp->fk_user_valid); + $this->info_box_contents[$i][] = array( + 'td' => 'align="right"', + 'text' => (($objp->fk_user_valid > 0)?$userstatic->getNomUrl(1):''), + 'url' => (($objp->fk_user_valid > 0)?DOL_URL_ROOT.'/user/card.php?id='.$objp->fk_user_valid:''), + ); + } + + $this->info_box_contents[$i][] = array( + 'td' => 'align="right"', + 'text' => dol_print_date($date,'day'), + ); + + $this->info_box_contents[$i][] = array( + 'td' => 'align="right" width="18"', + 'text' => $commandestatic->LibStatut($objp->fk_statut,$objp->facture,3), + ); $i++; } if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedOrders")); - $db->free($result); + $db->free($result); + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql), + ); } - else { - $this->info_box_contents[0][0] = array( 'td' => 'align="left"', - 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql)); - } - } - else { - $this->info_box_contents[0][0] = array('align' => 'left', - 'text' => $langs->trans("ReadPermissionNotAllowed")); + } else { + $this->info_box_contents[0][0] = array( + 'align' => 'left', + 'text' => $langs->trans("ReadPermissionNotAllowed"), + ); } } diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php index 45c8f1a4819..5340b06f0dd 100644 --- a/htdocs/core/boxes/box_comptes.php +++ b/htdocs/core/boxes/box_comptes.php @@ -2,7 +2,7 @@ /* Copyright (C) 2005 Christophe * Copyright (C) 2005-2013 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2013 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -76,8 +76,7 @@ class box_comptes extends ModeleBoxes $this->info_box_head = array('text' => $langs->trans("BoxTitleCurrentAccounts")); - if ($user->rights->banque->lire) - { + if ($user->rights->banque->lire) { $sql = "SELECT rowid, ref, label, bank, number, courant, clos, rappro, url,"; $sql.= " code_banque, code_guichet, cle_rib, bic, iban_prefix as iban,"; $sql.= " domiciliation, proprio, owner_address,"; @@ -90,76 +89,87 @@ class box_comptes extends ModeleBoxes $sql.= " ORDER BY label"; $sql.= $db->plimit($max, 0); - dol_syslog(get_class($this)."::loadBox", LOG_DEBUG); - $result = $db->query($sql); - if ($result) - { - $num = $db->num_rows($result); + dol_syslog(get_class($this)."::loadBox", LOG_DEBUG); + $result = $db->query($sql); + if ($result) { + $num = $db->num_rows($result); - $i = 0; - $solde_total = 0; + $i = 0; + $solde_total = array(); - $listofcurrencies=array(); - $account_static = new Account($db); - while ($i < $num) - { - $objp = $db->fetch_object($result); + $account_static = new Account($db); + while ($i < $num) { + $objp = $db->fetch_object($result); - $account_static->id = $objp->rowid; - $solde=$account_static->solde(0); + $account_static->id = $objp->rowid; + $solde=$account_static->solde(0); - $solde_total += $solde; + $solde_total[$objp->currency_code] += $solde; - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'url' => DOL_URL_ROOT."/compta/bank/account.php?account=".$objp->rowid); + $this->info_box_contents[$i][0] = array( + 'td' => 'align="left" width="16"', + 'logo' => $this->boximg, + 'tooltip' => $langs->trans('Account').': '.$objp->label, + 'url' => DOL_URL_ROOT."/compta/bank/account.php?account=".$objp->rowid, + ); - $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' => $objp->label, - 'url' => DOL_URL_ROOT."/compta/bank/account.php?account=".$objp->rowid); + $this->info_box_contents[$i][1] = array( + 'td' => 'align="left"', + 'text' => $objp->label, + 'tooltip' => $langs->trans('Account').': '.$objp->label, + 'url' => DOL_URL_ROOT."/compta/bank/account.php?account=".$objp->rowid, + ); - $this->info_box_contents[$i][2] = array('td' => 'align="left"', - 'text' => $objp->number - ); + $this->info_box_contents[$i][2] = array( + 'td' => 'align="left"', + 'text' => $objp->number, + ); - $this->info_box_contents[$i][3] = array('td' => 'align="right"', - 'text' => price($solde, 0, $langs, 0, 0, -1, $objp->currency_code) - ); + $this->info_box_contents[$i][3] = array( + 'td' => 'align="right"', + 'text' => price($solde, 0, $langs, 0, 0, -1, $objp->currency_code) + ); - $listofcurrencies[$objp->currency_code]=1; - $i++; - } + $i++; + } - // Total - if (count($listofcurrencies) <= 1) - { - $this->info_box_contents[$i][0] = array('tr' => 'class="liste_total"', 'td' => 'align="right" class="liste_total"', - 'text' => $langs->trans('Total') - ); - $this->info_box_contents[$i][1] = array('td' => 'align="right" class="liste_total"', - 'text' => ' ' - ); - $this->info_box_contents[$i][2] = array('td' => 'align="right" class="liste_total"', - 'text' => ' ' - ); - $totalamount=price($solde_total,0,$langs,0,0,-1,$conf->currency); - $this->info_box_contents[$i][3] = array('td' => 'align="right" class="liste_total"', - 'text' => $totalamount - ); - } + // Total + foreach ($solde_total as $key=>$solde) { + $this->info_box_contents[$i][0] = array( + 'tr' => 'class="liste_total"', + 'td' => 'align="right" class="liste_total"', + 'text' => ' ', + ); + $this->info_box_contents[$i][1] = array( + 'td' => 'align="left" class="liste_total"', + 'text' => $langs->trans('Total').' '.$key, + ); + $this->info_box_contents[$i][2] = array( + 'td' => 'align="right" class="liste_total"', + 'text' => ' ' + ); + $totalamount=price($solde,0,$langs,0,0,-1,$key); + $this->info_box_contents[$i][3] = array( + 'td' => 'align="right" class="liste_total"', + 'text' => $totalamount + ); + $i++; + } - $db->free($result); - } - else { - $this->info_box_contents[0][0] = array( 'td' => 'align="left"', - 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql)); - } - } - else { - $this->info_box_contents[0][0] = array('td' => 'align="left"', - 'text' => $langs->trans("ReadPermissionNotAllowed")); - } + $db->free($result); + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql), + ); + } + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'text' => $langs->trans("ReadPermissionNotAllowed"), + ); + } } diff --git a/htdocs/core/boxes/box_contacts.php b/htdocs/core/boxes/box_contacts.php index e10c9ae7ed9..8ec8bf77b9c 100644 --- a/htdocs/core/boxes/box_contacts.php +++ b/htdocs/core/boxes/box_contacts.php @@ -73,65 +73,83 @@ class box_contacts extends ModeleBoxes $sql.= $db->plimit($max, 0); $result = $db->query($sql); - if ($result) - { + if ($result) { $num = $db->num_rows($result); $contactstatic=new Contact($db); $societestatic=new Societe($db); $i = 0; - while ($i < $num) - { + while ($i < $num) { $objp = $db->fetch_object($result); $datec=$db->jdate($objp->datec); $datem=$db->jdate($objp->tms); - $contactstatic->lastname=$objp->lastname; + $contactstatic->lastname=$objp->lastname; $contactstatic->firstname=$objp->firstname; $contactstatic->civility_id=$objp->civility_id; $societestatic->id=$objp->fk_soc; $societestatic->name=$objp->socname; - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'url' => DOL_URL_ROOT."/contact/card.php?id=".$objp->rowid); + $this->info_box_contents[$i][0] = array( + 'td' => 'align="left" width="16"', + 'logo' => $this->boximg, + 'tooltip' => $langs->trans('Contact').': '.$contactstatic->getFullName($langs,0), + 'url' => DOL_URL_ROOT."/contact/card.php?id=".$objp->rowid, + ); - $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' => $contactstatic->getFullName($langs,0), - 'url' => DOL_URL_ROOT."/contact/card.php?id=".$objp->rowid); + $this->info_box_contents[$i][1] = array( + 'td' => 'align="left"', + 'text' => $contactstatic->getFullName($langs,0), + 'tooltip' => $langs->trans('Contact').': '.$contactstatic->getFullName($langs,0), + 'url' => DOL_URL_ROOT."/contact/card.php?id=".$objp->rowid, + ); - $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', - 'logo' => ($objp->fk_soc > 0?'company':''), - 'url' => ($objp->fk_soc > 0?DOL_URL_ROOT."/societe/soc.php?socid=".$objp->fk_soc:'')); + $this->info_box_contents[$i][2] = array( + 'td' => 'align="left" width="16"', + 'logo' => ($objp->fk_soc > 0?'company':''), + 'tooltip' => $societestatic->name, + 'url' => ($objp->fk_soc > 0?DOL_URL_ROOT."/societe/soc.php?socid=".$objp->fk_soc:''), + ); - $this->info_box_contents[$i][3] = array('td' => 'align="left"', - 'text' => $societestatic->name, - 'url' => DOL_URL_ROOT."/societe/soc.php?socid=".$objp->fk_soc); + $this->info_box_contents[$i][3] = array( + 'td' => 'align="left"', + 'text' => $societestatic->name, + 'tooltip' => $societestatic->name, + 'url' => DOL_URL_ROOT."/societe/soc.php?socid=".$objp->fk_soc, + ); - $this->info_box_contents[$i][4] = array('td' => 'align="right"', - 'text' => dol_print_date($datem, "day")); + $this->info_box_contents[$i][4] = array( + 'td' => 'align="right"', + 'text' => dol_print_date($datem, "day"), + ); - $i++; - } + $i++; + } - if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedContacts")); + if ($num==0) + $this->info_box_contents[$i][0] = array( + 'td' => 'align="center"', + 'text'=>$langs->trans("NoRecordedContacts"), + ); - $db->free($result); - } - else { - $this->info_box_contents[0][0] = array( 'td' => 'align="left"', - 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql)); - } - } - else { - $this->info_box_contents[0][0] = array('align' => 'left', - 'text' => $langs->trans("ReadPermissionNotAllowed")); - } + $db->free($result); + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql), + ); + } + } else { + $this->info_box_contents[0][0] = array( + 'align' => 'left', + 'text' => $langs->trans("ReadPermissionNotAllowed"), + ); + } - } + } /** * Method to show box diff --git a/htdocs/core/boxes/box_contracts.php b/htdocs/core/boxes/box_contracts.php index dc0ff8e5382..c980be624da 100644 --- a/htdocs/core/boxes/box_contracts.php +++ b/htdocs/core/boxes/box_contracts.php @@ -79,8 +79,7 @@ class box_contracts extends ModeleBoxes $i = 0; - while ($i < $num) - { + while ($i < $num) { $objp = $db->fetch_object($resql); $datec=$db->jdate($objp->datec); $dateterm=$db->jdate($objp->fin_validite); @@ -94,50 +93,69 @@ class box_contracts extends ModeleBoxes // fin_validite is no more on contract but on services // if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->contrat->cloture->warning_delay)) { $late = img_warning($langs->trans("Late")); } - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid); + $this->info_box_contents[$i][0] = array( + 'td' => 'align="left" width="16"', + 'logo' => $this->boximg, + 'tooltip' => $langs->trans('Contract').': '.($objp->ref?$objp->ref:$objp->rowid), + 'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid, + ); - $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' => ($objp->ref?$objp->ref:$objp->rowid), // Some contracts have no ref - 'text2'=> $late, - 'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid); + $this->info_box_contents[$i][1] = array( + 'td' => 'align="left"', + 'text' => ($objp->ref?$objp->ref:$objp->rowid), // Some contracts have no ref + 'tooltip' => $langs->trans('Contract').': '.($objp->ref?$objp->ref:$objp->rowid), + 'text2'=> $late, + 'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid, + ); - $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', - 'logo' => 'company', - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); + $this->info_box_contents[$i][2] = array( + 'td' => 'align="left" width="16"', + 'logo' => 'company', + 'tooltip' => $langs->trans('Customer').': '.$objp->name, + 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid, + ); - $this->info_box_contents[$i][3] = array('td' => 'align="left"', - 'text' => dol_trunc($objp->name,40), - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); + $this->info_box_contents[$i][3] = array( + 'td' => 'align="left"', + 'text' => dol_trunc($objp->name,40), + 'tooltip' => $langs->trans('Customer').': '.$objp->name, + 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid, + ); - $this->info_box_contents[$i][4] = array('td' => 'align="right"', - 'text' => dol_print_date($datec,'day')); + $this->info_box_contents[$i][4] = array( + 'td' => 'align="right"', + 'text' => dol_print_date($datec,'day'), + ); - $this->info_box_contents[$i][5] = array('td' => 'align="right" class="nowrap"', - 'text' => $contractstatic->getLibStatut(6), - 'asis'=>1 - ); + $this->info_box_contents[$i][5] = array( + 'td' => 'align="right" class="nowrap"', + 'text' => $contractstatic->getLibStatut(6), + 'asis'=>1, + ); - $i++; - } + $i++; + } - if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedContracts")); + if ($num==0) + $this->info_box_contents[$i][0] = array( + 'td' => 'align="center"', + 'text'=>$langs->trans("NoRecordedContracts"), + ); - $db->free($resql); - } - else - { - $this->info_box_contents[0][0] = array( 'td' => 'align="left"', - 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql)); - } - } - else - { - $this->info_box_contents[0][0] = array('td' => 'align="left"', - 'text' => $langs->trans("ReadPermissionNotAllowed")); - } + $db->free($resql); + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql), + ); + } + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'text' => $langs->trans("ReadPermissionNotAllowed"), + ); + } } /** diff --git a/htdocs/core/boxes/box_external_rss.php b/htdocs/core/boxes/box_external_rss.php index 354e79151f1..689efc751c6 100644 --- a/htdocs/core/boxes/box_external_rss.php +++ b/htdocs/core/boxes/box_external_rss.php @@ -98,8 +98,12 @@ class box_external_rss extends ModeleBoxes } else { - $this->info_box_head = array('text' => $title, - 'sublink' => $link, 'subtext'=>$langs->trans("LastRefreshDate").': '.($rssparser->getLastFetchDate()?dol_print_date($rssparser->getLastFetchDate(),"dayhourtext"):$langs->trans("Unknown")), 'subpicto'=>'object_bookmark'); + $this->info_box_head = array( + 'text' => $title, + 'sublink' => $link, + 'subtext'=>$langs->trans("LastRefreshDate").': '.($rssparser->getLastFetchDate()?dol_print_date($rssparser->getLastFetchDate(),"dayhourtext"):$langs->trans("Unknown")), + 'subpicto'=>'object_bookmark', + ); } // INFO on items @@ -112,8 +116,8 @@ class box_external_rss extends ModeleBoxes // Feed common fields $href = $item['link']; $title = urldecode($item['title']); - $date = $item['date_timestamp']; // date will be empty if conversion into timestamp failed - if ($rssparser->getFormat() == 'rss') // If RSS + $date = $item['date_timestamp']; // date will be empty if conversion into timestamp failed + if ($rssparser->getFormat() == 'rss') // If RSS { if (! $date && isset($item['pubdate'])) $date=$item['pubdate']; if (! $date && isset($item['dc']['date'])) $date=$item['dc']['date']; @@ -138,19 +142,27 @@ class box_external_rss extends ModeleBoxes $title=preg_replace("/^\s+/","",$title); // Supprime espaces de debut $this->info_box_contents["$href"]="$title"; - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'url' => $href, - 'target' => 'newrss'); + $this->info_box_contents[$i][0] = array( + 'td' => 'align="left" width="16"', + 'logo' => $this->boximg, + 'url' => $href, + 'tooltip' => $title, + 'target' => 'newrss', + ); - $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' => $title, - 'url' => $href, - 'maxlength' => 64, - 'target' => 'newrss'); + $this->info_box_contents[$i][1] = array( + 'td' => 'align="left"', + 'text' => $title, + 'url' => $href, + 'tooltip' => $title, + 'maxlength' => 64, + 'target' => 'newrss', + ); - $this->info_box_contents[$i][2] = array('td' => 'align="right" nowrap="1"', - 'text' => $date); + $this->info_box_contents[$i][2] = array( + 'td' => 'align="right" nowrap="1"', + 'text' => $date, + ); } } diff --git a/htdocs/core/boxes/box_factures.php b/htdocs/core/boxes/box_factures.php index b0fdd6d9d09..84f7e61b315 100644 --- a/htdocs/core/boxes/box_factures.php +++ b/htdocs/core/boxes/box_factures.php @@ -101,55 +101,76 @@ class box_factures extends ModeleBoxes $late = ''; if ($objp->paye == 0 && ($objp->fk_statut != 2 && $objp->fk_statut != 3) && $datelimite < ($now - $conf->facture->client->warning_delay)) { $late = img_warning(sprintf($l_due_date,dol_print_date($datelimite,'day')));} - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', - 'logo' => $picto, - 'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid); + $this->info_box_contents[$i][0] = array( + 'td' => 'align="left" width="16"', + 'logo' => $picto, + 'tooltip' => $langs->trans('CustomerInvoice').': '.$objp->facnumber, + 'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid, + ); - $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' => $objp->facnumber, - 'text2'=> $late, - 'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid); + $this->info_box_contents[$i][1] = array( + 'td' => 'align="left"', + 'text' => $objp->facnumber, + 'text2'=> $late, + 'tooltip' => $langs->trans('CustomerInvoice').': '.$objp->facnumber, + 'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid, + ); - $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', - 'logo' => 'company', - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); + $this->info_box_contents[$i][2] = array( + 'td' => 'align="left" width="16"', + 'logo' => 'company', + 'tooltip' => $langs->trans('Customer').': '.$objp->name, + 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid, + ); - $this->info_box_contents[$i][3] = array('td' => 'align="left"', - 'text' => $objp->name, - 'maxlength'=>40, - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); + $this->info_box_contents[$i][3] = array( + 'td' => 'align="left"', + 'text' => $objp->name, + 'maxlength'=>40, + 'tooltip' => $langs->trans('Customer').': '.$objp->name, + 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid, + ); - $this->info_box_contents[$i][4] = array('td' => 'align="right"', - 'text' => price($objp->total_ht), - ); + $this->info_box_contents[$i][4] = array( + 'td' => 'align="right"', + 'text' => price($objp->total_ht), + ); - $this->info_box_contents[$i][5] = array('td' => 'align="right"', - 'text' => dol_print_date($date,'day'), - ); + $this->info_box_contents[$i][5] = array( + 'td' => 'align="right"', + 'text' => dol_print_date($date,'day'), + ); - $this->info_box_contents[$i][6] = array('td' => 'align="right" width="18"', - 'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3)); + $this->info_box_contents[$i][6] = array( + 'td' => 'align="right" width="18"', + 'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3), + ); - $i++; - } + $i++; + } - if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedInvoices")); + if ($num==0) + $this->info_box_contents[$i][0] = array( + 'td' => 'align="center"', + 'text'=>$langs->trans("NoRecordedInvoices"), + ); - $db->free($result); - } - else - { - $this->info_box_contents[0][0] = array( 'td' => 'align="left"', - 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql)); - } + $db->free($result); + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql), + ); + } - } - else { - $this->info_box_contents[0][0] = array('td' => 'align="left"', - 'text' => $langs->trans("ReadPermissionNotAllowed")); - } - } + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'text' => $langs->trans("ReadPermissionNotAllowed"), + ); + } + } /** * Method to show box diff --git a/htdocs/core/boxes/box_factures_fourn.php b/htdocs/core/boxes/box_factures_fourn.php index 914f442bea4..4e222369949 100644 --- a/htdocs/core/boxes/box_factures_fourn.php +++ b/htdocs/core/boxes/box_factures_fourn.php @@ -18,9 +18,9 @@ */ /** - * \file htdocs/core/boxes/box_factures_fourn.php + * \file htdocs/core/boxes/box_factures_fourn.php * \ingroup supplier - * \brief Fichier de gestion d'une box des factures fournisseurs + * \brief Fichier de gestion d'une box des factures fournisseurs */ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php'; @@ -89,8 +89,7 @@ class box_factures_fourn extends ModeleBoxes $i = 0; $l_due_date = $langs->trans('Late').' ('.$langs->trans('DateEcheance').': %s)'; - while ($i < $num) - { + while ($i < $num) { $objp = $db->fetch_object($result); $datelimite=$db->jdate($objp->datelimite); $date=$db->jdate($objp->df); @@ -99,54 +98,79 @@ class box_factures_fourn extends ModeleBoxes $late = ''; if ($objp->paye == 0 && $datelimite && $datelimite < ($now - $conf->facture->fournisseur->warning_delay)) $late=img_warning(sprintf($l_due_date, dol_print_date($datelimite,'day'))); - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid); + $this->info_box_contents[$i][0] = array( + 'td' => 'align="left" width="16"', + 'logo' => $this->boximg, + 'tooltip' => $langs->trans('SupplierInvoice').': '.($objp->ref?$objp->ref:$objp->facid).'
'.$langs->trans('RefSupplier').': '.$objp->ref_supplier, + 'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid, + ); - $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' => ($objp->ref?$objp->ref:$objp->facid), - 'text2'=> $late, - 'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid); + $this->info_box_contents[$i][1] = array( + 'td' => 'align="left"', + 'text' => ($objp->ref?$objp->ref:$objp->facid), + 'text2'=> $late, + 'tooltip' => $langs->trans('SupplierInvoice').': '.($objp->ref?$objp->ref:$objp->facid).'
'.$langs->trans('RefSupplier').': '.$objp->ref_supplier, + 'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid, + ); - $this->info_box_contents[$i][2] = array('td' => 'align="left"', - 'text' => $objp->ref_supplier, - 'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid); + $this->info_box_contents[$i][2] = array( + 'td' => 'align="left"', + 'text' => $objp->ref_supplier, + 'tooltip' => $langs->trans('SupplierInvoice').': '.($objp->ref?$objp->ref:$objp->facid).'
'.$langs->trans('RefSupplier').': '.$objp->ref_supplier, + 'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid, + ); - $this->info_box_contents[$i][3] = array('td' => 'align="left" width="16"', - 'logo' => 'company', - 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid); + $this->info_box_contents[$i][3] = array( + 'td' => 'align="left" width="16"', + 'logo' => 'company', + 'tooltip' => $langs->trans('Supplier').': '.$objp->name, + 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid, + ); - $this->info_box_contents[$i][4] = array('td' => 'align="left"', - 'text' => $objp->name, - 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid); + $this->info_box_contents[$i][4] = array( + 'td' => 'align="left"', + 'text' => $objp->name, + 'tooltip' => $langs->trans('Supplier').': '.$objp->name, + 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid, + ); - $this->info_box_contents[$i][5] = array('td' => 'align="right"', - 'text' => dol_print_date($date,'day')); + $this->info_box_contents[$i][5] = array( + 'td' => 'align="right"', + 'text' => dol_print_date($date,'day'), + ); - $fac = new FactureFournisseur($db); - $fac->fetch($objp->facid); - $alreadypaid=$fac->getSommePaiement(); - $this->info_box_contents[$i][6] = array('td' => 'align="right" width="18"', - 'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3,$alreadypaid,$objp->type)); + $fac = new FactureFournisseur($db); + $fac->fetch($objp->facid); + $alreadypaid=$fac->getSommePaiement(); + $this->info_box_contents[$i][6] = array( + 'td' => 'align="right" width="18"', + 'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3,$alreadypaid,$objp->type), + ); - $i++; - } + $i++; + } - if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoModifiedSupplierBills")); + if ($num==0) + $this->info_box_contents[$i][0] = array( + 'td' => 'align="center"', + 'text'=>$langs->trans("NoModifiedSupplierBills"), + ); - $db->free($result); - } - else { - $this->info_box_contents[0][0] = array( 'td' => 'align="left"', - 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql)); - } - } - else { - $this->info_box_contents[0][0] = array('td' => 'align="left"', - 'text' => $langs->transnoentities("ReadPermissionNotAllowed")); - } - } + $db->free($result); + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql), + ); + } + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'text' => $langs->transnoentities("ReadPermissionNotAllowed"), + ); + } + } /** * Method to show box diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index c6b6dad7acb..aed954fea97 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -257,8 +257,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" // Loop on each TD $nbcolthisline=count($contents[$i]); - for ($j=0; $j < $nbcolthisline; $j++) - { + for ($j=0; $j < $nbcolthisline; $j++) { // Define tdparam $tdparam=''; if (isset($contents[$i][$j]['td'])) $tdparam.=' '.$contents[$i][$j]['td']; @@ -270,13 +269,15 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" $text2withnotags=preg_replace('/<([^>]+)>/i','',$text2); $textnoformat=isset($contents[$i][$j]['textnoformat'])?$contents[$i][$j]['textnoformat']:''; //print "xxx $textwithnotags y"; + if (empty($contents[$i][$j]['tooltip'])) $contents[$i][$j]['tooltip']=""; + $tooltip=isset($contents[$i][$j]['tooltip'])?$contents[$i][$j]['tooltip']:''; - print ''; + print ''."\n"; // Url - if (! empty($contents[$i][$j]['url'])) + if (! empty($contents[$i][$j]['url']) && empty($contents[$i][$j]['logo'])) { - print '" print isset($contents[$i][$j]['target'])?' target="'.$contents[$i][$j]['target'].'"':''; print '>'; @@ -286,7 +287,8 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" if (! empty($contents[$i][$j]['logo'])) { $logo=preg_replace("/^object_/i","",$contents[$i][$j]['logo']); - print img_object($langs->trans("Show"),$logo); + print ''; + print img_object($langs->trans("Show").' '.$tooltip, $logo, 'class="classfortooltip"'); } $maxlength=$MAXLENGTHBOX; @@ -304,7 +306,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" if (! empty($textnoformat)) print "\n".$textnoformat."\n"; - print "