From 34cbcad9da821f7c37978e1291bfb4dc6f6b8ac8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sun, 1 Feb 2015 00:40:42 +0100 Subject: [PATCH] Reduce number of new to save memory usage. Fight table to replace with div --- htdocs/core/class/html.form.class.php | 2 +- htdocs/societe/class/societe.class.php | 27 ++++++++++++++------------ htdocs/societe/index.php | 6 +++--- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 38a2eee7555..21650cd62f6 100755 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -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; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 11ae1363ed6..fbba2bce18b 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -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> </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); diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index e10d1c88680..d675c0d0a5b 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -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 -- GitLab