Reduce number of new to save memory usage.

Fight table to replace with div
This commit is contained in:
Laurent Destailleur 2015-02-01 00:40:42 +01:00
parent 7501e09738
commit 34cbcad9da
3 changed files with 19 additions and 16 deletions

View File

@ -4506,7 +4506,7 @@ class Form
* @param int $width Width of photo
* @return string HTML code to output photo
*/
function showphoto($modulepart,$object,$width=100)
static function showphoto($modulepart,$object,$width=100)
{
global $conf;

View File

@ -1700,9 +1700,10 @@ class Societe extends CommonObject
* @param int $withpicto Add picto into link (0=No picto, 1=Include picto with link, 2=Picto only)
* @param string $option Target of link ('', 'customer', 'prospect', 'supplier')
* @param int $maxlen Max length of text
* @param string $notooltip 1=Disable tooltip
* @return string String with URL
*/
function getNomUrl($withpicto=0,$option='',$maxlen=0)
function getNomUrl($withpicto=0,$option='',$maxlen=0,$notooltip=0)
{
global $conf,$langs;
@ -1718,11 +1719,10 @@ class Societe extends CommonObject
$name =$code.' '.$name;
}
$result='';
$lien=$lienfin='';
$label = '<table width="100%">';
$label.= '<tr>';
$label.= '<td valign="top">';
$result=''; $label='';
$lien=''; $lienfin='';
$label.= '<div width="100%">';
if ($option == 'customer' || $option == 'compta')
{
@ -1764,15 +1764,18 @@ class Societe extends CommonObject
if (! empty($this->code_fournisseur))
$label.= '<br><b>' . $langs->trans('SupplierCode') . ':</b> '. $this->code_fournisseur;
$label.= '</td>';
if (! empty($this->logo)) {
$form = new Form($db);
$label .= '<td>&nbsp;&nbsp;</td><td align="right">' . $form->showphoto('societe', $this, 80) . '</td>';
if (! empty($this->logo))
{
$label.= '<br><br>';
//if (! is_object($form)) $form = new Form($db);
$label.= Form::showphoto('societe', $this, 80);
}
$label.= '</tr></table>';
$label.= '</div>';
// Add type of canvas
$lien.=(!empty($this->canvas)?'&canvas='.$this->canvas:'').'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$lien.=(!empty($this->canvas)?'&canvas='.$this->canvas:'').'"';
$lien.=($notooltip?'':' title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip"');
$lien.='>';
$lienfin='</a>';
if ($withpicto) $result.=($lien.img_object($label, 'company', 'class="classfortooltip"').$lienfin);

View File

@ -302,19 +302,19 @@ if ($result)
if ($thirdparty_static->client==1 || $thirdparty_static->client==3)
{
$thirdparty_static->name=$langs->trans("Customer");
print $thirdparty_static->getNomUrl(0,'customer');
print $thirdparty_static->getNomUrl(0,'customer',0,1);
}
if ($thirdparty_static->client == 3 && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) print " / ";
if (($thirdparty_static->client==2 || $thirdparty_static->client==3) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS))
{
$thirdparty_static->name=$langs->trans("Prospect");
print $thirdparty_static->getNomUrl(0,'prospect');
print $thirdparty_static->getNomUrl(0,'prospect',0,1);
}
if (! empty($conf->fournisseur->enabled) && $thirdparty_static->fournisseur)
{
if ($thirdparty_static->client) print " / ";
$thirdparty_static->name=$langs->trans("Supplier");
print $thirdparty_static->getNomUrl(0,'supplier');
print $thirdparty_static->getNomUrl(0,'supplier',0,1);
}
print '</td>';
// Last modified date