Change to allow module to use img_picto with their own images
This commit is contained in:
parent
43bcc207de
commit
7335e61176
@ -990,10 +990,10 @@ class Contrat extends CommonObject
|
||||
/**
|
||||
\brief Renvoie nom clicable (avec eventuellement le picto)
|
||||
\param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
|
||||
\param option Sur quoi pointe le lien
|
||||
\param maxlength Max length of ref
|
||||
\return string Chaine avec URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0,$option='')
|
||||
function getNomUrl($withpicto=0,$maxlength=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
@ -1002,15 +1002,13 @@ class Contrat extends CommonObject
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/contrat/fiche.php?id='.$this->id.'">';
|
||||
$lienfin='</a>';
|
||||
|
||||
$picto='bill';
|
||||
if ($this->type == 1) $picto.='r';
|
||||
if ($this->type == 2) $picto.='a';
|
||||
$picto='contract';
|
||||
|
||||
$label=$langs->trans("ShowContract").': '.$this->ref;
|
||||
|
||||
if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin);
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin;
|
||||
if ($withpicto != 2) $result.=$lien.($maxlength?dolibarr_trunc($this->ref,$maxlength):$this->ref).$lienfin;
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -1285,6 +1283,30 @@ class ContratLigne
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Renvoie nom clicable (avec eventuellement le picto)
|
||||
\param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
|
||||
\return string Chaine avec URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0,$maxlength=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$result='';
|
||||
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/contrat/fiche.php?id='.$this->fk_contrat.'">';
|
||||
$lienfin='</a>';
|
||||
|
||||
$picto='contract';
|
||||
|
||||
$label=$langs->trans("ShowContractOfService").': '.$this->label;
|
||||
|
||||
if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin);
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
if ($withpicto != 2) $result.=$lien.$this->label.$lienfin;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/*
|
||||
* \brief Load object in memory from database
|
||||
* \param id id object
|
||||
|
||||
@ -41,6 +41,7 @@ $contratid = isset($_GET["id"])?$_GET["id"]:'';
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'contrat',$contratid,'');
|
||||
|
||||
$staticcompany=new Societe($db);
|
||||
$staticcontrat=new Contrat($db);
|
||||
$staticcontratligne=new ContratLigne($db);
|
||||
|
||||
@ -158,7 +159,7 @@ if ($conf->contrat->enabled && $user->rights->contrat->lire)
|
||||
print '</td><td width="70%" valign="top" class="notopnoleftnoright">';
|
||||
|
||||
|
||||
// Last contracts
|
||||
// Last modified contracts
|
||||
$max=5;
|
||||
$sql = 'SELECT ';
|
||||
$sql.= ' sum('.$db->ifsql("cd.statut=0",1,0).') as nb_initial,';
|
||||
@ -199,12 +200,17 @@ if ($result)
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print "<td><a href=\"fiche.php?id=$obj->cid\">";
|
||||
print img_object($langs->trans("ShowContract"),"contract").' '
|
||||
. (isset($obj->ref) ? $obj->ref : $obj->cid).'</a>';
|
||||
print "<td>";
|
||||
$staticcontrat->ref=($obj->ref?$obj->ref:$obj->cid);
|
||||
$staticcontrat->id=$obj->cid;
|
||||
print $staticcontrat->getNomUrl(1,16);
|
||||
if ($obj->nb_late) print img_warning($langs->trans("Late"));
|
||||
print '</td>';
|
||||
print '<td><a href="../comm/fiche.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.'</a></td>';
|
||||
print '<td>';
|
||||
$staticcompany->id=$obj->fk_soc;
|
||||
$staticcompany->nom=$obj->nom;
|
||||
print $staticcompany->getNomUrl(1,'',20);
|
||||
print '</td>';
|
||||
print '<td align="center">'.dolibarr_print_date($obj->datec).'</td>';
|
||||
//print '<td align="left">'.$staticcontrat->LibStatut($obj->statut,2).'</td>';
|
||||
print '<td align="center">'.($obj->nb_initial>0 ? $obj->nb_initial.$staticcontratligne->LibStatut(0,3):'').'</td>';
|
||||
@ -254,12 +260,20 @@ if ( $db->query($sql) )
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/contrat/fiche.php?id='.$obj->fk_contrat.'">'.img_object($langs->trans("ShowContract"),"contract").' '
|
||||
.(isset($obj->ref) ? $obj->ref : $obj->fk_contrat).'</a></td>';
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/contrat/fiche.php?id='.$obj->fk_contrat.'">'.img_object($langs->trans("ShowService"),"service");
|
||||
print '<td>';
|
||||
$staticcontrat->ref=($obj->ref?$obj->ref:$obj->fk_contrat);
|
||||
$staticcontrat->id=$obj->fk_contrat;
|
||||
print $staticcontrat->getNomUrl(1,16);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/contrat/fiche.php?id='.$obj->fk_contrat.'">'.img_object($langs->trans("ShowService"),"service");
|
||||
if ($obj->label) print ' '.dolibarr_trunc($obj->label,20).'</a></td>';
|
||||
else print '</a> '.dolibarr_trunc($obj->note,20).'</td>';
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/soc.php?socid='.$obj->fk_soc.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($obj->nom,44).'</a></td>';
|
||||
print '<td>';
|
||||
$staticcompany->id=$obj->fk_soc;
|
||||
$staticcompany->nom=$obj->nom;
|
||||
print $staticcompany->getNomUrl(1,'',20);
|
||||
print '</td>';
|
||||
print '<td width="16"><a href="ligne.php?id='.$obj->fk_contrat.'&ligne='.$obj->cid.'">';
|
||||
print $staticcontratligne->LibStatut($obj->statut,3);
|
||||
print '</a></td>';
|
||||
@ -281,7 +295,9 @@ print '<br>';
|
||||
// Last modified services
|
||||
$max=5;
|
||||
|
||||
$sql = "SELECT cd.rowid as cid, c.ref, cd.statut, cd.label, cd.description as note, cd.fk_contrat, c.fk_soc, s.nom";
|
||||
$sql = "SELECT c.ref, c.fk_soc, ";
|
||||
$sql.= " cd.rowid as cid, cd.statut, cd.label, cd.description as note, cd.fk_contrat,";
|
||||
$sql.= " s.nom";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -290,9 +306,10 @@ if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc
|
||||
if ($socid > 0) $sql.= " AND s.rowid = ".$socid;
|
||||
$sql.= " ORDER BY cd.tms DESC";
|
||||
|
||||
if ( $db->query($sql) )
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
@ -303,18 +320,23 @@ if ( $db->query($sql) )
|
||||
$var=True;
|
||||
while ($i < min($num,$max))
|
||||
{
|
||||
$obj = $db->fetch_object();
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
// width="50" nowrap
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/contrat/fiche.php?id='.$obj->fk_contrat.'">'.img_object($langs->trans("ShowContract"),"contract").' '
|
||||
.(isset($obj->ref) ? $obj->ref : $obj->fk_contrat).'</a>';
|
||||
print '<td nowrap="nowrap">';
|
||||
$staticcontrat->ref=($obj->ref?$obj->ref:$obj->fk_contrat);
|
||||
$staticcontrat->id=$obj->fk_contrat;
|
||||
print $staticcontrat->getNomUrl(1,16);
|
||||
if ($obj->nb_late) print img_warning($langs->trans("Late"));
|
||||
print '</td>';
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/contrat/fiche.php?id='.$obj->fk_contrat.'">'.img_object($langs->trans("ShowService"),"service");
|
||||
if ($obj->label) print ' '.dolibarr_trunc($obj->label,20).'</a></td>';
|
||||
else print '</a> '.dolibarr_trunc($obj->note,20).'</td>';
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/soc.php?socid='.$obj->fk_soc.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($obj->nom,28).'</a></td>';
|
||||
print '<td>';
|
||||
$staticcompany->id=$obj->fk_soc;
|
||||
$staticcompany->nom=$obj->nom;
|
||||
print $staticcompany->getNomUrl(1,'',20);
|
||||
print '</td>';
|
||||
print '<td nowrap="nowrap" align="right"><a href="'.DOL_URL_ROOT.'/contrat/fiche.php?id='.$obj->fk_contrat.'&ligne='.$obj->cid.'">';
|
||||
print $staticcontratligne->LibStatut($obj->statut,5);
|
||||
print '</a></td>';
|
||||
|
||||
@ -773,15 +773,17 @@ function img_object($alt, $object)
|
||||
|
||||
/**
|
||||
\brief Affiche picto (fonction générique)
|
||||
\param alt Texte sur le alt de l'image
|
||||
\param picto Nom de l'image a afficher (Si pas d'extension, on met '.png')
|
||||
\param options Attribut supplémentaire a la balise img
|
||||
\return string Retourne tag img
|
||||
\param alt Texte sur le alt de l'image
|
||||
\param picto Nom de l'image a afficher (Si pas d'extension, on met '.png')
|
||||
\param options Attribut supplémentaire a la balise img
|
||||
\param pictoisfullpath If 1, image path is a full path
|
||||
\return string Retourne tag img
|
||||
*/
|
||||
function img_picto($alt, $picto, $options='')
|
||||
function img_picto($alt, $picto, $options='', $pictoisfullpath=0)
|
||||
{
|
||||
global $conf;
|
||||
if (! eregi('(\.png|\.gif)$',$picto)) $picto.='.png';
|
||||
if ($pictoisfullpath) return '<img src="'.$picto.'" border="0" alt="'.$alt.'" title="'.$alt.'"'.($options?' '.$options:'').'>';
|
||||
return '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/'.$picto.'" border="0" alt="'.$alt.'" title="'.$alt.'"'.($options?' '.$options:'').'>';
|
||||
}
|
||||
|
||||
@ -1601,15 +1603,16 @@ function print_titre($titre)
|
||||
|
||||
/**
|
||||
\brief Affichage d'un titre d'une fiche, aligné a gauche
|
||||
\param titre Le titre a afficher
|
||||
\param mesg Message suplémentaire a afficher a droite
|
||||
\param picto Picto pour ligne de titre
|
||||
\param titre Le titre a afficher
|
||||
\param mesg Message suplémentaire a afficher a droite
|
||||
\param picto Picto pour ligne de titre
|
||||
\param pictoisfullpath 1=Picto is a full absolute url of image
|
||||
*/
|
||||
function print_fiche_titre($titre, $mesg='', $picto='')
|
||||
function print_fiche_titre($titre, $mesg='', $picto='', $pictoisfullpath=0)
|
||||
{
|
||||
print "\n";
|
||||
print '<table width="100%" border="0" class="notopnoleftnoright"><tr>';
|
||||
if ($picto) print '<td width="24" align="left" valign="middle">'.img_picto('',$picto).'</td>';
|
||||
if ($picto) print '<td width="24" align="left" valign="middle">'.img_picto('',$picto, '', $pictoisfullpath).'</td>';
|
||||
print '<td class="notopnoleftnoright" valign="middle">';
|
||||
print '<div class="titre">'.$titre.'</div>';
|
||||
print '</td>';
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -274,16 +274,21 @@ if ($resql)
|
||||
|
||||
// Ref
|
||||
print '<td nowrap="nowrap">';
|
||||
print "<a href=\"fiche.php?id=$objp->rowid\">";
|
||||
$product_static->id = $objp->rowid;
|
||||
$product_static->ref = $objp->ref;
|
||||
$product_static->type = $objp->fk_product_type;
|
||||
print $product_static->getNomUrl(1,'',16);
|
||||
/* print "<a href=\"fiche.php?id=$objp->rowid\">";
|
||||
if ($objp->fk_product_type==1)
|
||||
print img_object($langs->trans("ShowService"),"service");
|
||||
else
|
||||
print img_object($langs->trans("ShowProduct"),"product");
|
||||
print '</a> ';
|
||||
print '<a href="fiche.php?id='.$objp->rowid.'">'.$objp->ref."</a></td>\n";
|
||||
print '<a href="fiche.php?id='.$objp->rowid.'">'.$objp->ref."</a>";
|
||||
*/ print "</td>\n";
|
||||
|
||||
// Label
|
||||
print '<td>'.$objp->label.'</td>';
|
||||
print '<td>'.dolibarr_trunc($objp->label,40).'</td>';
|
||||
|
||||
// Date
|
||||
print '<td align="center">'.dolibarr_print_date($objp->datem,'day')."</td>\n";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user