From 7297514afbdbe184e4d66ec9bf80c2d06cda4dc8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Oct 2019 21:00:29 +0200 Subject: [PATCH] NEW Use the gender of member for picto in member lists. --- htdocs/adherents/class/adherent.class.php | 6 +++++- htdocs/adherents/list.php | 1 + htdocs/core/class/html.form.class.php | 13 +++++++++---- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index d21dbb2673d..e30b82aee5f 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2132,7 +2132,11 @@ class Adherent extends CommonObject // Only picto if ($withpictoimg > 0) $picto=''.img_object('', 'user', $paddafterimage.' '.($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).''; // Picto must be a photo - else $picto=''.Form::showphoto('memberphoto', $this, 0, 0, 0, 'userphoto'.($withpictoimg==-3?'small':''), 'mini', 0, 1).''; + else { + $picto=''; + $picto.=Form::showphoto('memberphoto', $this, 0, 0, 0, 'userphoto'.($withpictoimg==-3?'small':''), 'mini', 0, 1); + $picto.=''; + } $result.=$picto; } if ($withpictoimg > -2 && $withpictoimg != 2) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 877dde34af0..0bcc11bf351 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -681,6 +681,7 @@ while ($i < min($num, $limit)) $memberstatic->datefin= $datefin; $memberstatic->socid = $obj->fk_soc; $memberstatic->photo = $obj->photo; + $memberstatic->morphy = $obj->morphy; if (! empty($obj->fk_soc)) { $memberstatic->fetch_thirdparty(); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index cc6cdb78790..d1a52654c31 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7376,11 +7376,16 @@ class Form else { $nophoto='/public/theme/common/nophoto.png'; - if (in_array($modulepart, array('userphoto','contact'))) // For module that are "physical" users + if (in_array($modulepart, array('userphoto','contact','memberphoto'))) // For module that are "physical" users { - $nophoto='/public/theme/common/user_anonymous.png'; - if ($object->gender == 'man') $nophoto='/public/theme/common/user_man.png'; - if ($object->gender == 'woman') $nophoto='/public/theme/common/user_woman.png'; + if ($modulepart == 'memberphoto' && strpos($object->morphy, 'mor') !== false) { + $nophoto='/public/theme/common/company.png'; + } + else { + $nophoto='/public/theme/common/user_anonymous.png'; + if ($object->gender == 'man') $nophoto='/public/theme/common/user_man.png'; + if ($object->gender == 'woman') $nophoto='/public/theme/common/user_woman.png'; + } } if (! empty($conf->gravatar->enabled) && $email)