[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 * 19 * $Id: box_services_vendus.php,v 1.18 2005/07/15 00:02:43 eldy Exp $ 20 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/includes/boxes/box_services_vendus.php,v $ 21 * 22 */ 23 24 /** 25 \file htdocs/includes/boxes/box_services_vendus.php 26 \ingroup produits,services 27 \brief Module de génération de l'affichage de la box services_vendus 28 */ 29 30 include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php"); 31 32 33 class box_services_vendus extends ModeleBoxes { 34 35 var $boxcode="lastproductsincontract"; 36 var $boximg="object_product"; 37 var $boxlabel; 38 var $depends = array("produit"); 39 40 var $info_box_head = array(); 41 var $info_box_contents = array(); 42 43 /** 44 * \brief Constructeur de la classe 45 */ 46 function box_services_vendus() 47 { 48 global $langs; 49 $langs->load("boxes"); 50 51 $this->boxlabel=$langs->trans("BoxLastProductsInContract"); 52 } 53 54 /** 55 * \brief Charge les données en mémoire pour affichage ultérieur 56 * \param $max Nombre maximum d'enregistrements à charger 57 */ 58 function loadBox($max=5) 59 { 60 global $user, $langs, $db; 61 $langs->load("boxes"); 62 63 $this->info_box_head = array('text' => $langs->trans("BoxLastProductsInContract",$max)); 64 65 if ($user->rights->produit->lire) 66 { 67 $sql = "SELECT s.nom, s.idp, c.rowid, cd.rowid as cdid, p.label, p.fk_product_type"; 68 $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."product as p"; 69 $sql .= " WHERE s.idp = c.fk_soc AND c.rowid = cd.fk_contrat AND cd.fk_product = p.rowid"; 70 if($user->societe_id) 71 { 72 $sql .= " AND s.idp = $user->societe_id"; 73 } 74 $sql .= " ORDER BY c.tms DESC "; 75 $sql .= $db->plimit($max, 0); 76 77 $result = $db->query($sql); 78 79 if ($result) 80 { 81 $num = $db->num_rows($result); 82 83 $i = 0; 84 85 while ($i < $num) 86 { 87 $objp = $db->fetch_object($result); 88 89 $this->info_box_contents[$i][0] = array('align' => 'left', 90 'logo' => ($objp->fk_product_type?'object_service':'object_product'), 91 'text' => $objp->label, 92 'maxlength' => 16, 93 'url' => DOL_URL_ROOT."/contrat/fiche.php?id=".$objp->rowid); 94 95 $this->info_box_contents[$i][1] = array('align' => 'left', 96 'text' => $objp->nom, 97 'maxlength' => 40, 98 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->idp); 99 100 $i++; 101 } 102 } 103 else { 104 dolibarr_print_error($db); 105 } 106 } 107 else { 108 $this->info_box_contents[0][0] = array('align' => 'left', 109 'text' => $langs->trans("ReadPermissionNotAllowed")); 110 } 111 112 } 113 114 function showBox() 115 { 116 parent::showBox($this->info_box_head, $this->info_box_contents); 117 } 118 119 } 120 121 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 12:29:37 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |