Skip to content
Snippets Groups Projects
Commit 9792d5a2 authored by Regis Houssin's avatar Regis Houssin
Browse files

Fix: use company name if firstname and lastname not exists

parent 1d344ec8
No related branches found
No related tags found
No related merge requests found
......@@ -203,7 +203,7 @@ $var=true;
*/
$max=5;
$sql = "SELECT a.rowid, a.statut, a.nom as lastname, a.prenom as firstname,";
$sql = "SELECT a.rowid, a.statut, a.nom as lastname, a.prenom as firstname, a.societe as company, a.fk_soc,";
$sql.= " a.tms as datem, datefin as date_end_subscription,";
$sql.= " ta.rowid as typeid, ta.libelle, ta.cotisation";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta";
......@@ -235,6 +235,7 @@ if ($resql)
if (! empty($obj->fk_soc)) {
$staticmember->socid = $obj->fk_soc;
$staticmember->fetch_thirdparty();
$staticmember->name=$staticmember->thirdparty->name;
} else {
$staticmember->name=$obj->company;
}
......@@ -262,7 +263,7 @@ else
*/
$max=5;
$sql = "SELECT a.rowid, a.statut, a.nom as lastname, a.prenom as firstname,";
$sql = "SELECT a.rowid, a.statut, a.nom as lastname, a.prenom as firstname, a.societe as company, a.fk_soc,";
$sql.= " datefin as date_end_subscription,";
$sql.= " c.rowid as cid, c.tms as datem, c.datec as datec, c.dateadh as date_start, c.datef as date_end, c.cotisation";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."cotisation as c";
......@@ -293,9 +294,16 @@ if ($resql)
$staticmember->id=$obj->rowid;
$staticmember->lastname=$obj->lastname;
$staticmember->firstname=$obj->firstname;
if (! empty($obj->fk_soc)) {
$staticmember->socid = $obj->fk_soc;
$staticmember->fetch_thirdparty();
$staticmember->name=$staticmember->thirdparty->name;
} else {
$staticmember->name=$obj->company;
}
$staticmember->ref=$staticmember->getFullName($langs);
print '<td>'.$subscriptionstatic->getNomUrl(1).'</td>';
print '<td>'.$staticmember->getNomUrl(1,24,'subscription').'</td>';
print '<td>'.$staticmember->getNomUrl(1,32,'subscription').'</td>';
print '<td>'.get_date_range($db->jdate($obj->date_start),$db->jdate($obj->date_end)).'</td>';
print '<td align="right">'.price($obj->cotisation).'</td>';
//print '<td align="right">'.$staticmember->LibStatut($obj->statut,($obj->cotisation=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).'</td>';
......@@ -326,7 +334,7 @@ foreach ($AdherentType as $key => $adhtype)
{
$var=!$var;
print "<tr $bc[$var]>";
print '<td><a href="type.php?rowid='.$adhtype->id.'">'.img_object($langs->trans("ShowType"),"group").' '.$adhtype->getNomUrl(0,dol_size(32)).'</a></td>';
print '<td>'.$adhtype->getNomUrl(1, dol_size(32)).'</td>';
print '<td align="right">'.(isset($MemberToValidate[$key]) && $MemberToValidate[$key] > 0?$MemberToValidate[$key]:'').' '.$staticmember->LibStatut(-1,$adhtype->cotisation,0,3).'</td>';
print '<td align="right">'.(isset($MembersValidated[$key]) && ($MembersValidated[$key]-$MemberUpToDate[$key] > 0) ? $MembersValidated[$key]-$MemberUpToDate[$key]:'').' '.$staticmember->LibStatut(1,$adhtype->cotisation,0,3).'</td>';
print '<td align="right">'.(isset($MemberUpToDate[$key]) && $MemberUpToDate[$key] > 0 ? $MemberUpToDate[$key]:'').' '.$staticmember->LibStatut(1,$adhtype->cotisation,$now,3).'</td>';
......
......@@ -84,7 +84,7 @@ llxHeader('',$langs->trans("Member"),'EN:Module_Foundations|FR:Module_Adh&eacute
$now=dol_now();
$sql = "SELECT d.rowid, d.login, d.nom as lastname, d.prenom as firstname, d.societe, ";
$sql = "SELECT d.rowid, d.login, d.nom as lastname, d.prenom as firstname, d.societe as company, d.fk_soc,";
$sql.= " d.datefin,";
$sql.= " d.email, d.fk_adherent_type as type_id, d.morphy, d.statut,";
$sql.= " t.libelle as type, t.cotisation";
......@@ -238,7 +238,7 @@ if ($resql)
print '<td class="liste_titre">';
$listetype=$membertypestatic->liste_array();
print $form->selectarray("type", $listetype, $type, 1, 0, 0, '', 0, 12);
print $form->selectarray("type", $listetype, $type, 1, 0, 0, '', 0, 32);
print '</td>';
print '<td class="liste_titre">&nbsp;</td>';
......@@ -268,6 +268,14 @@ if ($resql)
$memberstatic->lastname=$objp->lastname;
$memberstatic->firstname=$objp->firstname;
if (! empty($objp->fk_soc)) {
$memberstatic->socid = $objp->fk_soc;
$memberstatic->fetch_thirdparty();
$companyname=$memberstatic->thirdparty->name;
} else {
$companyname=$objp->company;
}
$var=!$var;
print "<tr ".$bc[$var].">";
......@@ -277,14 +285,11 @@ if ($resql)
print "</td>\n";
// Lastname
if ($objp->societe != '')
{
print "<td><a href=\"fiche.php?rowid=$objp->rowid\">".dol_trunc($memberstatic->getFullName($langs))." / ".dol_trunc($objp->societe,12)."</a></td>\n";
}
else
{
print "<td><a href=\"fiche.php?rowid=$objp->rowid\">".dol_trunc($memberstatic->getFullName($langs))."</a></td>\n";
}
print "<td><a href=\"fiche.php?rowid=$objp->rowid\">";
print ((! empty($objp->lastname) || ! empty($objp->firstname)) ? dol_trunc($memberstatic->getFullName($langs)) : '');
print (((! empty($objp->lastname) || ! empty($objp->firstname)) && ! empty($companyname)) ? ' / ' : '');
print (! empty($companyname) ? dol_trunc($companyname, 32) : '');
print "</a></td>\n";
// Login
print "<td>".$objp->login."</td>\n";
......@@ -293,7 +298,7 @@ if ($resql)
$membertypestatic->id=$objp->type_id;
$membertypestatic->libelle=$objp->type;
print '<td nowrap="nowrap">';
print $membertypestatic->getNomUrl(1,12);
print $membertypestatic->getNomUrl(1,32);
print '</td>';
// Moral/Physique
......
......@@ -73,7 +73,8 @@ class box_members extends ModeleBoxes
if ($user->rights->societe->lire)
{
$sql = "SELECT a.rowid, a.nom as lastname, a.prenom as firstname, a.datec, a.tms, a.statut as status, a.datefin as date_end_subscription,";
$sql = "SELECT a.rowid, a.nom as lastname, a.prenom as firstname, a.societe, a.fk_soc,";
$sql.= " a.datec, a.tms, a.statut as status, a.datefin as date_end_subscription,";
$sql.= " t.cotisation";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as t";
$sql.= " WHERE a.entity = ".$conf->entity;
......@@ -97,6 +98,14 @@ class box_members extends ModeleBoxes
$memberstatic->lastname=$objp->lastname;
$memberstatic->firstname=$objp->firstname;
if (! empty($objp->fk_soc)) {
$memberstatic->socid = $objp->fk_soc;
$memberstatic->fetch_thirdparty();
$memberstatic->name=$memberstatic->thirdparty->name;
} else {
$memberstatic->name=$objp->company;
}
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg,
'url' => DOL_URL_ROOT."/adherents/fiche.php?rowid=".$objp->rowid);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment