Fix look and feel v7 on ref popup

This commit is contained in:
Laurent Destailleur 2018-02-06 19:16:15 +01:00
parent 9962d36dbc
commit 5e7d172a58
3 changed files with 111 additions and 23 deletions

View File

@ -40,6 +40,8 @@ class UserGroup extends CommonObject
public $picto='group';
public $entity; // Entity of group
public $name; // Name of group
/**
* @deprecated
* @see name
@ -48,6 +50,7 @@ class UserGroup extends CommonObject
public $globalgroup; // Global group
public $datec; // Creation date of group
public $datem; // Modification date of group
public $note; // Description
public $members=array(); // Array of users
public $nb_rights; // Number of rights granted to the user
@ -786,6 +789,79 @@ class UserGroup extends CommonObject
return '';
}
/**
* Return a link to the user card (with optionaly the picto)
* Use this->id,this->lastname, this->firstname
*
* @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto, -1=Include photo into link, -2=Only picto photo, -3=Only photo very small)
* @param string $option On what the link point to ('nolink', )
* @param integer $notooltip 1=Disable tooltip on picto and name
* @param string $mode ''=Show firstname and lastname, 'firstname'=Show only firstname, 'login'=Show login
* @param string $morecss Add more css on link
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/
function getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1)
{
global $langs, $conf, $db, $hookmanager;
global $dolibarr_main_authentication, $dolibarr_main_demo;
global $menumanager;
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpicto) $withpicto=0;
$result=''; $label='';
$link=''; $linkstart=''; $linkend='';
$label.= '<div class="centpercent">';
$label.= '<u>' . $langs->trans("Group") . '</u><br>';
$label.= '<b>' . $langs->trans('Name') . ':</b> ' . $this->name;
$label.= '<br><b>' . $langs->trans("Description").':</b> '.$this->note;
$label.='</div>';
$url = DOL_URL_ROOT.'/user/group/card.php?id='.$this->id;
if ($option != 'nolink')
{
// Add param to save lastsearch_values or not
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
}
$linkclose="";
if (empty($notooltip))
{
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
$langs->load("users");
$label=$langs->trans("ShowGroup");
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose.= ' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
}
if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('groupdao'));
$parameters=array('id'=>$this->id);
$reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) $linkclose = $hookmanager->resPrint;
$linkstart = '<a href="'.$url.'"';
$linkstart.=$linkclose.'>';
$linkend='</a>';
$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.= $this->name;
$result .= $linkend;
return $result;
}
/**
* Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
*

View File

@ -25,6 +25,7 @@
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS))
{
@ -98,7 +99,7 @@ if (empty($reshook))
llxHeader();
$sql = "SELECT g.rowid, g.nom as name, g.entity, g.datec, COUNT(DISTINCT ugu.fk_user) as nb";
$sql = "SELECT g.rowid, g.nom as name, g.note, g.entity, g.datec, COUNT(DISTINCT ugu.fk_user) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."usergroup as g";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_usergroup = g.rowid";
if (! empty($conf->multicompany->enabled) && $conf->entity == 1 && ($conf->global->MULTICOMPANY_TRANSVERSE_MODE || ($user->admin && ! $user->entity)))
@ -114,7 +115,7 @@ if (! empty($search_group))
$sql .= " AND (g.nom LIKE '%".$db->escape($search_group)."%' OR g.note LIKE '%".$db->escape($search_group)."%')";
}
if ($sall) $sql.= " AND (g.nom LIKE '%".$db->escape($sall)."%' OR g.note LIKE '%".$db->escape($sall)."%')";
$sql.= " GROUP BY g.rowid, g.nom, g.entity, g.datec";
$sql.= " GROUP BY g.rowid, g.nom, g.note, g.entity, g.datec";
$sql.= $db->order($sortfield,$sortorder);
$resql = $db->query($sql);
@ -174,14 +175,19 @@ if ($resql)
print_liste_field_titre("DateCreationShort",$_SERVER["PHP_SELF"],"g.datec",$param,"",'align="right"',$sortfield,$sortorder);
print "</tr>\n";
$var=True;
$grouptemp = new UserGroup($db);
while ($i < $num)
{
$obj = $db->fetch_object($resql);
$grouptemp->id = $obj->id;
$grouptemp->name = $obj->name;
$grouptemp->note = $obj->note;
print '<tr class="oddeven">';
print '<td><a href="card.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowGroup"),"group").' '.$obj->name.'</a>';
print '<td>';
print $grouptemp->getNomUrl(1);
if (! $obj->entity)
{
print img_picto($langs->trans("GlobalGroup"),'redstar');

View File

@ -22,6 +22,7 @@
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
if (! $user->rights->user->user->lire && ! $user->admin)
{
@ -118,26 +119,30 @@ if ($resql)
$num = $db->num_rows($resql);
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="5">'.$langs->trans("LastUsersCreated",min($num,$max)).'</td></tr>';
$var = true;
$i = 0;
while ($i < $num && $i < $max)
{
$obj = $db->fetch_object($resql);
$fuserstatic->id = $obj->rowid;
$fuserstatic->statut = $obj->statut;
$fuserstatic->lastname = $obj->lastname;
$fuserstatic->firstname = $obj->firstname;
$fuserstatic->login = $obj->login;
$fuserstatic->photo = $obj->photo;
$fuserstatic->admin = $obj->admin;
$fuserstatic->email = $obj->email;
$fuserstatic->skype = $obj->skype;
$fuserstatic->societe_id = $obj->fk_soc;
$companystatic->id=$obj->fk_soc;
$companystatic->name=$obj->name;
$companystatic->code_client = $obj->code_client;
$companystatic->canvas=$obj->canvas;
print '<tr class="oddeven">';
print '<td>';
$fuserstatic->id = $obj->rowid;
$fuserstatic->statut = $obj->statut;
$fuserstatic->lastname = $obj->lastname;
$fuserstatic->firstname = $obj->firstname;
$fuserstatic->login = $obj->login;
$fuserstatic->photo = $obj->photo;
$fuserstatic->admin = $obj->admin;
$fuserstatic->email = $obj->email;
$fuserstatic->skype = $obj->skype;
$fuserstatic->societe_id = $obj->fk_soc;
print $fuserstatic->getNomUrl(-1);
if (! empty($conf->multicompany->enabled) && $obj->admin && ! $obj->entity)
{
@ -152,10 +157,6 @@ if ($resql)
print "<td>";
if ($obj->fk_soc)
{
$companystatic->id=$obj->fk_soc;
$companystatic->name=$obj->name;
$companystatic->code_client = $obj->code_client;
$companystatic->canvas=$obj->canvas;
print $companystatic->getNomUrl(1);
}
else
@ -231,16 +232,21 @@ if ($canreadperms)
$num = $db->num_rows($resql);
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="'.$colspan.'">'.$langs->trans("LastGroupsCreated",($num ? $num : $max)).'</td></tr>';
$var = true;
$i = 0;
$grouptemp = new UserGroup($db);
while ($i < $num && (! $max || $i < $max))
{
$obj = $db->fetch_object($resql);
$grouptemp->id = $obj->id;
$grouptemp->name = $obj->name;
$grouptemp->note = $obj->note;
print '<tr class="oddeven">';
print '<td><a href="'.DOL_URL_ROOT.'/user/group/card.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowGroup"),"group").' '.$obj->name.'</a>';
print '<td>';
print $grouptemp->getNomUrl(1);
if (! $obj->entity)
{
print img_picto($langs->trans("GlobalGroup"),'redstar');