Qual: Modification de l'architecture des boites pour qu'elles fonctionnent sous formes de "classes".
Modification ncessaire pour plus de simplicit et souplesse dans leur utilisation ainsi que pour permettre leur internationnalisation.
This commit is contained in:
parent
5603130f61
commit
6aa1ffc805
103
htdocs/boxes.php
103
htdocs/boxes.php
@ -32,74 +32,53 @@
|
||||
|
||||
/** \class infoBox
|
||||
\brief Classe permettant la gestion des boxes sur une page
|
||||
\remarks Cette classe est utilisé par les fichiers includes/boxes/box_xxx.php
|
||||
\remarks qui sont les modules de boites
|
||||
*/
|
||||
|
||||
class infoBox
|
||||
class InfoBox
|
||||
{
|
||||
var $db;
|
||||
|
||||
/**
|
||||
* \brief Constructeur de la classe
|
||||
* \param $head tableau des entetes de colonnes
|
||||
* \param $contents tableau des lignes
|
||||
*/
|
||||
function infoBox($head, $contents)
|
||||
{
|
||||
global $langs;
|
||||
/**
|
||||
* \brief Constructeur de la classe
|
||||
* \param $DB Handler d'accès base
|
||||
*/
|
||||
function InfoBox($DB)
|
||||
{
|
||||
$this->db=$DB;
|
||||
}
|
||||
|
||||
$MAXLENGTHBOX=70; // Mettre 0 pour pas de limite
|
||||
|
||||
$var = true;
|
||||
$bcx[0] = 'class="box_pair"';
|
||||
$bcx[1] = 'class="box_impair"';
|
||||
$nbcol=sizeof($contents[0])+1;
|
||||
|
||||
print '<table width="100%" class="noborder">';
|
||||
|
||||
// Affiche titre de la boite
|
||||
print '<tr class="box_titre"><td';
|
||||
if ($nbcol > 0) { print ' colspan="'.$nbcol.'"'; }
|
||||
print '>'.$head[0]['text']."</td></tr>";
|
||||
|
||||
// Affiche chaque ligne de la boite
|
||||
for ($i=0, $n=sizeof($contents); $i < $n; $i++)
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr valign="top" '.$bcx[$var].'>';
|
||||
|
||||
// Affiche chaque cellule
|
||||
for ($j=0, $m=sizeof($contents[$i]); $j < $m; $j++)
|
||||
{
|
||||
$tdparam="";
|
||||
if ($contents[$i][$j]['align']) $tdparam.=' align="'. $contents[$i][$j]['align'].'"';
|
||||
if ($contents[$i][$j]['width']) $tdparam.=' width="'. $contents[$i][$j]['width'].'"';
|
||||
|
||||
if ($contents[$i][$j]['text']) {
|
||||
if ($contents[$i][$j]['logo']) print '<td width="16">';
|
||||
else print '<td '.$tdparam.'>';
|
||||
|
||||
if ($contents[$i][$j]['url']) print '<a href="'.$contents[$i][$j]['url'].'" title="'.$contents[$i][$j]['text'].'">';
|
||||
if ($contents[$i][$j]['logo']) {
|
||||
$logo=eregi_replace("^object_","",$contents[$i][$j]['logo']);
|
||||
print img_object($langs->trans("Show"),$logo);
|
||||
print '</a></td><td '.$tdparam.'><a href="'.$contents[$i][$j]['url'].'" title="'.$contents[$i][$j]['text'].'">';
|
||||
}
|
||||
$texte=$contents[$i][$j]['text'];
|
||||
if ($MAXLENGTHBOX && strlen($texte) > $MAXLENGTHBOX)
|
||||
{
|
||||
$texte=substr($texte,0,$MAXLENGTHBOX)."...";
|
||||
}
|
||||
print $texte;
|
||||
if ($contents[$i][$j]['url']) print '</a>';
|
||||
|
||||
print "</td>";
|
||||
/**
|
||||
* \brief Retourne liste des boites elligibles pour la zone
|
||||
* \param $zone ID de la zone (0 pour la Homepage, ...)
|
||||
* \return array Tableau des boites qualifiées
|
||||
*/
|
||||
function listBoxes($zone)
|
||||
{
|
||||
$boxes=array();
|
||||
|
||||
$sql = "SELECT b.rowid, b.box_id, d.file";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."boxes as b, ".MAIN_DB_PREFIX."boxes_def as d";
|
||||
$sql .= " WHERE b.box_id = d.rowid";
|
||||
$sql .= " AND position = ".$zone;
|
||||
$sql .= " ORDER BY box_order";
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $this->db->num_rows($result);
|
||||
$j = 0;
|
||||
while ($j < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$boxes[$j]=eregi_replace('.php$','',$obj->file);
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
}
|
||||
else {
|
||||
return array();
|
||||
}
|
||||
return $boxes;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
@ -27,36 +27,54 @@
|
||||
\brief Module de génération de l'affichage de la box boutique livres
|
||||
*/
|
||||
|
||||
$info_box_head = array();
|
||||
$info_box_head[] = array('text' => "Les 20 derniers ouvrages");
|
||||
|
||||
$info_box_contents = array();
|
||||
include_once("./includes/boxes/modules_boxes.php");
|
||||
|
||||
$sql = "SELECT l.ref, l.title, l.rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."livre as l ";
|
||||
$sql .= " ORDER BY l.date_ajout DESC ";
|
||||
$sql .= $db->plimit(20, 0);
|
||||
|
||||
$result = $db->query($sql);
|
||||
class box_boutique_livre extends ModeleBoxes {
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
var $info_box_head = array();
|
||||
var $info_box_contents = array();
|
||||
|
||||
function loadBox($max=5)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$info_box_contents[$i][0] = array('align' => 'left',
|
||||
'logo' => 'object_book',
|
||||
'text' => $objp->title,
|
||||
'url' => DOL_URL_ROOT."/boutique/livre/fiche.php?id=".$objp->rowid);
|
||||
global $user, $langs, $db;
|
||||
|
||||
$this->info_box_head = array('text' => "Les $max derniers ouvrages");
|
||||
|
||||
$sql = "SELECT l.ref, l.title, l.rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."livre as l ";
|
||||
$sql .= " ORDER BY l.date_ajout DESC ";
|
||||
$sql .= $db->plimit($max, 0);
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$this->info_box_contents[$i][0] = array('align' => 'left',
|
||||
'logo' => 'object_book',
|
||||
'text' => $objp->title,
|
||||
'url' => DOL_URL_ROOT."/boutique/livre/fiche.php?id=".$objp->rowid);
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
function showBox()
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
new infoBox($info_box_head, $info_box_contents);
|
||||
?>
|
||||
|
||||
@ -27,40 +27,57 @@
|
||||
\brief Module de génération de l'affichage de la box clients
|
||||
*/
|
||||
|
||||
$info_box_head = array();
|
||||
$info_box_head[] = array('text' => "Les 5 derniers clients enregistrés");
|
||||
include_once("./includes/boxes/modules_boxes.php");
|
||||
|
||||
$info_box_contents = array();
|
||||
|
||||
$sql = "SELECT s.nom,s.idp";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s WHERE s.client = 1";
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$sql .= " AND s.idp = $user->societe_id";
|
||||
}
|
||||
$sql .= " ORDER BY s.datec DESC ";
|
||||
$sql .= $db->plimit(5, 0);
|
||||
class box_clients extends ModeleBoxes {
|
||||
|
||||
$result = $db->query($sql);
|
||||
var $info_box_head = array();
|
||||
var $info_box_contents = array();
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
function loadBox($max=5)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$info_box_contents[$i][0] = array('align' => 'left',
|
||||
'logo' => 'object_company',
|
||||
'text' => stripslashes($objp->nom),
|
||||
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->idp);
|
||||
global $user, $langs, $db;
|
||||
|
||||
$this->info_box_head = array('text' => "Les $max derniers clients enregistrés");
|
||||
|
||||
$sql = "SELECT s.nom,s.idp";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s WHERE s.client = 1";
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$sql .= " AND s.idp = $user->societe_id";
|
||||
}
|
||||
$sql .= " ORDER BY s.datec DESC ";
|
||||
$sql .= $db->plimit($max, 0);
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$this->info_box_contents[$i][0] = array('align' => 'left',
|
||||
'logo' => 'object_company',
|
||||
'text' => stripslashes($objp->nom),
|
||||
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->idp);
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
function showBox()
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
new infoBox($info_box_head, $info_box_contents);
|
||||
?>
|
||||
|
||||
@ -27,46 +27,62 @@
|
||||
\brief Module de génération de l'affichage de la box commandes
|
||||
*/
|
||||
|
||||
if ($user->rights->commande->lire)
|
||||
{
|
||||
include_once("./includes/boxes/modules_boxes.php");
|
||||
|
||||
$info_box_head = array();
|
||||
$info_box_head[] = array('text' => "Les 5 dernières commandes");
|
||||
|
||||
$info_box_contents = array();
|
||||
class box_commandes extends ModeleBoxes {
|
||||
|
||||
$sql = "SELECT s.nom,s.idp,p.ref,".$db->pdate("p.date_commande")." as dp,p.rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as p WHERE p.fk_soc = s.idp";
|
||||
if($user->societe_id)
|
||||
var $info_box_head = array();
|
||||
var $info_box_contents = array();
|
||||
|
||||
function loadBox($max=5)
|
||||
{
|
||||
$sql .= " AND s.idp = $user->societe_id";
|
||||
global $user, $langs, $db;
|
||||
|
||||
if ($user->rights->commande->lire)
|
||||
{
|
||||
$this->info_box_head = array('text' => "Les $max dernières commandes");
|
||||
|
||||
$sql = "SELECT s.nom,s.idp,p.ref,".$db->pdate("p.date_commande")." as dp,p.rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as p WHERE p.fk_soc = s.idp";
|
||||
if($user->societe_id)
|
||||
{
|
||||
$sql .= " AND s.idp = $user->societe_id";
|
||||
}
|
||||
$sql .= " ORDER BY p.date_commande DESC, p.ref DESC ";
|
||||
$sql .= $db->plimit($max, 0);
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$this->info_box_contents[$i][0] = array('align' => 'left',
|
||||
'logo' => 'object_order',
|
||||
'text' => $objp->ref,
|
||||
'url' => DOL_URL_ROOT."/commande/fiche.php?id=".$objp->rowid);
|
||||
|
||||
$this->info_box_contents[$i][1] = array('align' => 'left',
|
||||
'text' => $objp->nom,
|
||||
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->idp);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$sql .= " ORDER BY p.date_commande DESC, p.ref DESC ";
|
||||
$sql .= $db->plimit(5, 0);
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result)
|
||||
function showBox()
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$info_box_contents[$i][0] = array('align' => 'left',
|
||||
'logo' => 'object_order',
|
||||
'text' => $objp->ref,
|
||||
'url' => DOL_URL_ROOT."/commande/fiche.php?id=".$objp->rowid);
|
||||
|
||||
$info_box_contents[$i][1] = array('align' => 'left',
|
||||
'text' => $objp->nom,
|
||||
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->idp);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
new infoBox($info_box_head, $info_box_contents);
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -29,26 +29,44 @@
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require_once("includes/magpierss/rss_fetch.inc");
|
||||
require_once("./includes/magpierss/rss_fetch.inc");
|
||||
include_once("./includes/boxes/modules_boxes.php");
|
||||
|
||||
|
||||
class box_external_rss extends ModeleBoxes {
|
||||
|
||||
var $info_box_head = array();
|
||||
var $info_box_contents = array();
|
||||
|
||||
function loadBox($max=5)
|
||||
{
|
||||
global $user, $langs, $db;
|
||||
|
||||
for($site = 0; $site < 1; $site++) {
|
||||
$this->info_box_head = array('text' => "Les $max dernières infos du site " . @constant("EXTERNAL_RSS_TITLE_". $site));
|
||||
$rss = fetch_rss( @constant("EXTERNAL_RSS_URLRSS_" . $site) );
|
||||
for($i = 0; $i < $max ; $i++){
|
||||
$item = $rss->items[$i];
|
||||
$href = $item['link'];
|
||||
$title = utf8_decode(urldecode($item['title']));
|
||||
$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
|
||||
$this->info_box_contents["$href"]="$title";
|
||||
$this->info_box_contents[$i][0] = array('align' => 'left',
|
||||
'logo' => 'object_rss',
|
||||
'text' => $title,
|
||||
'url' => $href);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function showBox()
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
||||
}
|
||||
|
||||
for($site = 0; $site < 1; $site++) {
|
||||
$info_box_head = array();
|
||||
$info_box_head[] = array('text' => "Les 5 dernières infos du site " . @constant("EXTERNAL_RSS_TITLE_". $site));
|
||||
$info_box_contents = array();
|
||||
$rss = fetch_rss( @constant("EXTERNAL_RSS_URLRSS_" . $site) );
|
||||
for($i = 0; $i < 5 ; $i++){
|
||||
$item = $rss->items[$i];
|
||||
$href = $item['link'];
|
||||
$title = utf8_decode(urldecode($item['title']));
|
||||
$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
|
||||
$info_box_contents["$href"]="$title";
|
||||
$info_box_contents[$i][0] = array('align' => 'left',
|
||||
'logo' => 'object_rss',
|
||||
'text' => $title,
|
||||
'url' => $href);
|
||||
}
|
||||
new infoBox($info_box_head, $info_box_contents);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -27,47 +27,63 @@
|
||||
\brief Module de génération de l'affichage de la box factures
|
||||
*/
|
||||
|
||||
if ($user->rights->facture->lire)
|
||||
{
|
||||
include_once("./includes/boxes/modules_boxes.php");
|
||||
|
||||
$info_box_head = array();
|
||||
$info_box_head[] = array('text' => "Les 5 dernières factures clients enregistrées");
|
||||
|
||||
$info_box_contents = array();
|
||||
class box_factures extends ModeleBoxes {
|
||||
|
||||
$sql = "SELECT s.nom,s.idp,f.facnumber,f.amount,".$db->pdate("f.datef")." as df,f.paye,f.rowid as facid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.idp";
|
||||
if($user->societe_id)
|
||||
var $info_box_head = array();
|
||||
var $info_box_contents = array();
|
||||
|
||||
function loadBox($max=5)
|
||||
{
|
||||
$sql .= " AND s.idp = $user->societe_id";
|
||||
global $user, $langs, $db;
|
||||
|
||||
if ($user->rights->facture->lire)
|
||||
{
|
||||
$this->info_box_head = array('text' => "Les $max dernières factures clients enregistrées");
|
||||
|
||||
$sql = "SELECT s.nom,s.idp,f.facnumber,f.amount,".$db->pdate("f.datef")." as df,f.paye,f.rowid as facid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.idp";
|
||||
if($user->societe_id)
|
||||
{
|
||||
$sql .= " AND s.idp = $user->societe_id";
|
||||
}
|
||||
$sql .= " ORDER BY f.datef DESC, f.facnumber DESC ";
|
||||
$sql .= $db->plimit($max, 0);
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$this->info_box_contents[$i][0] = array('align' => 'left',
|
||||
'logo' => 'object_bill',
|
||||
'text' => $objp->facnumber,
|
||||
'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid);
|
||||
|
||||
$this->info_box_contents[$i][1] = array('align' => 'left',
|
||||
'text' => $objp->nom,
|
||||
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->idp);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
$sql .= " ORDER BY f.datef DESC, f.facnumber DESC ";
|
||||
$sql .= $db->plimit(5, 0);
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result)
|
||||
|
||||
function showBox()
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$info_box_contents[$i][0] = array('align' => 'left',
|
||||
'logo' => 'object_bill',
|
||||
'text' => $objp->facnumber,
|
||||
'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid);
|
||||
|
||||
$info_box_contents[$i][1] = array('align' => 'left',
|
||||
'text' => $objp->nom,
|
||||
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->idp);
|
||||
$i++;
|
||||
}
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
||||
}
|
||||
|
||||
new infoBox($info_box_head, $info_box_contents);
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -28,48 +28,62 @@
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
include_once("./includes/boxes/modules_boxes.php");
|
||||
|
||||
if ($user->rights->facture->lire)
|
||||
{
|
||||
|
||||
$info_box_head = array();
|
||||
$info_box_head[] = array('text' => "Les 5 dernières factures fournisseurs enregistrées");
|
||||
class box_factures_fourn extends ModeleBoxes {
|
||||
|
||||
$info_box_contents = array();
|
||||
var $info_box_head = array();
|
||||
var $info_box_contents = array();
|
||||
|
||||
$sql = "SELECT s.nom,s.idp,f.facnumber,f.amount,".$db->pdate("f.datef")." as df,f.paye,f.rowid as facid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_fourn as f WHERE f.fk_soc = s.idp";
|
||||
if($user->societe_id)
|
||||
function loadBox($max=5)
|
||||
{
|
||||
$sql .= " AND s.idp = $user->societe_id";
|
||||
global $user, $langs, $db;
|
||||
|
||||
$this->info_box_head = array('text' => "Les $max dernières factures fournisseurs enregistrées");
|
||||
|
||||
if ($user->rights->facture->lire)
|
||||
{
|
||||
$sql = "SELECT s.nom,s.idp,f.facnumber,f.amount,".$db->pdate("f.datef")." as df,f.paye,f.rowid as facid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_fourn as f WHERE f.fk_soc = s.idp";
|
||||
if($user->societe_id)
|
||||
{
|
||||
$sql .= " AND s.idp = $user->societe_id";
|
||||
}
|
||||
$sql .= " ORDER BY f.datef DESC, f.facnumber DESC ";
|
||||
$sql .= $db->plimit($max, 0);
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$this->info_box_contents[$i][0] = array('align' => 'left',
|
||||
'logo' => 'object_bill',
|
||||
'text' => $objp->facnumber,
|
||||
'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid);
|
||||
|
||||
$this->info_box_contents[$i][1] = array('align' => 'left',
|
||||
'text' => $objp->nom,
|
||||
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->idp);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$sql .= " ORDER BY f.datef DESC, f.facnumber DESC ";
|
||||
$sql .= $db->plimit(5, 0);
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result)
|
||||
|
||||
function showBox()
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$info_box_contents[$i][0] = array('align' => 'left',
|
||||
'logo' => 'object_bill',
|
||||
'text' => $objp->facnumber,
|
||||
'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid);
|
||||
|
||||
$info_box_contents[$i][1] = array('align' => 'left',
|
||||
'text' => $objp->nom,
|
||||
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->idp);
|
||||
$i++;
|
||||
}
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
||||
}
|
||||
|
||||
new infoBox($info_box_head, $info_box_contents);
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -27,48 +27,63 @@
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
if ($user->rights->facture->lire)
|
||||
{
|
||||
$nbtoshow=5;
|
||||
|
||||
$info_box_head = array();
|
||||
$info_box_head[] = array('text' => "Les $nbtoshow plus anciennes factures fournisseurs impayées");
|
||||
include_once("./includes/boxes/modules_boxes.php");
|
||||
|
||||
$info_box_contents = array();
|
||||
|
||||
$sql = "SELECT s.nom,s.idp,f.facnumber,f.amount,".$db->pdate("f.datef")." as df,f.paye,f.rowid as facid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_fourn as f WHERE f.fk_soc = s.idp AND f.paye=0 AND fk_statut = 1";
|
||||
if($user->societe_id)
|
||||
class box_factures_fourn_imp extends ModeleBoxes {
|
||||
|
||||
var $info_box_head = array();
|
||||
var $info_box_contents = array();
|
||||
|
||||
function loadBox($max=5)
|
||||
{
|
||||
$sql .= " AND s.idp = $user->societe_id";
|
||||
global $user, $langs, $db;
|
||||
|
||||
if ($user->rights->facture->lire)
|
||||
{
|
||||
$this->info_box_head = array('text' => "Les $max plus anciennes factures fournisseurs impayées");
|
||||
|
||||
$sql = "SELECT s.nom,s.idp,f.facnumber,f.amount,".$db->pdate("f.datef")." as df,f.paye,f.rowid as facid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_fourn as f WHERE f.fk_soc = s.idp AND f.paye=0 AND fk_statut = 1";
|
||||
if($user->societe_id)
|
||||
{
|
||||
$sql .= " AND s.idp = $user->societe_id";
|
||||
}
|
||||
$sql .= " ORDER BY f.datef DESC, f.facnumber DESC ";
|
||||
$sql .= $db->plimit($max, 0);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$this->info_box_contents[$i][0] = array('align' => 'left',
|
||||
'logo' => 'object_product',
|
||||
'text' => $objp->facnumber,
|
||||
'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid);
|
||||
|
||||
$this->info_box_contents[$i][1] = array('align' => 'left',
|
||||
'text' => $objp->nom,
|
||||
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->idp);
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
$sql .= " ORDER BY f.datef DESC, f.facnumber DESC ";
|
||||
$sql .= $db->plimit(5, 0);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
|
||||
function showBox()
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$info_box_contents[$i][0] = array('align' => 'left',
|
||||
'logo' => 'object_product',
|
||||
'text' => $objp->facnumber,
|
||||
'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid);
|
||||
|
||||
$info_box_contents[$i][1] = array('align' => 'left',
|
||||
'text' => $objp->nom,
|
||||
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->idp);
|
||||
|
||||
$i++;
|
||||
}
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
||||
}
|
||||
|
||||
new infoBox($info_box_head, $info_box_contents);
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -27,48 +27,62 @@
|
||||
\brief Module de génération de l'affichage de la box factures impayees
|
||||
*/
|
||||
|
||||
if ($user->rights->facture->lire)
|
||||
{
|
||||
$nbtoshow=5;
|
||||
|
||||
$info_box_head = array();
|
||||
$info_box_head[] = array('text' => "Les $nbtoshow plus anciennes factures clients impayées");
|
||||
include_once("./includes/boxes/modules_boxes.php");
|
||||
|
||||
$info_box_contents = array();
|
||||
|
||||
$sql = "SELECT s.nom,s.idp,f.facnumber,f.amount,".$db->pdate("f.datef")." as df,f.paye,f.rowid as facid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.idp AND f.paye=0 AND fk_statut = 1";
|
||||
if($user->societe_id)
|
||||
class box_factures_imp extends ModeleBoxes {
|
||||
|
||||
var $info_box_head = array();
|
||||
var $info_box_contents = array();
|
||||
|
||||
function loadBox($max=5)
|
||||
{
|
||||
$sql .= " AND s.idp = $user->societe_id";
|
||||
global $user, $langs, $db;
|
||||
|
||||
$this->info_box_head = array('text' => "Les $max plus anciennes factures clients impayées");
|
||||
|
||||
if ($user->rights->facture->lire)
|
||||
{
|
||||
$sql = "SELECT s.nom,s.idp,f.facnumber,f.amount,".$db->pdate("f.datef")." as df,f.paye,f.rowid as facid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.idp AND f.paye=0 AND fk_statut = 1";
|
||||
if($user->societe_id)
|
||||
{
|
||||
$sql .= " AND s.idp = $user->societe_id";
|
||||
}
|
||||
$sql .= " ORDER BY f.datef DESC, f.facnumber DESC ";
|
||||
$sql .= $db->plimit($max, 0);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$this->info_box_contents[$i][0] = array('align' => 'left',
|
||||
'logo' => 'object_bill',
|
||||
'text' => $objp->facnumber,
|
||||
'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid);
|
||||
|
||||
$this->info_box_contents[$i][1] = array('align' => 'left',
|
||||
'text' => $objp->nom,
|
||||
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->idp);
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$sql .= " ORDER BY f.datef DESC, f.facnumber DESC ";
|
||||
$sql .= $db->plimit($nbtoshow, 0);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
|
||||
function showBox()
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$info_box_contents[$i][0] = array('align' => 'left',
|
||||
'logo' => 'object_bill',
|
||||
'text' => $objp->facnumber,
|
||||
'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid);
|
||||
|
||||
$info_box_contents[$i][1] = array('align' => 'left',
|
||||
'text' => $objp->nom,
|
||||
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->idp);
|
||||
|
||||
$i++;
|
||||
}
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
||||
}
|
||||
|
||||
new infoBox($info_box_head, $info_box_contents);
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -26,40 +26,57 @@
|
||||
\brief Module de génération de l'affichage de la box fournisseurs
|
||||
*/
|
||||
|
||||
$info_box_head = array();
|
||||
$info_box_head[] = array('text' => "Les 5 derniers fournisseurs enregistrés");
|
||||
include_once("./includes/boxes/modules_boxes.php");
|
||||
|
||||
$info_box_contents = array();
|
||||
|
||||
$sql = "SELECT s.nom,s.idp";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s WHERE s.fournisseur = 1";
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$sql .= " AND s.idp = $user->societe_id";
|
||||
}
|
||||
$sql .= " ORDER BY s.datec DESC ";
|
||||
$sql .= $db->plimit(5, 0);
|
||||
class box_fournisseurs extends ModeleBoxes {
|
||||
|
||||
$result = $db->query($sql);
|
||||
var $info_box_head = array();
|
||||
var $info_box_contents = array();
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
function loadBox($max=5)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$info_box_contents[$i][0] = array('align' => 'left',
|
||||
'logo' => 'object_company',
|
||||
'text' => $objp->nom,
|
||||
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->idp);
|
||||
global $user, $langs, $db;
|
||||
|
||||
$this->info_box_head = array('text' => "Les $max5 derniers fournisseurs enregistrés");
|
||||
|
||||
$sql = "SELECT s.nom,s.idp";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s WHERE s.fournisseur = 1";
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$sql .= " AND s.idp = $user->societe_id";
|
||||
}
|
||||
$sql .= " ORDER BY s.datec DESC ";
|
||||
$sql .= $db->plimit($max, 0);
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$this->info_box_contents[$i][0] = array('align' => 'left',
|
||||
'logo' => 'object_company',
|
||||
'text' => $objp->nom,
|
||||
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->idp);
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
function showBox()
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
new infoBox($info_box_head, $info_box_contents);
|
||||
?>
|
||||
|
||||
@ -21,39 +21,54 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/*!
|
||||
/**
|
||||
\file htdocs/includes/boxes/box_osc_client.php
|
||||
\ingroup osc
|
||||
\brief Module de génération de l'affichage de la box osc client
|
||||
*/
|
||||
|
||||
$info_box_head = array();
|
||||
$info_box_head[] = array('text' => "Clients");
|
||||
|
||||
$info_box_contents = array();
|
||||
include_once("./includes/boxes/modules_boxes.php");
|
||||
|
||||
|
||||
$sql = "SELECT count(*) as cus FROM ".DB_NAME_OSC.".customers";
|
||||
class box_osc_clients extends ModeleBoxes {
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
var $info_box_head = array();
|
||||
var $info_box_contents = array();
|
||||
|
||||
function loadBox($max=5)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$info_box_contents[$i][0] = array('align' => 'center',
|
||||
'logo' => 'object_product',
|
||||
'text' => $objp->cus,
|
||||
'url' => DOL_URL_ROOT."/boutique/client/index.php");
|
||||
$i++;
|
||||
global $user, $langs, $db;
|
||||
|
||||
$this->info_box_head = array('text' => "Nombre de client");
|
||||
|
||||
$sql = "SELECT count(*) as cus FROM ".DB_NAME_OSC.".customers";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$this->info_box_contents[$i][0] = array('align' => 'center',
|
||||
'logo' => 'object_product',
|
||||
'text' => $objp->cus,
|
||||
'url' => DOL_URL_ROOT."/boutique/client/index.php");
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function showBox()
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
new infoBox($info_box_head, $info_box_contents);
|
||||
|
||||
?>
|
||||
|
||||
@ -27,38 +27,57 @@
|
||||
\brief Module de génération de l'affichage de la box produits
|
||||
*/
|
||||
|
||||
if ($user->rights->produit->lire)
|
||||
{
|
||||
$info_box_head = array();
|
||||
$info_box_head[] = array('text' => "Les 5 derniers produits/services enregistrés");
|
||||
include_once("./includes/boxes/modules_boxes.php");
|
||||
|
||||
$info_box_contents = array();
|
||||
|
||||
$sql = "SELECT p.label, p.rowid, p.price, p.fk_product_type";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
$sql .= " ORDER BY p.datec DESC";
|
||||
$sql .= $db->plimit(5, 0);
|
||||
|
||||
$result = $db->query($sql);
|
||||
class box_produits extends ModeleBoxes {
|
||||
|
||||
if ($result)
|
||||
var $info_box_head = array();
|
||||
var $info_box_contents = array();
|
||||
|
||||
function loadBox($max=5)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$info_box_contents[$i][0] = array('align' => 'left',
|
||||
'logo' => ($objp->fk_product_type?'object_service':'object_product'),
|
||||
'text' => $objp->label,
|
||||
'url' => DOL_URL_ROOT."/product/fiche.php?id=".$objp->rowid);
|
||||
|
||||
$info_box_contents[$i][1] = array('align' => 'right',
|
||||
'text' => price($objp->price));
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
new infoBox($info_box_head, $info_box_contents);
|
||||
global $user, $langs, $db;
|
||||
|
||||
$this->info_box_head = array('text' => "Les $max derniers produits/services enregistrés");
|
||||
|
||||
if ($user->rights->produit->lire)
|
||||
{
|
||||
$sql = "SELECT p.label, p.rowid, p.price, p.fk_product_type";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
$sql .= " ORDER BY p.datec DESC";
|
||||
$sql .= $db->plimit($max, 0);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$this->info_box_contents[$i][0] = array('align' => 'left',
|
||||
'logo' => ($objp->fk_product_type?'object_service':'object_product'),
|
||||
'text' => $objp->label,
|
||||
'url' => DOL_URL_ROOT."/product/fiche.php?id=".$objp->rowid);
|
||||
|
||||
$this->info_box_contents[$i][1] = array('align' => 'right',
|
||||
'text' => price($objp->price));
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function showBox()
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -27,46 +27,63 @@
|
||||
\brief Module de génération de l'affichage de la box propales
|
||||
*/
|
||||
|
||||
if ($user->rights->propale->lire)
|
||||
{
|
||||
include_once("./includes/boxes/modules_boxes.php");
|
||||
|
||||
$info_box_head = array();
|
||||
$info_box_head[] = array('text' => "Les 5 dernières propositions");
|
||||
|
||||
$info_box_contents = array();
|
||||
class box_propales extends ModeleBoxes {
|
||||
|
||||
$sql = "SELECT s.nom,s.idp,p.ref,".$db->pdate("p.datep")." as dp,p.rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."propal as p WHERE p.fk_soc = s.idp";
|
||||
if($user->societe_id)
|
||||
var $info_box_head = array();
|
||||
var $info_box_contents = array();
|
||||
|
||||
function loadBox($max=5)
|
||||
{
|
||||
$sql .= " AND s.idp = $user->societe_id";
|
||||
global $user, $langs, $db;
|
||||
|
||||
if ($user->rights->propale->lire)
|
||||
{
|
||||
$this->info_box_head = array('text' => "Les $max dernières propositions");
|
||||
|
||||
$sql = "SELECT s.nom,s.idp,p.ref,".$db->pdate("p.datep")." as dp,p.rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."propal as p WHERE p.fk_soc = s.idp";
|
||||
if($user->societe_id)
|
||||
{
|
||||
$sql .= " AND s.idp = $user->societe_id";
|
||||
}
|
||||
$sql .= " ORDER BY p.datep DESC, p.ref DESC ";
|
||||
$sql .= $db->plimit($max, 0);
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$this->info_box_contents[$i][0] = array('align' => 'left',
|
||||
'logo' => 'object_propal',
|
||||
'text' => $objp->ref,
|
||||
'url' => DOL_URL_ROOT."/comm/propal.php?propalid=".$objp->rowid);
|
||||
|
||||
$this->info_box_contents[$i][1] = array('align' => 'left',
|
||||
'text' => $objp->nom,
|
||||
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->idp);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
$sql .= " ORDER BY p.datep DESC, p.ref DESC ";
|
||||
$sql .= $db->plimit(5, 0);
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result)
|
||||
function showBox()
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$info_box_contents[$i][0] = array('align' => 'left',
|
||||
'logo' => 'object_propal',
|
||||
'text' => $objp->ref,
|
||||
'url' => DOL_URL_ROOT."/comm/propal.php?propalid=".$objp->rowid);
|
||||
|
||||
$info_box_contents[$i][1] = array('align' => 'left',
|
||||
'text' => $objp->nom,
|
||||
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->idp);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
new infoBox($info_box_head, $info_box_contents);
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -27,40 +27,58 @@
|
||||
\brief Module de génération de l'affichage de la box prospect
|
||||
*/
|
||||
|
||||
$info_box_head = array();
|
||||
$info_box_head[] = array('text' => "Les 5 derniers prospects enregistrés");
|
||||
|
||||
$info_box_contents = array();
|
||||
include_once("./includes/boxes/modules_boxes.php");
|
||||
|
||||
$sql = "SELECT s.nom,s.idp";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s WHERE s.client = 2";
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$sql .= " AND s.idp = $user->societe_id";
|
||||
}
|
||||
$sql .= " ORDER BY s.datec DESC ";
|
||||
$sql .= $db->plimit(5, 0);
|
||||
|
||||
$result = $db->query($sql);
|
||||
class box_prospect extends ModeleBoxes {
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
var $info_box_head = array();
|
||||
var $info_box_contents = array();
|
||||
|
||||
function loadBox($max=5)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$info_box_contents[$i][0] = array('align' => 'left',
|
||||
'logo' => 'object_company',
|
||||
'text' => stripslashes($objp->nom),
|
||||
'url' => DOL_URL_ROOT."/comm/prospect/fiche.php?id=".$objp->idp);
|
||||
global $user, $langs, $db;
|
||||
|
||||
$this->info_box_head = array('text' => "Les $max derniers prospects enregistrés");
|
||||
|
||||
$sql = "SELECT s.nom,s.idp";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s WHERE s.client = 2";
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$sql .= " AND s.idp = $user->societe_id";
|
||||
}
|
||||
$sql .= " ORDER BY s.datec DESC ";
|
||||
$sql .= $db->plimit($max, 0);
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$this->info_box_contents[$i][0] = array('align' => 'left',
|
||||
'logo' => 'object_company',
|
||||
'text' => stripslashes($objp->nom),
|
||||
'url' => DOL_URL_ROOT."/comm/prospect/fiche.php?id=".$objp->idp);
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
function showBox()
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
new infoBox($info_box_head, $info_box_contents);
|
||||
?>
|
||||
|
||||
@ -27,49 +27,62 @@
|
||||
\brief Module de génération de l'affichage de la box services_vendus
|
||||
*/
|
||||
|
||||
$info_box_head = array();
|
||||
$info_box_head[] = array('text' => "Les 5 derniers produits/services contractés");
|
||||
include_once("./includes/boxes/modules_boxes.php");
|
||||
|
||||
$info_box_contents = array();
|
||||
|
||||
$sql = "SELECT s.nom, s.idp, p.label, p.fk_product_type, c.rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."product as p";
|
||||
$sql .= " WHERE s.idp = c.fk_soc AND c.fk_product = p.rowid";
|
||||
if($user->societe_id)
|
||||
{
|
||||
$sql .= " AND s.idp = $user->societe_id";
|
||||
}
|
||||
$sql .= " ORDER BY c.tms DESC ";
|
||||
class box_services_vendus extends ModeleBoxes {
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
$sql .= $db->plimit(5, 0);
|
||||
var $info_box_head = array();
|
||||
var $info_box_contents = array();
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
function loadBox($max=5)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$info_box_contents[$i][0] = array('align' => 'left',
|
||||
'logo' => ($objp->fk_product_type?'object_service':'object_product'),
|
||||
'text' => $objp->label,
|
||||
'url' => DOL_URL_ROOT."/contrat/fiche.php?id=".$objp->rowid);
|
||||
global $user, $langs, $db;
|
||||
|
||||
$info_box_contents[$i][1] = array('align' => 'left',
|
||||
'text' => $objp->nom,
|
||||
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->idp);
|
||||
$this->info_box_head = array('text' => "Les $max derniers produits/services contractés");
|
||||
|
||||
$sql = "SELECT s.nom, s.idp, p.label, p.fk_product_type, c.rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."product as p";
|
||||
$sql .= " WHERE s.idp = c.fk_soc AND c.fk_product = p.rowid";
|
||||
if($user->societe_id)
|
||||
{
|
||||
$sql .= " AND s.idp = $user->societe_id";
|
||||
}
|
||||
$sql .= " ORDER BY c.tms DESC ";
|
||||
$sql .= $db->plimit($max, 0);
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$this->info_box_contents[$i][0] = array('align' => 'left',
|
||||
'logo' => ($objp->fk_product_type?'object_service':'object_product'),
|
||||
'text' => $objp->label,
|
||||
'url' => DOL_URL_ROOT."/contrat/fiche.php?id=".$objp->rowid);
|
||||
|
||||
$this->info_box_contents[$i][1] = array('align' => 'left',
|
||||
'text' => $objp->nom,
|
||||
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->idp);
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
function showBox()
|
||||
{
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
new infoBox($info_box_head, $info_box_contents);
|
||||
?>
|
||||
|
||||
117
htdocs/includes/boxes/modules_boxes.php
Normal file
117
htdocs/includes/boxes/modules_boxes.php
Normal file
@ -0,0 +1,117 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* or see http://www.gnu.org/
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
/** \file htdocs/includes/boxes/modules_boxes.php
|
||||
\ingroup facture
|
||||
\brief Fichier contenant la classe mère des boites
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
\class ModeleBoxes
|
||||
\brief Classe mère des boites
|
||||
*/
|
||||
|
||||
class ModeleBoxes
|
||||
{
|
||||
var $MAXLENGTHBOX=70; // Mettre 0 pour pas de limite
|
||||
|
||||
var $error='';
|
||||
|
||||
|
||||
/**
|
||||
\brief Renvoi le dernier message d'erreur de création de facture
|
||||
*/
|
||||
function error()
|
||||
{
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
\brief Methode standard d'affichage des boites
|
||||
\param $head tableau des caractéristiques du titre
|
||||
\param $contents tableau des lignes de contenu
|
||||
*/
|
||||
function showBox($head, $contents)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$bcx[0] = 'class="box_pair"';
|
||||
$bcx[1] = 'class="box_impair"';
|
||||
|
||||
$var = true;
|
||||
$nbcol=sizeof($contents[0])+1;
|
||||
|
||||
print '<table width="100%" class="noborder">';
|
||||
|
||||
// Affiche titre de la boite
|
||||
print '<tr class="box_titre"><td';
|
||||
if ($nbcol > 0) { print ' colspan="'.$nbcol.'"'; }
|
||||
print '>'.$head['text']."</td></tr>";
|
||||
|
||||
// Affiche chaque ligne de la boite
|
||||
for ($i=0, $n=sizeof($contents); $i < $n; $i++)
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr valign="top" '.$bcx[$var].'>';
|
||||
|
||||
// Affiche chaque cellule
|
||||
for ($j=0, $m=sizeof($contents[$i]); $j < $m; $j++)
|
||||
{
|
||||
$tdparam="";
|
||||
if ($contents[$i][$j]['align']) $tdparam.=' align="'. $contents[$i][$j]['align'].'"';
|
||||
if ($contents[$i][$j]['width']) $tdparam.=' width="'. $contents[$i][$j]['width'].'"';
|
||||
|
||||
if ($contents[$i][$j]['text']) {
|
||||
if ($contents[$i][$j]['logo']) print '<td width="16">';
|
||||
else print '<td '.$tdparam.'>';
|
||||
|
||||
if ($contents[$i][$j]['url']) print '<a href="'.$contents[$i][$j]['url'].'" title="'.$contents[$i][$j]['text'].'">';
|
||||
if ($contents[$i][$j]['logo']) {
|
||||
$logo=eregi_replace("^object_","",$contents[$i][$j]['logo']);
|
||||
print img_object($langs->trans("Show"),$logo);
|
||||
print '</a></td><td '.$tdparam.'><a href="'.$contents[$i][$j]['url'].'" title="'.$contents[$i][$j]['text'].'">';
|
||||
}
|
||||
$texte=$contents[$i][$j]['text'];
|
||||
if ($MAXLENGTHBOX && strlen($texte) > $MAXLENGTHBOX)
|
||||
{
|
||||
$texte=substr($texte,0,$MAXLENGTHBOX)."...";
|
||||
}
|
||||
print $texte;
|
||||
if ($contents[$i][$j]['url']) print '</a>';
|
||||
|
||||
print "</td>";
|
||||
}
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@ -30,6 +30,8 @@
|
||||
|
||||
require("./pre.inc.php");
|
||||
|
||||
$user->getrights('');
|
||||
|
||||
|
||||
// Simule le menu par défaut sur Home
|
||||
$_GET["mainmenu"]="home";
|
||||
@ -49,54 +51,33 @@ print "<br>\n";
|
||||
|
||||
|
||||
/*
|
||||
* Boites
|
||||
* Affichage des boites
|
||||
*
|
||||
*/
|
||||
$user->getrights('');
|
||||
|
||||
$sql = "SELECT b.rowid, b.box_id, d.file";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."boxes as b, ".MAIN_DB_PREFIX."boxes_def as d";
|
||||
$sql .= " WHERE b.box_id = d.rowid";
|
||||
$sql .= " AND position = 0"; // 0 = valeur pour la page accueil
|
||||
$sql .= " ORDER BY box_order";
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$j = 0;
|
||||
|
||||
while ($j < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$boxes[$j] = "includes/boxes/".$obj->file;
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
include_once("./boxes.php");
|
||||
$infobox=new InfoBox($db);
|
||||
$boxes=$infobox->listboxes("0"); // 0 = valeur pour la page accueil
|
||||
|
||||
$NBCOLS=2; // Nombre de colonnes pour les boites
|
||||
print '<table width="100%">';
|
||||
|
||||
for ($ii=0, $ni=sizeof($boxes); $ii<$ni; $ii++)
|
||||
{
|
||||
if ($ii % 2 == 0)
|
||||
{
|
||||
print "<tr>\n";
|
||||
}
|
||||
|
||||
if ($ii % $NBCOLS == 0) print "<tr>\n";
|
||||
print '<td valign="top" width="50%">';
|
||||
include($boxes[$ii]);
|
||||
|
||||
// Affichage boite ii
|
||||
include_once("./includes/boxes/".$boxes[$ii].".php");
|
||||
$box=new $boxes[$ii]();
|
||||
$box->loadBox();
|
||||
$box->showBox();
|
||||
|
||||
print "</td>";
|
||||
|
||||
if ( ($ii -1) / 3 == 0)
|
||||
{
|
||||
print "</tr>\n";
|
||||
}
|
||||
if ($ii % $NBCOLS == ($NBCOLS-1)) print "</tr>\n";
|
||||
}
|
||||
|
||||
if ($ii % $NBCOLS == ($NBCOLS-1)) print "</tr>\n";
|
||||
print "</table>";
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
|
||||
@ -103,7 +103,6 @@ require_once(DOL_DOCUMENT_ROOT ."/user.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT ."/lib/functions.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT ."/html.form.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT ."/menu.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT ."/boxes.php");
|
||||
require_once(DOL_DOCUMENT_ROOT ."/notify.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT ."/address.class.php");
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user