Qual: Simplify code of boxes

Qual: Reduce memory usage
This commit is contained in:
Laurent Destailleur 2008-12-07 15:55:40 +00:00
parent e6ff4ff887
commit a9efc85520
21 changed files with 664 additions and 783 deletions

View File

@ -64,7 +64,7 @@ class InfoBox
$confuserzone='MAIN_BOXES_'.$zone; $confuserzone='MAIN_BOXES_'.$zone;
if ($user->id && $user->conf->$confuserzone) if ($user->id && $user->conf->$confuserzone)
{ {
// Recupere liste des boites d'un user si ce dernier a sa propre liste // Get list of boxes of a particular user (if this one has its own list)
$sql = "SELECT b.rowid, b.box_id, b.position, b.box_order, b.fk_user,"; $sql = "SELECT b.rowid, b.box_id, b.position, b.box_order, b.fk_user,";
$sql.= " d.file, d.note"; $sql.= " d.file, d.note";
$sql.= " FROM ".MAIN_DB_PREFIX."boxes as b, ".MAIN_DB_PREFIX."boxes_def as d"; $sql.= " FROM ".MAIN_DB_PREFIX."boxes as b, ".MAIN_DB_PREFIX."boxes_def as d";
@ -73,7 +73,7 @@ class InfoBox
$sql.= " AND b.fk_user = ".$user->id; $sql.= " AND b.fk_user = ".$user->id;
$sql.= " ORDER BY b.box_order"; $sql.= " ORDER BY b.box_order";
dolibarr_syslog("InfoBox::listBoxes get user box list sql=$sql"); dolibarr_syslog("InfoBox::listBoxes get user box list sql=".$sql, LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result)
{ {
@ -120,7 +120,7 @@ class InfoBox
$sql.= " AND b.fk_user = 0"; $sql.= " AND b.fk_user = 0";
$sql.= " ORDER BY b.box_order"; $sql.= " ORDER BY b.box_order";
dolibarr_syslog("InfoBox::listBoxes get default box list sql=$sql"); dolibarr_syslog("InfoBox::listBoxes get default box list sql=".$sql, LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result)
{ {

View File

@ -18,12 +18,12 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
/** /**
\file htdocs/includes/boxes/box_actions.php \file htdocs/includes/boxes/box_actions.php
\ingroup actions \ingroup actions
\brief Module de generation de l'affichage de la box actions \brief Module de generation de l'affichage de la box actions
\version $Id$ \version $Id$
*/ */
include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php"); include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php");
@ -62,6 +62,8 @@ class box_actions extends ModeleBoxes {
{ {
global $user, $langs, $db, $conf; global $user, $langs, $db, $conf;
$this->max=$max;
include_once(DOL_DOCUMENT_ROOT."/actioncomm.class.php"); include_once(DOL_DOCUMENT_ROOT."/actioncomm.class.php");
$actionstatic=new ActionComm($db); $actionstatic=new ActionComm($db);
@ -102,52 +104,32 @@ class box_actions extends ModeleBoxes {
$label=($langs->transnoentities("Action".$objp->code)!=("Action".$objp->code) ? $langs->transnoentities("Action".$objp->code) : $objp->label); $label=($langs->transnoentities("Action".$objp->code)!=("Action".$objp->code) ? $langs->transnoentities("Action".$objp->code) : $objp->label);
$this->info_box_contents[$i][0] = array('align' => 'left', $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'nowrap' => 1,
'logo' => ("task"), 'logo' => ("task"),
'url' => DOL_URL_ROOT."/comm/action/fiche.php?id=".$objp->id);
$this->info_box_contents[$i][1] = array('td' => 'align="left" nowrap="1"',
'text' => dolibarr_trunc($label,12), 'text' => dolibarr_trunc($label,12),
'text2'=> $late, 'text2'=> $late,
'url' => DOL_URL_ROOT."/comm/action/fiche.php?id=".$objp->id); 'url' => DOL_URL_ROOT."/comm/action/fiche.php?id=".$objp->id);
$this->info_box_contents[$i][1] = array('align' => 'left', $this->info_box_contents[$i][2] = array('td' => 'align="left"',
'text' => dolibarr_trunc($objp->nom,20), 'text' => dolibarr_trunc($objp->nom,20),
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][2] = array('align' => 'right', $this->info_box_contents[$i][3] = array('td' => 'align="left"',
'text' => dolibarr_print_date($objp->dp, "dayhour")); 'text' => dolibarr_print_date($objp->dp, "dayhour"));
$this->info_box_contents[$i][3] = array('align' => 'right', $this->info_box_contents[$i][4] = array('td' => 'align="right"',
'text' => $objp->percentage. "%"); 'text' => $objp->percentage. "%");
$this->info_box_contents[$i][4] = array( $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"',
'align' => 'right',
'text' => $actionstatic->LibStatut($objp->percentage,3)); 'text' => $actionstatic->LibStatut($objp->percentage,3));
$i++; $i++;
} }
$i=$num; if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoActionsToDo"));
while ($i < $max)
{
if ($num==0 && $i==$num)
{
$this->info_box_contents[$i][0] = array('align' => 'center','text'=>$langs->trans("NoActionsToDo"));
$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][2] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][3] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][4] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][5] = array('text'=>'&nbsp;');
} else {
//$this->info_box_contents[$i][0] = array('text'=>'&nbsp;');
//$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
//$this->info_box_contents[$i][2] = array('text'=>'&nbsp;');
//$this->info_box_contents[$i][3] = array('text'=>'&nbsp;');
//$this->info_box_contents[$i][4] = array('text'=>'&nbsp;');
//$this->info_box_contents[$i][5] = array('text'=>'&nbsp;');
}
$i++;
}
} }
else { else {
dolibarr_print_error($db); dolibarr_print_error($db);

View File

@ -60,6 +60,8 @@ class box_bookmarks extends ModeleBoxes {
global $user, $langs, $db; global $user, $langs, $db;
$langs->load("boxes"); $langs->load("boxes");
$this->max=$max;
$this->info_box_head = array('text' => $langs->trans("BoxMyLastBookmarks",$max), $this->info_box_head = array('text' => $langs->trans("BoxMyLastBookmarks",$max),
'sublink' => DOL_URL_ROOT.'/bookmarks/liste.php'); 'sublink' => DOL_URL_ROOT.'/bookmarks/liste.php');
if ($user->rights->bookmark->creer) if ($user->rights->bookmark->creer)
@ -93,29 +95,19 @@ class box_bookmarks extends ModeleBoxes {
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$this->info_box_contents[$i][0] = array('align' => 'left', $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg, 'logo' => $this->boximg,
'text' => stripslashes($objp->title), 'url' => $objp->url,
'target' => $objp->target?'newtab':'');
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->title,
'url' => $objp->url, 'url' => $objp->url,
'target' => $objp->target?'newtab':''); 'target' => $objp->target?'newtab':'');
$i++; $i++;
} }
$i=$num; if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center" colspan="2"', 'url'=> DOL_URL_ROOT.'/bookmarks/liste.php', 'text'=>$langs->trans("NoRecordedBookmarks"));
while ($i < $max)
{
if ($num==0 && $i==$num)
{
$this->info_box_contents[$i][0] = array('align' => 'center', 'url'=> DOL_URL_ROOT.'/bookmarks/liste.php', 'text'=>$langs->trans("NoRecordedBookmarks"));
$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
} else {
$this->info_box_contents[$i][0] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
}
$i++;
}
} }
else else
{ {

View File

@ -23,7 +23,7 @@
\ingroup societes \ingroup societes
\brief Module de génération de l'affichage de la box clients \brief Module de génération de l'affichage de la box clients
\version $Id$ \version $Id$
*/ */
include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php"); include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php");
@ -61,6 +61,8 @@ class box_clients extends ModeleBoxes {
global $user, $langs, $db; global $user, $langs, $db;
$langs->load("boxes"); $langs->load("boxes");
$this->max=$max;
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastCustomers",$max)); $this->info_box_head = array('text' => $langs->trans("BoxTitleLastCustomers",$max));
if ($user->rights->societe->lire) if ($user->rights->societe->lire)
@ -90,33 +92,21 @@ class box_clients extends ModeleBoxes {
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$this->info_box_contents[$i][0] = array('align' => 'left', $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg, 'logo' => $this->boximg,
'text' => stripslashes($objp->nom),
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][1] = array('align' => 'right', $this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->nom,
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][2] = array('td' => 'align="right"',
'text' => dolibarr_print_date($objp->dc, "day")); 'text' => dolibarr_print_date($objp->dc, "day"));
$i++; $i++;
} }
$i=$num; if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedCustomers"));
while ($i < $max)
{
if ($num==0 && $i==$num)
{
$this->info_box_contents[$i][0] = array('align' => 'center','text'=>$langs->trans("NoRecordedCustomers"));
$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][2] = array('text'=>'&nbsp;');
} else {
$this->info_box_contents[$i][0] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][2] = array('text'=>'&nbsp;');
}
$i++;
}
} }
else { else {
dolibarr_print_error($db); dolibarr_print_error($db);

View File

@ -60,6 +60,8 @@ class box_commandes extends ModeleBoxes {
{ {
global $user, $langs, $db; global $user, $langs, $db;
$this->max=$max;
include_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php"); include_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php");
$commandestatic=new Commande($db); $commandestatic=new Commande($db);
@ -95,46 +97,29 @@ class box_commandes extends ModeleBoxes {
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$this->info_box_contents[$i][0] = array('align' => 'left', $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg, 'logo' => $this->boximg,
'url' => DOL_URL_ROOT."/commande/fiche.php?id=".$objp->rowid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->ref, 'text' => $objp->ref,
'url' => DOL_URL_ROOT."/commande/fiche.php?id=".$objp->rowid); 'url' => DOL_URL_ROOT."/commande/fiche.php?id=".$objp->rowid);
$this->info_box_contents[$i][1] = array('align' => 'left', $this->info_box_contents[$i][2] = array('td' => 'align="left"',
'text' => $objp->nom, 'text' => $objp->nom,
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][2] = array('align' => 'right', $this->info_box_contents[$i][3] = array('td' => 'align="right"',
'text' => dolibarr_print_date($objp->tms,'day'), 'text' => dolibarr_print_date($objp->tms,'day'),
); );
$this->info_box_contents[$i][3] = array( $this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"',
'align' => 'right',
'width' => 18,
'text' => $commandestatic->LibStatut($objp->fk_statut,$objp->facturee,3)); 'text' => $commandestatic->LibStatut($objp->fk_statut,$objp->facturee,3));
$i++; $i++;
} }
$i=$num; if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedOrders"));
while ($i < $max)
{
if ($num==0 && $i==$num)
{
$this->info_box_contents[$i][0] = array('align' => 'center','text'=>$langs->trans("NoRecordedOrders"));
$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][2] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][3] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][4] = array('text'=>'&nbsp;');
} else {
$this->info_box_contents[$i][0] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][2] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][3] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][4] = array('text'=>'&nbsp;');
}
$i++;
}
} }
else { else {
dolibarr_print_error($db); dolibarr_print_error($db);

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2005 Christophe /* Copyright (C) 2005 Christophe
* Copyright (C) 2005-2007 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -61,6 +61,8 @@ class box_comptes extends ModeleBoxes {
{ {
global $user, $langs, $db, $conf; global $user, $langs, $db, $conf;
$this->max=$max;
$this->info_box_head = array('text' => $langs->trans("BoxTitleCurrentAccounts")); $this->info_box_head = array('text' => $langs->trans("BoxTitleCurrentAccounts"));
if ($user->rights->banque->lire) if ($user->rights->banque->lire)
@ -94,22 +96,19 @@ class box_comptes extends ModeleBoxes {
$solde_total += $solde; $solde_total += $solde;
$this->info_box_contents[$i][0] = array('align' => 'left', $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg, 'logo' => $this->boximg,
'url' => DOL_URL_ROOT."/compta/bank/account.php?account=".$objp->rowid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->label, 'text' => $objp->label,
'url' => DOL_URL_ROOT."/compta/bank/account.php?account=".$objp->rowid); 'url' => DOL_URL_ROOT."/compta/bank/account.php?account=".$objp->rowid);
/* $this->info_box_contents[$i][2] = array('td' => 'align="left"',
$this->info_box_contents[$i][1] = array('align' => 'left',
'text' => $objp->bank
);
*/
$this->info_box_contents[$i][1] = array('align' => 'left',
'text' => $objp->number 'text' => $objp->number
); );
$this->info_box_contents[$i][2] = array('align' => 'right', $this->info_box_contents[$i][3] = array('td' => 'align="right"',
'text' => price($solde).' '.$langs->trans("Currency".$objp->currency_code) 'text' => price($solde).' '.$langs->trans("Currency".$objp->currency_code)
); );
@ -117,17 +116,10 @@ class box_comptes extends ModeleBoxes {
} }
// Total // Total
$this->info_box_contents[$i][-1] = array('class' => 'liste_total'); $this->info_box_contents[$i][0] = array('tr' => 'class="liste_total"', 'td' => 'align="right" colspan="3" class="liste_total"',
$this->info_box_contents[$i][0] = array('align' => 'right',
//'width' => '75%',
'colspan' => '3',
'class' => 'liste_total',
'text' => $langs->trans('Total') 'text' => $langs->trans('Total')
); );
$this->info_box_contents[$i][1] = array('td' => 'align="right" class="liste_total"',
$this->info_box_contents[$i][1] = array('align' => 'right',
'class' => 'liste_total',
'text' => price($solde_total).' '.$langs->trans("Currency".$conf->monnaie) 'text' => price($solde_total).' '.$langs->trans("Currency".$conf->monnaie)
); );
@ -137,7 +129,7 @@ class box_comptes extends ModeleBoxes {
} }
} }
else { else {
$this->info_box_contents[0][0] = array('align' => 'left', $this->info_box_contents[0][0] = array('td' => 'align="left"',
'text' => $langs->trans("ReadPermissionNotAllowed")); 'text' => $langs->trans("ReadPermissionNotAllowed"));
} }

View File

@ -56,6 +56,8 @@ class box_energie_graph extends ModeleBoxes {
global $user, $langs, $db; global $user, $langs, $db;
$langs->load("boxes"); $langs->load("boxes");
$this->max=$max;
$text = '<a href="energie/">'.$langs->trans("Energie").'</a>'; $text = '<a href="energie/">'.$langs->trans("Energie").'</a>';
$this->info_box_head = array('text' => $text,$max); $this->info_box_head = array('text' => $text,$max);
@ -65,8 +67,10 @@ class box_energie_graph extends ModeleBoxes {
$libelle = '<img border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=energie&file='.$file.'" alt="" title="">'; $libelle = '<img border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=energie&file='.$file.'" alt="" title="">';
$this->info_box_contents[0][0] = array('align' => 'left', $this->info_box_contents[0][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg, 'logo' => $this->boximg,
'url' => DOL_URL_ROOT."/energie/compteur.php?id=".$objp->rowid);
$this->info_box_contents[0][1] = array('td' => 'align="left"',
'text' => $libelle, 'text' => $libelle,
'url' => DOL_URL_ROOT."/energie/compteur.php?id=".$objp->rowid); 'url' => DOL_URL_ROOT."/energie/compteur.php?id=".$objp->rowid);

View File

@ -55,6 +55,8 @@ class box_energie_releve extends ModeleBoxes {
global $user, $langs, $db; global $user, $langs, $db;
$langs->load("boxes"); $langs->load("boxes");
$this->max=$max;
$text = '<a href="energie/">'.$langs->trans("Energie").'</a>'; $text = '<a href="energie/">'.$langs->trans("Energie").'</a>';
$this->info_box_head = array('text' => $text,$max); $this->info_box_head = array('text' => $text,$max);
@ -75,12 +77,15 @@ class box_energie_releve extends ModeleBoxes {
{ {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
$this->info_box_contents[$i][0] = array('align' => 'left', $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg, 'logo' => $this->boximg,
'url' => DOL_URL_ROOT."/energie/compteur.php?id=".$objp->rowid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->libelle, 'text' => $objp->libelle,
'url' => DOL_URL_ROOT."/energie/compteur.php?id=".$objp->rowid); 'url' => DOL_URL_ROOT."/energie/compteur.php?id=".$objp->rowid);
$this->info_box_contents[$i][1] = array('align' => 'left', $this->info_box_contents[$i][2] = array('td' => 'align="right"',
'text' => $objp->valeur); 'text' => $objp->valeur);

View File

@ -66,6 +66,8 @@ class box_external_rss extends ModeleBoxes {
global $user, $langs, $conf; global $user, $langs, $conf;
$langs->load("boxes"); $langs->load("boxes");
$this->max=$max;
// On recupere numero de param de la boite // On recupere numero de param de la boite
ereg('^([0-9]+) ',$this->param,$reg); ereg('^([0-9]+) ',$this->param,$reg);
$site=$reg[1]; $site=$reg[1];
@ -136,15 +138,20 @@ class box_external_rss extends ModeleBoxes {
$title=ereg_replace("([[:alnum:]])\?([[:alnum:]])","\\1'\\2",$title); // Gère problème des apostrophes mal codée/décodée par utf8 $title=ereg_replace("([[:alnum:]])\?([[:alnum:]])","\\1'\\2",$title); // Gère problème des apostrophes mal codée/décodée par utf8
$title=ereg_replace("^\s+","",$title); // Supprime espaces de début $title=ereg_replace("^\s+","",$title); // Supprime espaces de début
$this->info_box_contents["$href"]="$title"; $this->info_box_contents["$href"]="$title";
$this->info_box_contents[$i][0] = array('align' => 'left',
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg, 'logo' => $this->boximg,
'url' => $href,
'target' => 'newrss');
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $title, 'text' => $title,
'url' => $href, 'url' => $href,
'maxlength' => 64, 'maxlength' => 64,
'target' => 'newrss'); 'target' => 'newrss');
$this->info_box_contents[$i][1] = array('align' => 'right',
'text' => $date, $this->info_box_contents[$i][2] = array('td' => 'align="right" nowrap="1"',
'td' => 'nowrap="1"'); 'text' => $date);
} }
} }

View File

@ -62,6 +62,8 @@ class box_factures extends ModeleBoxes {
{ {
global $user, $langs, $db; global $user, $langs, $db;
$this->max=$max;
include_once(DOL_DOCUMENT_ROOT."/facture.class.php"); include_once(DOL_DOCUMENT_ROOT."/facture.class.php");
$facturestatic=new Facture($db); $facturestatic=new Facture($db);
@ -108,59 +110,42 @@ class box_factures extends ModeleBoxes {
$late = ''; $late = '';
if($objp->paye == 0 && $objp->datelimite < (time() - $conf->facture->warning_delay)) { $late = img_warning(sprintf($l_due_date,dolibarr_print_date($objp->datelimite,'day')));} if($objp->paye == 0 && $objp->datelimite < (time() - $conf->facture->warning_delay)) { $late = img_warning(sprintf($l_due_date,dolibarr_print_date($objp->datelimite,'day')));}
$this->info_box_contents[$i][0] = array('align' => 'left', $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $picto, 'logo' => $picto,
'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->facnumber, 'text' => $objp->facnumber,
'text2'=> $late, 'text2'=> $late,
'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid); 'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid);
$this->info_box_contents[$i][1] = array('align' => 'left', $this->info_box_contents[$i][2] = array('td' => 'align="left"',
'text' => $objp->nom, 'text' => $objp->nom,
'maxlength'=>40, 'maxlength'=>40,
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][2] = array('align' => 'right', $this->info_box_contents[$i][3] = array('td' => 'align="right"',
'text' => dolibarr_print_date($objp->datec,'day'), 'text' => dolibarr_print_date($objp->datec,'day'),
); );
$this->info_box_contents[$i][3] = array( $this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"',
'align' => 'right',
'width' => 18,
'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3)); 'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3));
$i++; $i++;
} }
$i=$num; if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedInvoices"));
while ($i < $max)
{
if ($num==0 && $i==$num)
{
$this->info_box_contents[$i][0] = array('align' => 'center','text'=>$langs->trans("NoRecordedInvoices"));
$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][2] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][3] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][4] = array('text'=>'&nbsp;');
} else {
$this->info_box_contents[$i][0] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][2] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][3] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][4] = array('text'=>'&nbsp;');
}
$i++;
}
} }
else else
{ {
$this->info_box_contents[0][0] = array( 'align' => 'left', $this->info_box_contents[0][0] = array( 'td' => 'align="left"',
'maxlength'=>500, 'maxlength'=>500,
'text' => ($db->error().' sql='.$sql)); 'text' => ($db->error().' sql='.$sql));
} }
} }
else { else {
$this->info_box_contents[0][0] = array('align' => 'left', $this->info_box_contents[0][0] = array('td' => 'align="left"',
'text' => $langs->trans("ReadPermissionNotAllowed")); 'text' => $langs->trans("ReadPermissionNotAllowed"));
} }
} }

View File

@ -59,6 +59,8 @@ class box_factures_fourn extends ModeleBoxes {
{ {
global $user, $langs, $db; global $user, $langs, $db;
$this->max=$max;
include_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.facture.class.php"); include_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.facture.class.php");
$facturestatic=new FactureFournisseur($db); $facturestatic=new FactureFournisseur($db);
@ -99,54 +101,36 @@ class box_factures_fourn extends ModeleBoxes {
$late = ''; $late = '';
if ($objp->paye == 0 && $objp->datelimite < (time() - $conf->facture->fournisseur->warning_delay)) $late=img_warning(sprintf($l_due_date, dolibarr_print_date($objp->datelimite,'day'))); if ($objp->paye == 0 && $objp->datelimite < (time() - $conf->facture->fournisseur->warning_delay)) $late=img_warning(sprintf($l_due_date, dolibarr_print_date($objp->datelimite,'day')));
$this->info_box_contents[$i][0] = array('align' => 'left', $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg, 'logo' => $this->boximg,
'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->facnumber, 'text' => $objp->facnumber,
'text2'=> $late, 'text2'=> $late,
'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid); 'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid);
$this->info_box_contents[$i][1] = array('align' => 'left', $this->info_box_contents[$i][2] = array('td' => 'align="left"',
'text' => $objp->nom, 'text' => $objp->nom,
'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][2] = array( $this->info_box_contents[$i][3] = array('td' => 'align="right"',
'align' => 'right',
'text' => dolibarr_print_date($objp->datec,'day')); 'text' => dolibarr_print_date($objp->datec,'day'));
$this->info_box_contents[$i][3] = array( $this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"',
'align' => 'right',
'width' => 18,
'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3)); 'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3));
$i++; $i++;
} }
$i=$num; if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoUnpayedCustomerBills"));
while ($i < $max)
{
if ($num==0 && $i==$num)
{
$this->info_box_contents[$i][0] = array('align' => 'center','text'=>$langs->trans("NoUnpayedCustomerBills"));
$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][2] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][3] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][4] = array('text'=>'&nbsp;');
} else {
$this->info_box_contents[$i][0] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][2] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][3] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][4] = array('text'=>'&nbsp;');
}
$i++;
}
} }
else { else {
dolibarr_print_error($db); dolibarr_print_error($db);
} }
} }
else { else {
$this->info_box_contents[0][0] = array('align' => 'left', $this->info_box_contents[0][0] = array('td' => 'align="left"',
'text' => $langs->transnoentities("ReadPermissionNotAllowed")); 'text' => $langs->transnoentities("ReadPermissionNotAllowed"));
} }
} }

View File

@ -59,6 +59,8 @@ class box_factures_fourn_imp extends ModeleBoxes {
{ {
global $conf, $user, $langs, $db; global $conf, $user, $langs, $db;
$this->max=$max;
include_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.facture.class.php"); include_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.facture.class.php");
$facturestatic=new FactureFournisseur($db); $facturestatic=new FactureFournisseur($db);
@ -98,49 +100,36 @@ class box_factures_fourn_imp extends ModeleBoxes {
$late=''; $late='';
if ($objp->datelimite < (time() - $conf->facture->fournisseur->warning_delay)) $late=img_warning(sprintf($l_due_date,dolibarr_print_date($objp->datelimite,'day'))); if ($objp->datelimite < (time() - $conf->facture->fournisseur->warning_delay)) $late=img_warning(sprintf($l_due_date,dolibarr_print_date($objp->datelimite,'day')));
$this->info_box_contents[$i][0] = array('align' => 'left', $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg, 'logo' => $this->boximg,
'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->facnumber, 'text' => $objp->facnumber,
'text2'=> $late, 'text2'=> $late,
'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid); 'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid);
$this->info_box_contents[$i][1] = array('align' => 'left', $this->info_box_contents[$i][2] = array('td' => 'align="left"',
'text' => $objp->nom, 'text' => $objp->nom,
'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][2] = array('align' => 'right', $this->info_box_contents[$i][3] = array('td' => 'align="right"',
'text' => dolibarr_print_date($objp->datelimite,'day')); 'text' => dolibarr_print_date($objp->datelimite,'day'));
$this->info_box_contents[$i][3] = array( $this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"',
'align' => 'right',
'width' => 18,
'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3)); 'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3));
$i++; $i++;
} }
$i=$num; if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoUnpayedSupplierBills"));
while ($i < $max)
{
if ($num==0 && $i==$num)
{
$this->info_box_contents[$i][0] = array('align' => 'center','text'=>$langs->trans("NoUnpayedSupplierBills"));
} else {
$this->info_box_contents[$i][0] = array('text'=>'&nbsp;');
}
$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][2] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][3] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][4] = array('text'=>'&nbsp;');
$i++;
}
} }
else { else {
dolibarr_print_error($db); dolibarr_print_error($db);
} }
} }
else { else {
$this->info_box_contents[0][0] = array('align' => 'left', $this->info_box_contents[0][0] = array('td' => 'align="left"',
'text' => $langs->trans("ReadPermissionNotAllowed")); 'text' => $langs->trans("ReadPermissionNotAllowed"));
} }

View File

@ -62,6 +62,9 @@ class box_factures_imp extends ModeleBoxes {
{ {
global $conf, $user, $langs, $db; global $conf, $user, $langs, $db;
$this->max=$max;
include_once(DOL_DOCUMENT_ROOT."/facture.class.php");
$facturestatic=new Facture($db); $facturestatic=new Facture($db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleOldestUnpayedCustomerBills",$max)); $this->info_box_head = array('text' => $langs->trans("BoxTitleOldestUnpayedCustomerBills",$max));
@ -100,54 +103,41 @@ class box_factures_imp extends ModeleBoxes {
$late=''; $late='';
if ($objp->datelimite < (time() - $conf->facture->warning_delay)) $late = img_warning(sprintf($l_due_date,dolibarr_print_date($objp->datelimite,'day'))); if ($objp->datelimite < (time() - $conf->facture->warning_delay)) $late = img_warning(sprintf($l_due_date,dolibarr_print_date($objp->datelimite,'day')));
$this->info_box_contents[$i][0] = array('align' => 'left', $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg, 'logo' => $this->boximg,
'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->facnumber, 'text' => $objp->facnumber,
'text2'=> $late, 'text2'=> $late,
'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid); 'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid);
$this->info_box_contents[$i][1] = array('align' => 'left', $this->info_box_contents[$i][2] = array('td' => 'align="left"',
'text' => $objp->nom, 'text' => $objp->nom,
'maxlength'=>44, 'maxlength'=>44,
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][2] = array('align' => 'right', $this->info_box_contents[$i][3] = array('td' => 'align="right"',
'text' => dolibarr_print_date($objp->datelimite,'day'), 'text' => dolibarr_print_date($objp->datelimite,'day'),
); );
$this->info_box_contents[$i][3] = array( $this->info_box_contents[$i][3] = array('td' => 'align="right" width="18"',
'align' => 'right',
'width' => 18,
'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3)); 'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3));
$i++; $i++;
} }
$i=$num; if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoUnpayedCustomerBills"));
while ($i < $max)
{
if ($num==0 && $i==$num)
{
$this->info_box_contents[$i][0] = array('align' => 'center','text'=>$langs->trans("NoUnpayedCustomerBills"));
} else {
$this->info_box_contents[$i][0] = array('text'=>'&nbsp;');
}
$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][2] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][3] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][4] = array('text'=>'&nbsp;');
$i++;
}
} }
else else
{ {
$this->info_box_contents[0][0] = array( 'align' => 'left', $this->info_box_contents[0][0] = array( 'td' => 'align="left"',
'maxlength'=>500, 'maxlength'=>500,
'text' => ($db->error().' sql='.$sql)); 'text' => ($db->error().' sql='.$sql));
} }
} }
else { else {
$this->info_box_contents[0][0] = array('align' => 'left', $this->info_box_contents[0][0] = array('td' => 'align="left"',
'text' => $langs->trans("ReadPermissionNotAllowed")); 'text' => $langs->trans("ReadPermissionNotAllowed"));
} }
} }

View File

@ -60,6 +60,8 @@ class box_fournisseurs extends ModeleBoxes {
global $user, $langs, $db; global $user, $langs, $db;
$langs->load("boxes"); $langs->load("boxes");
$this->max=$max;
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastSuppliers",$max)); $this->info_box_head = array('text' => $langs->trans("BoxTitleLastSuppliers",$max));
if ($user->rights->societe->lire) if ($user->rights->societe->lire)
@ -89,40 +91,28 @@ class box_fournisseurs extends ModeleBoxes {
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$this->info_box_contents[$i][0] = array('align' => 'left', $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg, 'logo' => $this->boximg,
'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->nom, 'text' => $objp->nom,
'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][1] = array('align' => 'right', $this->info_box_contents[$i][2] = array('td' => 'align="right"',
'text' => dolibarr_print_date($objp->dc, "day")); 'text' => dolibarr_print_date($objp->dc, "day"));
$i++; $i++;
} }
$i=$num; if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedSuppliers"));
while ($i < $max)
{
if ($num==0 && $i==$num)
{
$this->info_box_contents[$i][0] = array('align' => 'center','text'=>$langs->trans("NoRecordedSuppliers"));
$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][2] = array('text'=>'&nbsp;');
} else {
$this->info_box_contents[$i][0] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][2] = array('text'=>'&nbsp;');
}
$i++;
}
} }
else { else {
dolibarr_print_error($db); dolibarr_print_error($db);
} }
} }
else { else {
$this->info_box_contents[0][0] = array('align' => 'left', $this->info_box_contents[0][0] = array('td' => 'align="left"',
'text' => $langs->trans("ReadPermissionNotAllowed")); 'text' => $langs->trans("ReadPermissionNotAllowed"));
} }

View File

@ -60,25 +60,29 @@ class box_osc_clients extends ModeleBoxes {
global $user, $langs, $db; global $user, $langs, $db;
$langs->load("boxes"); $langs->load("boxes");
$this->max=$max;
$this->info_box_head = array('text' => $langs->trans("BoxTitleNbOfCustomers",$max)); $this->info_box_head = array('text' => $langs->trans("BoxTitleNbOfCustomers",$max));
if ($user->rights->boutique->lire) if ($user->rights->boutique->lire)
{ {
$sql = "SELECT count(*) as cus FROM ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."customers"; $sql = "SELECT count(*) as cus FROM ".OSC_DB_NAME.".".OSC_DB_TABLE_PREFIX."customers";
$result = $db->query($sql); $resql = $db->query($sql);
if ($result) if ($resql)
{ {
$num = $db->num_rows(); $num = $db->num_rows($resql);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($resql);
$this->info_box_contents[$i][0] = array('align' => 'center', $this->info_box_contents[$i][0] = array('td' => 'align="center" width="16"',
'logo' => $this->boximg, 'logo' => $this->boximg,
'url' => DOL_URL_ROOT."/boutique/client/index.php");
$this->info_box_contents[$i][1] = array('td' => 'align="center"',
'text' => $objp->cus, 'text' => $objp->cus,
'url' => DOL_URL_ROOT."/boutique/client/index.php"); 'url' => DOL_URL_ROOT."/boutique/client/index.php");
$i++; $i++;
@ -89,7 +93,7 @@ class box_osc_clients extends ModeleBoxes {
} }
} }
else { else {
$this->info_box_contents[0][0] = array('align' => 'left', $this->info_box_contents[0][0] = array('td' => 'align="left"',
'text' => $langs->trans("ReadPermissionNotAllowed")); 'text' => $langs->trans("ReadPermissionNotAllowed"));
} }

View File

@ -22,7 +22,7 @@
\ingroup produits,services \ingroup produits,services
\brief Module de g<EFBFBD>n<EFBFBD>ration de l'affichage de la box produits \brief Module de g<EFBFBD>n<EFBFBD>ration de l'affichage de la box produits
\version $Id$ \version $Id$
*/ */
include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php"); include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php");
include_once(DOL_DOCUMENT_ROOT."/product.class.php"); include_once(DOL_DOCUMENT_ROOT."/product.class.php");
@ -61,6 +61,9 @@ class box_produits extends ModeleBoxes {
{ {
global $user, $langs, $db, $conf; global $user, $langs, $db, $conf;
$this->max=$max;
include_once(DOL_DOCUMENT_ROOT."/product.class.php");
$productstatic=new Product($db); $productstatic=new Product($db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastProducts",$max)); $this->info_box_head = array('text' => $langs->trans("BoxTitleLastProducts",$max));
@ -102,9 +105,11 @@ class box_produits extends ModeleBoxes {
} }
} }
$this->info_box_contents[$i][0] = array( $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'align' => 'left',
'logo' => ($objp->fk_product_type==1?'object_service':'object_product'), 'logo' => ($objp->fk_product_type==1?'object_service':'object_product'),
'url' => DOL_URL_ROOT."/product/fiche.php?id=".$objp->rowid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->label, 'text' => $objp->label,
'url' => DOL_URL_ROOT."/product/fiche.php?id=".$objp->rowid); 'url' => DOL_URL_ROOT."/product/fiche.php?id=".$objp->rowid);
@ -118,22 +123,16 @@ class box_produits extends ModeleBoxes {
$price=price($objp->price_ttc); $price=price($objp->price_ttc);
$price_base_type=$langs->trans("TTC"); $price_base_type=$langs->trans("TTC");
} }
$this->info_box_contents[$i][1] = array( $this->info_box_contents[$i][2] = array('td' => 'align="right"',
'align' => 'right',
'text' => $price); 'text' => $price);
$this->info_box_contents[$i][2] = array( $this->info_box_contents[$i][3] = array('td' => 'align="center" width="20"',
'align' => 'center',
'width' => 20,
'text' => $price_base_type); 'text' => $price_base_type);
$this->info_box_contents[$i][3] = array( $this->info_box_contents[$i][4] = array('td' => 'align="right"',
'align' => 'right',
'text' => dolibarr_print_date($objp->tms,'day')); 'text' => dolibarr_print_date($objp->tms,'day'));
$this->info_box_contents[$i][4] = array( $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"',
'align' => 'right',
'width' => 18,
'text' => $productstatic->LibStatut($objp->envente,3)); 'text' => $productstatic->LibStatut($objp->envente,3));
$i++; $i++;
@ -144,7 +143,7 @@ class box_produits extends ModeleBoxes {
} }
} }
else { else {
$this->info_box_contents[0][0] = array('align' => 'left', $this->info_box_contents[0][0] = array('td' => 'align="left"',
'text' => $langs->trans("ReadPermissionNotAllowed")); 'text' => $langs->trans("ReadPermissionNotAllowed"));
} }
} }

View File

@ -62,6 +62,8 @@ class box_propales extends ModeleBoxes {
global $user, $langs, $db; global $user, $langs, $db;
$this->max=$max;
include_once(DOL_DOCUMENT_ROOT."/propal.class.php"); include_once(DOL_DOCUMENT_ROOT."/propal.class.php");
$propalstatic=new Propal($db); $propalstatic=new Propal($db);
@ -96,53 +98,36 @@ class box_propales extends ModeleBoxes {
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$this->info_box_contents[$i][0] = array('align' => 'left', $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg, 'logo' => $this->boximg,
'url' => DOL_URL_ROOT."/comm/propal.php?propalid=".$objp->rowid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->ref, 'text' => $objp->ref,
'url' => DOL_URL_ROOT."/comm/propal.php?propalid=".$objp->rowid); 'url' => DOL_URL_ROOT."/comm/propal.php?propalid=".$objp->rowid);
$this->info_box_contents[$i][1] = array('align' => 'left', $this->info_box_contents[$i][2] = array('td' => 'align="left"',
'text' => dolibarr_trunc($objp->nom,40), 'text' => dolibarr_trunc($objp->nom,40),
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][2] = array( $this->info_box_contents[$i][3] = array('td' => 'align="right"',
'align' => 'right',
'text' => dolibarr_print_date($objp->datec,'day')); 'text' => dolibarr_print_date($objp->datec,'day'));
$this->info_box_contents[$i][3] = array( $this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"',
'align' => 'right',
'width' => 18,
'text' => $propalstatic->LibStatut($objp->fk_statut,3)); 'text' => $propalstatic->LibStatut($objp->fk_statut,3));
$i++; $i++;
} }
$i=$num; if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedProposals"));
while ($i < $max) }
else
{ {
if ($num==0 && $i==$num)
{
$this->info_box_contents[$i][0] = array('align' => 'center','text'=>$langs->trans("NoRecordedProposals"));
$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][2] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][3] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][4] = array('text'=>'&nbsp;');
} else {
$this->info_box_contents[$i][0] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][2] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][3] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][4] = array('text'=>'&nbsp;');
}
$i++;
}
}
else {
dolibarr_print_error($db); dolibarr_print_error($db);
} }
} }
else { else {
$this->info_box_contents[0][0] = array('align' => 'left', $this->info_box_contents[0][0] = array('td' => 'align="left"',
'text' => $langs->trans("ReadPermissionNotAllowed")); 'text' => $langs->trans("ReadPermissionNotAllowed"));
} }
} }

View File

@ -19,11 +19,11 @@
*/ */
/** /**
\file htdocs/includes/boxes/box_prospect.php * \file htdocs/includes/boxes/box_prospect.php
\ingroup societe * \ingroup societe
\brief Module to generate the last prospects box. * \brief Module to generate the last prospects box.
\version $Id$ * \version $Id$
*/ */
include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php"); include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php");
@ -46,11 +46,14 @@ class box_prospect extends ModeleBoxes {
/** /**
* \brief Constructeur de la classe * \brief Constructeur de la classe
*/ */
function box_prospect() function box_prospect($DB,$param)
{ {
global $langs; global $langs;
$langs->load("boxes"); $langs->load("boxes");
$this->db=$DB;
$this->param=$param;
$this->boxlabel=$langs->trans("BoxLastProspects"); $this->boxlabel=$langs->trans("BoxLastProspects");
} }
@ -62,6 +65,8 @@ class box_prospect extends ModeleBoxes {
{ {
global $user, $langs, $db; global $user, $langs, $db;
$this->max=$max;
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastProspects",$max)); $this->info_box_head = array('text' => $langs->trans("BoxTitleLastProspects",$max));
if ($user->rights->societe->lire) if ($user->rights->societe->lire)
@ -91,38 +96,24 @@ class box_prospect extends ModeleBoxes {
{ {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
$this->info_box_contents[$i][0] = array('align' => 'left', $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg, 'logo' => $this->boximg,
'text' => stripslashes($objp->nom),
'url' => DOL_URL_ROOT."/comm/prospect/fiche.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/comm/prospect/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][1] = array('align' => 'right', $this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->nom,
'url' => DOL_URL_ROOT."/comm/prospect/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][2] = array('td' => 'align="right"',
'text' => dolibarr_print_date($objp->dc, "day")); 'text' => dolibarr_print_date($objp->dc, "day"));
$this->info_box_contents[$i][2] = array('align' => 'right', $this->info_box_contents[$i][3] = array('td' => 'align="right" width="18"',
'width' => 18,
'text' => eregi_replace('img ','img height="14px" ',$prospectstatic->LibStatut($objp->fk_stcomm,3))); 'text' => eregi_replace('img ','img height="14px" ',$prospectstatic->LibStatut($objp->fk_stcomm,3)));
$i++; $i++;
} }
$i=$num; if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedProspects"));
while ($i < $max)
{
if ($num==0 && $i==$num)
{
$this->info_box_contents[$i][0] = array('align' => 'center','text'=>$langs->trans("NoRecordedProspects"));
$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][2] = array('text'=>'&nbsp;');
$this->info_box_contents[$i][3] = array('text'=>'&nbsp;');
} else {
//$this->info_box_contents[$i][0] = array('text'=>'&nbsp;');
//$this->info_box_contents[$i][1] = array('text'=>'&nbsp;');
//$this->info_box_contents[$i][2] = array('text'=>'&nbsp;');
//$this->info_box_contents[$i][3] = array('text'=>'&nbsp;');
}
$i++;
}
} }
else else
{ {
@ -131,7 +122,7 @@ class box_prospect extends ModeleBoxes {
} }
else { else {
dolibarr_syslog("box_prospect::loadBox not allowed de read this box content",LOG_ERR); dolibarr_syslog("box_prospect::loadBox not allowed de read this box content",LOG_ERR);
$this->info_box_contents[0][0] = array('align' => 'left', $this->info_box_contents[0][0] = array('td' => 'align="left"',
'text' => $langs->trans("ReadPermissionNotAllowed")); 'text' => $langs->trans("ReadPermissionNotAllowed"));
} }
} }

View File

@ -60,6 +60,8 @@ class box_services_vendus extends ModeleBoxes {
{ {
global $user, $langs, $db, $conf; global $user, $langs, $db, $conf;
$this->max=$max;
include_once(DOL_DOCUMENT_ROOT."/contrat/contrat.class.php"); include_once(DOL_DOCUMENT_ROOT."/contrat/contrat.class.php");
$contratlignestatic=new ContratLigne($db); $contratlignestatic=new ContratLigne($db);
@ -118,34 +120,37 @@ class box_services_vendus extends ModeleBoxes {
} }
} }
$this->info_box_contents[$i][0] = array('align' => 'left', $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => ($objp->fk_product_type==1?'object_service':'object_product'), 'logo' => ($objp->fk_product_type==1?'object_service':'object_product'),
'url' => DOL_URL_ROOT."/contrat/fiche.php?id=".$objp->rowid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->label, 'text' => $objp->label,
'maxlength' => 16, 'maxlength' => 16,
'url' => DOL_URL_ROOT."/contrat/fiche.php?id=".$objp->rowid); 'url' => DOL_URL_ROOT."/contrat/fiche.php?id=".$objp->rowid);
$this->info_box_contents[$i][1] = array('align' => 'left', $this->info_box_contents[$i][2] = array('td' => 'align="left"',
'text' => $objp->nom, 'text' => $objp->nom,
'maxlength' => 40, 'maxlength' => 40,
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][2] = array('align' => 'right', $this->info_box_contents[$i][3] = array('td' => 'align="right"',
'text' => dolibarr_print_date($objp->datem,'day')); 'text' => dolibarr_print_date($objp->datem,'day'));
$this->info_box_contents[$i][3] = array('align' => 'right', $this->info_box_contents[$i][4] = array('td' => 'align="right width="18"',
'text' => $contratlignestatic->LibStatut($objp->statut,3), 'text' => $contratlignestatic->LibStatut($objp->statut,3)
'width' => 18
); );
$i++; $i++;
} }
} }
else { else
{
dolibarr_print_error($db); dolibarr_print_error($db);
} }
} }
else { else {
$this->info_box_contents[0][0] = array('align' => 'left', $this->info_box_contents[0][0] = array('td' => 'align="left"',
'text' => $langs->trans("ReadPermissionNotAllowed")); 'text' => $langs->trans("ReadPermissionNotAllowed"));
} }

View File

@ -31,10 +31,9 @@
*/ */
class ModeleBoxes class ModeleBoxes
{ {
var $MAXLENGTHBOX=60; // Mettre 0 pour pas de limite
var $db; var $db;
var $error=''; var $error='';
var $max=5;
/* /*
* \brief Constructeur * \brief Constructeur
@ -46,7 +45,7 @@ class ModeleBoxes
/** /**
\brief Renvoi le dernier message d'erreur de cr<EFBFBD>ation de facture * \brief Renvoi le dernier message d'erreur de creation de facture
*/ */
function error() function error()
{ {
@ -55,7 +54,7 @@ class ModeleBoxes
/** /**
\brief Charge une ligne boxe depuis son rowid * \brief Charge une ligne boxe depuis son rowid
*/ */
function fetch($rowid) function fetch($rowid)
{ {
@ -91,27 +90,28 @@ class ModeleBoxes
/** /**
\brief Methode standard d'affichage des boites * \brief Methode standard d'affichage des boites
\param $head tableau des caract<EFBFBD>ristiques du titre * \param $head tableau des caracteristiques du titre
\param $contents tableau des lignes de contenu * \param $contents tableau des lignes de contenu
*/ */
function showBox($head, $contents) function showBox($head, $contents)
{ {
global $langs,$conf; global $langs,$conf;
$MAXLENGTHBOX=60; // Mettre 0 pour pas de limite
$bcx[0] = 'class="box_pair"'; $bcx[0] = 'class="box_pair"';
$bcx[1] = 'class="box_impair"'; $bcx[1] = 'class="box_impair"';
$var = true; $var = true;
// Define nbcol and nblines // Define nbcol and nblines of the box to show
$nbcol=0; $nbcol=0;
if (isset($contents[0])) $nbcol=sizeof($contents[0])+1; if (isset($contents[0])) $nbcol=sizeof($contents[0]);
$nblines=sizeof($contents); $nblines=sizeof($contents);
print "\n\n<!-- Box start -->\n"; print "\n\n<!-- Box start -->\n";
print '<div style="padding-right: 2px; padding-left: 2px; padding-bottom: 4px;" id="boxto_'.$this->box_id.'">'."\n"; print '<div style="padding-right: 2px; padding-left: 2px; padding-bottom: 4px;" id="boxto_'.$this->box_id.'">'."\n";
// Affiche titre de la boite // Show box title
if (! empty($head['text']) || ! empty($head['sublink'])) if (! empty($head['text']) || ! empty($head['sublink']))
{ {
print '<div id="boxto_'.$this->box_id.'_title">'."\n"; print '<div id="boxto_'.$this->box_id.'_title">'."\n";
@ -126,7 +126,7 @@ class ModeleBoxes
} }
if (! empty($head['text'])) if (! empty($head['text']))
{ {
$s=dolibarr_trunc($head['text'],isset($head['limit'])?$head['limit']:$this->MAXLENGTHBOX); $s=dolibarr_trunc($head['text'],isset($head['limit'])?$head['limit']:$MAXLENGTHBOX);
print $s; print $s;
} }
if (! empty($head['sublink'])) if (! empty($head['sublink']))
@ -146,30 +146,27 @@ class ModeleBoxes
print "</div>\n"; print "</div>\n";
} }
// Affiche chaque ligne de la boite // Show box lines
if ($nblines) if ($nblines)
{ {
print '<table width="100%" class="noborder">'."\n"; print '<table width="100%" class="noborder">'."\n";
// Loop on each record
for ($i=0, $n=$nblines; $i < $n; $i++) for ($i=0, $n=$nblines; $i < $n; $i++)
{ {
if (isset($contents[$i])) if (isset($contents[$i]))
{ {
$var=!$var; $var=!$var;
if (sizeof($contents[$i]))
{
if (isset($contents[$i][-1]['class'])) print '<tr valign="top" class="'.$contents[$i][-1]['class'].'">';
else print '<tr valign="top" '.$bcx[$var].'>';
}
// Affiche chaque cellule // TR
for ($j=0, $m=isset($contents[$i][-1])?sizeof($contents[$i])-1:sizeof($contents[$i]); $j < $m; $j++) if (isset($contents[$i][0]['tr'])) print '<tr valign="top" '.$contents[$i][0]['tr'].'>';
else print '<tr valign="top" '.$bcx[$var].'>';
// Loop on each TD
$nbcolthisline=sizeof($contents[$i]);
for ($j=0; $j < $nbcolthisline; $j++)
{ {
$tdparam=""; // Define tdparam
if (isset($contents[$i][$j]['align'])) $tdparam.=' align="'. $contents[$i][$j]['align'].'"'; $tdparam='';
if (isset($contents[$i][$j]['nowrap'])) $tdparam.=' nowrap="'. $contents[$i][$j]['align'].'"';
if (isset($contents[$i][$j]['width'])) $tdparam.=' width="'. $contents[$i][$j]['width'].'"';
if (isset($contents[$i][$j]['colspan'])) $tdparam.=' colspan="'. $contents[$i][$j]['colspan'].'"';
if (isset($contents[$i][$j]['class'])) $tdparam.=' class="'. $contents[$i][$j]['class'].'"';
if (isset($contents[$i][$j]['td'])) $tdparam.=' '.$contents[$i][$j]['td']; if (isset($contents[$i][$j]['td'])) $tdparam.=' '.$contents[$i][$j]['td'];
if (!$contents[$i][$j]['text']) $contents[$i][$j]['text']=""; if (!$contents[$i][$j]['text']) $contents[$i][$j]['text']="";
@ -179,50 +176,50 @@ class ModeleBoxes
$texte2withnotags=eregi_replace('<[^>]+>','',$texte2); $texte2withnotags=eregi_replace('<[^>]+>','',$texte2);
//print "xxx $textewithnotags y"; //print "xxx $textewithnotags y";
if (isset($contents[$i][$j]['logo']) && $contents[$i][$j]['logo']) print '<td width="16">'; print '<td'.$tdparam.'>';
else print '<td '.$tdparam.'>';
// Picto // Url
if (isset($contents[$i][$j]['url'])) { if (! empty($contents[$i][$j]['url'])) {
print '<a href="'.$contents[$i][$j]['url'].'" title="'.$textewithnotags.'"'; print '<a href="'.$contents[$i][$j]['url'].'" title="'.$textewithnotags.'"';
//print ' alt="'.$textewithnotags.'"'; // Pas de alt sur un "<a href>" //print ' alt="'.$textewithnotags.'"'; // Pas de alt sur un "<a href>"
print isset($contents[$i][$j]['target'])?' target="'.$contents[$i][$j]['target'].'"':''; print isset($contents[$i][$j]['target'])?' target="'.$contents[$i][$j]['target'].'"':'';
print '>'; print '>';
} }
// Texte // Logo
if (isset($contents[$i][$j]['logo']) && $contents[$i][$j]['logo']) if (! empty($contents[$i][$j]['logo']))
{ {
$logo=eregi_replace("^object_","",$contents[$i][$j]['logo']); $logo=eregi_replace("^object_","",$contents[$i][$j]['logo']);
print img_object($langs->trans("Show"),$logo); print img_object($langs->trans("Show"),$logo);
if (isset($contents[$i][$j]['url'])) print '</a>';
print '</td><td '.$tdparam.'>';
if (isset($contents[$i][$j]['url']))
{
print '<a href="'.$contents[$i][$j]['url'].'" title="'.$textewithnotags.'"';
//print ' alt="'.$textewithnotags.'"'; // Pas de alt sur un "<a href>"
print isset($contents[$i][$j]['target'])?' target="'.$contents[$i][$j]['target'].'"':'';
print '>';
} }
}
$maxlength=$this->MAXLENGTHBOX; $maxlength=$MAXLENGTHBOX;
if (isset($contents[$i][$j]['maxlength'])) $maxlength=$contents[$i][$j]['maxlength']; if (! empty($contents[$i][$j]['maxlength'])) $maxlength=$contents[$i][$j]['maxlength'];
if ($maxlength) $textewithnotags=dolibarr_trunc($textewithnotags,$maxlength); if ($maxlength) $textewithnotags=dolibarr_trunc($textewithnotags,$maxlength);
if (eregi('^<img',$texte)) print $texte; // show text with no html cleaning if (eregi('^<img',$texte)) print $texte; // show text with no html cleaning
else print $textewithnotags; // show text with html cleaning else print $textewithnotags; // show text with html cleaning
// End picto // End Url
if (isset($contents[$i][$j]['url'])) print '</a>'; if (! empty($contents[$i][$j]['url'])) print '</a>';
if (eregi('^<img',$texte2)) print $texte2; // show text with no html cleaning if (eregi('^<img',$texte2)) print $texte2; // show text with no html cleaning
else print $texte2withnotags; // show text with html cleaning else print $texte2withnotags; // show text with html cleaning
print "</td>"; print "</td>";
} }
if (sizeof($contents[$i])) print "</tr>\n"; print "</tr>\n";
} }
} }
while ($i < $this->max)
{
$var=!$var;
print '<tr '.$bcx[$var].'><td colspan="'.$nbcol.'">&nbsp;</td></tr>';
$i++;
}
print "</table>\n"; print "</table>\n";
} }

View File

@ -20,7 +20,7 @@
/** /**
* \file htdocs/index.php * \file htdocs/index.php
* \brief Page accueil par defaut * \brief Dolibarr home page
* \version $Id$ * \version $Id$
*/ */
@ -28,16 +28,20 @@ require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/boxes.php"); require_once(DOL_DOCUMENT_ROOT."/boxes.php");
// Simule le menu par défaut sur Home // If not defined, we select menu "home"
if (! isset($_GET["mainmenu"])) $_GET["mainmenu"]="home"; if (! isset($_GET["mainmenu"])) $_GET["mainmenu"]="home";
$infobox=new InfoBox($db); $infobox=new InfoBox($db);
/*
* Actions
*/
// No actions
/* /*
* Affichage page * View
*/ */
llxHeader(); llxHeader();
@ -76,7 +80,7 @@ print '<tr><td valign="top" class="notopnoleft">';
/* /*
* Informations * Informations area
*/ */
if (file_exists(DOL_DOCUMENT_ROOT.'/logo.png')) if (file_exists(DOL_DOCUMENT_ROOT.'/logo.png'))
@ -566,12 +570,12 @@ print '</td></tr></table>';
/* /*
* Affichage des boites * Show boxes
*
*/ */
$boxarray=$infobox->listboxes("0",$user); // 0=valeur pour la page accueil $boxarray=$infobox->listboxes("0",$user); // 0=value for home page
$boxid_left = array();
$boxid_right = array(); //$boxid_left = array();
//$boxid_right = array();
if (sizeof($boxarray)) if (sizeof($boxarray))
{ {
@ -580,28 +584,30 @@ if (sizeof($boxarray))
print '<table width="100%" class="notopnoleftnoright">'; print '<table width="100%" class="notopnoleftnoright">';
print '<tr><td class="notopnoleftnoright">'."\n"; print '<tr><td class="notopnoleftnoright">'."\n";
print '<table width="100%" style="border-collapse: collapse; border: 0px; margin: 0px; padding: 0px;"><tr>';
// Affichage colonne gauche // Affichage colonne gauche
print "\n<!-- Box container -->\n"; print '<td width="50%" valign="top">'."\n";
print '<table width="100%" style="border-collapse: collapse; border: 0px; margin: 0px; padding: 0px;"><tr><td width="50%" valign="top">'."\n";
print "\n<!-- Box left container -->\n";
print '<div id="left">'."\n"; print '<div id="left">'."\n";
$ii=0; $ii=0;
foreach ($boxarray as $key => $box) foreach ($boxarray as $key => $box)
{ {
//print "xxx".$key."-".$value;
if (eregi('^A',$box->box_order)) // colonne A if (eregi('^A',$box->box_order)) // colonne A
{ {
$ii++; $ii++;
//print 'box_id '.$boxarray[$ii]->box_id.' '; //print 'box_id '.$boxarray[$ii]->box_id.' ';
//print 'box_order '.$boxarray[$ii]->box_order.'<br>'; //print 'box_order '.$boxarray[$ii]->box_order.'<br>';
$boxid_left[$key] = $boxarray[$key]->box_id; //$boxid_left[$key] = $box->box_id;
// Affichage boite key // Affichage boite key
$box->loadBox($conf->box_max_lines); $box->loadBox($conf->box_max_lines);
$box->showBox(); $box->showBox();
} }
} }
// If no box on left, we show add an invisible empty box // If no box on left, we add an invisible empty box
if ($ii==0) if ($ii==0)
{ {
$box->box_id='A'; $box->box_id='A';
@ -611,14 +617,13 @@ if (sizeof($boxarray))
} }
print "</div>\n"; print "</div>\n";
print '</td>';
print "<!-- End box container -->\n"; print "<!-- End box container -->\n";
print "\n";
print "</td>\n";
// Affichage colonne droite // Affichage colonne droite
print "\n<!-- Box container -->\n";
print '<td width="50%" valign="top">'; print '<td width="50%" valign="top">';
// print '<div id="right" style="position: absolute; display: block; width: 50%; padding: 0px; margin: 0px; float: right;">'."\n";
print "\n<!-- Box right container -->\n";
print '<div id="right">'."\n"; print '<div id="right">'."\n";
$ii=0; $ii=0;
@ -628,10 +633,9 @@ if (sizeof($boxarray))
if (eregi('^B',$box->box_order)) // colonne B if (eregi('^B',$box->box_order)) // colonne B
{ {
$ii++; $ii++;
//print 'key:'.$key.'<br>'; //print 'box_id '.$boxarray[$ii]->box_id.' ';
//print 'box_id '.$boxarray[$key]->box_id.' '; //print 'box_order '.$boxarray[$ii]->box_order.'<br>';
//print 'box_order '.$boxarray[$key]->box_order.'<br>'; //$boxid_right[$key] = $boxarray[$key]->box_id;
$boxid_right[$key] = $boxarray[$key]->box_id;
// Affichage boite key // Affichage boite key
$box->loadBox($conf->box_max_lines); $box->loadBox($conf->box_max_lines);
$box->showBox(); $box->showBox();
@ -648,8 +652,9 @@ if (sizeof($boxarray))
} }
print "</div>\n"; print "</div>\n";
print "</td></tr></table>\n";
print "<!-- End box container -->\n"; print "<!-- End box container -->\n";
print "</td>";
print "</tr></table>\n";
print "\n"; print "\n";
print "</td></tr>"; print "</td></tr>";