Standardize code

This commit is contained in:
Laurent Destailleur 2017-11-11 17:21:11 +01:00
parent 75e5d80eb6
commit b60870097b
2 changed files with 22 additions and 11 deletions

View File

@ -388,23 +388,24 @@ class AdherentType extends CommonObject
*
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $maxlen length max label
* @param int $notooltip 1=Disable tooltip
* @return string String with URL
*/
function getNomUrl($withpicto=0,$maxlen=0)
function getNomUrl($withpicto=0, $maxlen=0)
{
global $langs;
$result='';
$label=$langs->trans("ShowTypeCard",$this->label);
$link = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkstart = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend='</a>';
$picto='group';
$result .= $linkstart;
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
if ($withpicto != 2) $result.= ($maxlen?dol_trunc($this->label,$maxlen):$this->label);
$result .= $linkend;
if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2) $result.=' ';
$result.=$link.($maxlen?dol_trunc($this->label,$maxlen):$this->label).$linkend;
return $result;
}

View File

@ -204,10 +204,10 @@ if ($action == 'confirm_delete' && $user->rights->adherent->configurer)
* View
*/
llxHeader('',$langs->trans("MembersTypeSetup"),'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
$form=new Form($db);
llxHeader('',$langs->trans("MembersTypeSetup"),'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
// List of members type
if (! $rowid && $action != 'create' && $action != 'edit')
@ -252,11 +252,21 @@ if (! $rowid && $action != 'create' && $action != 'edit')
print '<th>&nbsp;</th>';
print "</tr>\n";
$membertype = new AdherentType($db);
while ($i < $num)
{
$objp = $db->fetch_object($result);
$membertype->id = $objp->rowid;
$membertype->ref = $objp->rowid;
$membertype->label = $objp->rowid;
print '<tr class="oddeven">';
print '<td><a href="'.$_SERVER["PHP_SELF"].'?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.'</a></td>';
print '<td>';
print $membertype->getNomUrl(1);
//<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.'</a>
print '</td>';
print '<td>'.dol_escape_htmltag($objp->label).'</td>';
print '<td align="center">'.yn($objp->subscription).'</td>';
print '<td align="center">'.yn($objp->vote).'</td>';
@ -440,11 +450,11 @@ if ($rowid > 0)
}
if ($status != '')
{
$sql.= " AND d.statut IN (".$db->escape($status).")"; // Peut valoir un nombre ou liste de nombre separes par virgules
$sql.= natural_search('d.statut', $status, 2);
}
if ($action == 'search')
{
if (GETPOST('search'))
if (GETPOST('search','alpha'))
{
$sql.= natural_search(array("d.firstname","d.lastname"), GETPOST('search','alpha'));
}