34require 
'../main.inc.php';
 
   35require_once DOL_DOCUMENT_ROOT.
'/core/lib/member.lib.php';
 
   36require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
 
   37require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
 
   38require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
 
   39require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
 
   40require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent_type.class.php';
 
   41require_once DOL_DOCUMENT_ROOT.
'/adherents/class/subscription.class.php';
 
   42require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
 
   43require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
 
   44require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
 
   45require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
 
   46require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
 
   47require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
 
   51$langs->loadLangs(array(
"companies", 
"bills", 
"members", 
"users", 
"other", 
"paypal"));
 
   55$action = 
GETPOST(
'action', 
'aZ09');
 
   56$cancel = 
GETPOST(
'cancel', 
'alpha');
 
   57$backtopage = 
GETPOST(
'backtopage', 
'alpha');
 
   58$confirm = 
GETPOST(
'confirm', 
'alpha');
 
   59$rowid = 
GETPOST(
'rowid', 
'int');
 
   61$typeid = 
GETPOST(
'typeid', 
'int');
 
   62$userid = 
GETPOST(
'userid', 
'int');
 
   63$socid = 
GETPOST(
'socid', 
'int');
 
   66if (isModEnabled(
'mailmanspip')) {
 
   67  include_once DOL_DOCUMENT_ROOT.
'/mailmanspip/class/mailmanspip.class.php';
 
   69  $langs->load(
'mailmanspip');
 
   78$extrafields->fetch_name_optionals_label($object->table_element);
 
   83$object->getCanvas($id);
 
   84$canvas = $object->canvas ? $object->canvas : 
GETPOST(
"canvas");
 
   87  require_once DOL_DOCUMENT_ROOT.
'/core/class/canvas.class.php';
 
   88  $objcanvas = 
new Canvas($db, $action);
 
   89  $objcanvas->getCanvas(
'adherent', 
'membercard', $canvas);
 
   93$hookmanager->initHooks(array(
'membercard', 
'globalcard'));
 
   96if ($id > 0 || !empty($ref)) {
 
   98  $result = $object->fetch($id, $ref);
 
  101  $canadduser = ($user->admin || $user->hasRight(
'user', 
'user', 
'creer'));
 
  103  if ($object->user_id) {
 
  105    $caneditfielduser = ((($user->id == $object->user_id) && $user->hasRight(
'user', 
'self', 
'creer'))
 
  106      || (($user->id != $object->user_id) && $user->hasRight(
'user', 
'user', 
'creer')));
 
  107    $caneditpassworduser = ((($user->id == $object->user_id) && $user->hasRight(
'user', 
'self', 
'password'))
 
  108      || (($user->id != $object->user_id) && $user->hasRight(
'user', 
'user', 
'password')));
 
  113$canaddmember = $user->hasRight(
'adherent', 
'creer');
 
  116  $caneditfieldmember = $user->hasRight(
'adherent', 
'creer');
 
  120$result = 
restrictedArea($user, 
'adherent', $object->id, 
'', 
'', 
'socid', 
'rowid', 0);
 
  122if (!$user->hasRight(
'adherent', 
'creer') && $action == 
'edit') {
 
  126$linkofpubliclist = DOL_MAIN_URL_ROOT.
'/public/members/public_list.php'.((isModEnabled(
'multicompany')) ? 
'?entity='.$conf->entity : 
'');
 
  133$parameters = array(
'id'=>$id, 
'rowid'=>$id, 
'objcanvas'=>$objcanvas, 
'confirm'=>$confirm);
 
  134$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action); 
 
  139if (empty($reshook)) {
 
  140  $backurlforlist = DOL_URL_ROOT.
'/adherents/list.php';
 
  142  if (empty($backtopage) || ($cancel && empty($id))) {
 
  143    if (empty($backtopage) || ($cancel && strpos($backtopage, 
'__ID__'))) {
 
  144      if (empty($id) && (($action != 
'add' && $action != 
'create') || $cancel)) {
 
  145        $backtopage = $backurlforlist;
 
  147        $backtopage = DOL_URL_ROOT.
'/adherents/card.php?id='.((!empty($id) && $id > 0) ? $id : 
'__ID__');
 
  153    if (!empty($backtopageforcancel)) {
 
  154      header(
"Location: ".$backtopageforcancel);
 
  156    } elseif (!empty($backtopage)) {
 
  157      header(
"Location: ".$backtopage);
 
  163  if ($action == 
'setuserid' && ($user->hasRight(
'user', 
'self', 
'creer') || $user->hasRight(
'user', 
'user', 
'creer'))) {
 
  165    if (!$user->hasRight(
'user', 
'user', 
'creer')) {  
 
  166      if ($userid != $user->id && $userid != $object->user_id) {
 
  168        setEventMessages($langs->trans(
"ErrorUserPermissionAllowsToLinksToItselfOnly"), 
null, 
'errors');
 
  173      if ($userid != $object->user_id) {  
 
  174        $result = $object->setUserId($userid);
 
  183  if ($action == 
'setsocid') {
 
  186      if ($socid != $object->socid) { 
 
  187        $sql = 
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"adherent";
 
  188        $sql .= 
" WHERE socid = ".((int) $socid);
 
  189        $sql .= 
" AND entity = ".$conf->entity;
 
  190        $resql = $db->query($sql);
 
  192          $obj = $db->fetch_object($resql);
 
  193          if ($obj && $obj->rowid > 0) {
 
  195            $othermember->fetch($obj->rowid);
 
  196            $thirdparty = 
new Societe($db);
 
  197            $thirdparty->fetch($socid);
 
  199            setEventMessages($langs->trans(
"ErrorMemberIsAlreadyLinkedToThisThirdParty", $othermember->getFullName($langs), $othermember->login, $thirdparty->name), 
null, 
'errors');
 
  204          $result = $object->setThirdPartyId($socid);
 
  215  if ($action == 
'confirm_create_user' && $confirm == 
'yes' && $user->hasRight(
'user', 
'user', 
'creer')) {
 
  218      $nuser = 
new User($db);
 
  220      if (
GETPOST(
'internalorexternal', 
'aZ09') == 
'internal') {
 
  221        $tmpuser->fk_soc = 0;
 
  224      $result = $nuser->create_from_member($tmpuser, 
GETPOST(
'login', 
'alphanohtml'));
 
  227        $langs->load(
"errors");
 
  230        setEventMessages($langs->trans(
"NewUserCreated", $nuser->login), 
null, 
'mesgs');
 
  239  if ($action == 
'confirm_create_thirdparty' && $confirm == 
'yes' && $user->hasRight(
'societe', 
'creer')) {
 
  243      $result = $company->create_from_member($object, 
GETPOST(
'companyname', 
'alpha'), 
GETPOST(
'companyalias', 
'alpha'));
 
  246        $langs->load(
"errors");
 
  255  if ($action == 
'update' && !$cancel && $user->hasRight(
'adherent', 
'creer')) {
 
  256    require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
 
  262    $lastname = 
GETPOST(
"lastname", 
'alphanohtml');
 
  263    $firstname = 
GETPOST(
"firstname", 
'alphanohtml');
 
  264    $gender = 
GETPOST(
"gender", 
'alphanohtml');
 
  265    $societe = 
GETPOST(
"societe", 
'alphanohtml');
 
  266    $morphy = 
GETPOST(
"morphy", 
'alphanohtml');
 
  267    $login = 
GETPOST(
"login", 
'alphanohtml');
 
  268    if ($morphy != 
'mor' && empty($lastname)) {
 
  270      $langs->load(
"errors");
 
  271      setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Lastname")), 
null, 
'errors');
 
  273    if ($morphy != 
'mor' && (!isset($firstname) || $firstname == 
'')) {
 
  275      $langs->load(
"errors");
 
  276      setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Firstname")), 
null, 
'errors');
 
  278    if ($morphy == 
'mor' && empty($societe)) {
 
  280      $langs->load(
"errors");
 
  281      setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Company")), 
null, 
'errors');
 
  284    if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
 
  287        setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Login")), 
null, 
'errors');
 
  291    if ($result > 0 && !$error) {
 
  295      $object->civility_id = trim(
GETPOST(
"civility_id", 
'alphanohtml'));
 
  296      $object->firstname   = trim(
GETPOST(
"firstname", 
'alphanohtml'));
 
  297      $object->lastname    = trim(
GETPOST(
"lastname", 
'alphanohtml'));
 
  298      $object->gender      = trim(
GETPOST(
"gender", 
'alphanohtml'));
 
  299      $object->login       = trim(
GETPOST(
"login", 
'alphanohtml'));
 
  300      if (GETPOSTISSET(
'pass')) {
 
  301        $object->pass        = trim(
GETPOST(
"pass", 
'none')); 
 
  304      $object->societe     = trim(
GETPOST(
"societe", 
'alphanohtml')); 
 
  305      $object->company     = trim(
GETPOST(
"societe", 
'alphanohtml'));
 
  307      $object->address     = trim(
GETPOST(
"address", 
'alphanohtml'));
 
  308      $object->zip         = trim(
GETPOST(
"zipcode", 
'alphanohtml'));
 
  309      $object->town        = trim(
GETPOST(
"town", 
'alphanohtml'));
 
  310      $object->state_id    = 
GETPOST(
"state_id", 
'int');
 
  311      $object->country_id  = 
GETPOST(
"country_id", 
'int');
 
  313      $object->phone       = trim(
GETPOST(
"phone", 
'alpha'));
 
  314      $object->phone_perso = trim(
GETPOST(
"phone_perso", 
'alpha'));
 
  315      $object->phone_mobile = trim(
GETPOST(
"phone_mobile", 
'alpha'));
 
  316      $object->email = preg_replace(
'/\s+/', 
'', 
GETPOST(
"member_email", 
'alpha'));
 
  317      $object->url = trim(
GETPOST(
'member_url', 
'custom', 0, FILTER_SANITIZE_URL));
 
  318      $object->socialnetworks = array();
 
  319      foreach ($socialnetworks as $key => $value) {
 
  320        if (GETPOSTISSET($key) && 
GETPOST($key, 
'alphanohtml') != 
'') {
 
  321          $object->socialnetworks[$key] = trim(
GETPOST($key, 
'alphanohtml'));
 
  324      $object->birth = $birthdate;
 
  325      $object->default_lang = 
GETPOST(
'default_lang', 
'alpha');
 
  326      $object->typeid = 
GETPOST(
"typeid", 
'int');
 
  328      $object->morphy = 
GETPOST(
"morphy", 
'alpha');
 
  330      if (
GETPOST(
'deletephoto', 
'alpha')) {
 
  332      } elseif (!empty($_FILES[
'photo'][
'name'])) {
 
  337      $object->statut = 
GETPOST(
"statut", 
'alpha');
 
  338      $object->status = 
GETPOST(
"statut", 
'alpha');
 
  339      $object->public = 
GETPOST(
"public", 
'alpha');
 
  342      $ret = $extrafields->setOptionalsFromPost(
null, $object, 
'@GETPOSTISSET');
 
  349      if ($object->user_id) { 
 
  350        if ($user->id != $object->user_id && !$user->hasRight(
'user', 
'user', 
'creer')) {
 
  357      if (GETPOSTISSET(
'pass')) {
 
  358        if ($object->user_id) { 
 
  360          if ($user->id == $object->user_id) {
 
  361            if (!$user->hasRight(
'user', 
'self', 
'password')) {
 
  365            if (!$user->hasRight(
'user', 
'user', 
'password')) {
 
  373        $result = $object->update($user, 0, $nosyncuser, $nosyncuserpass);
 
  375        if ($result >= 0 && !count($object->errors)) {
 
  376          $categories = 
GETPOST(
'memcats', 
'array');
 
  377          $object->setCategories($categories);
 
  380          $dir = $conf->adherent->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $object, 
'member').
'/photos';
 
  381          $file_OK = is_uploaded_file($_FILES[
'photo'][
'tmp_name']);
 
  384              require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
 
  385              $fileimg = $conf->adherent->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $object, 
'member').
'/photos/'.$object->photo;
 
  386              $dirthumbs = $conf->adherent->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $object, 
'member').
'/photos/thumbs';
 
  396                if (!
dol_move_uploaded_file($_FILES[
'photo'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'photo'][
'error']) > 0) {
 
  400                  $object->addThumbs($newfile);
 
  407            switch ($_FILES[
'photo'][
'error']) {
 
  410                $errors[] = 
"ErrorFileSizeTooLarge";
 
  413                $errors[] = 
"ErrorFilePartiallyUploaded";
 
  418          $rowid = $object->id;
 
  422          if (!empty($backtopage)) {
 
  423            header(
"Location: ".$backtopage);
 
  438  if ($action == 
'add' && $user->hasRight(
'adherent', 
'creer')) {
 
  440      $object->canvas = $canvas;
 
  443    if (GETPOSTISSET(
"birthday") && 
GETPOST(
"birthday") && GETPOSTISSET(
"birthmonth") && 
GETPOST(
"birthmonth") && GETPOSTISSET(
"birthyear") && 
GETPOST(
"birthyear")) {
 
  446    $datesubscription = 
'';
 
  447    if (GETPOSTISSET(
"reday") && GETPOSTISSET(
"remonth") && GETPOSTISSET(
"reyear")) {
 
  451    $typeid = 
GETPOST(
"typeid", 
'int');
 
  452    $civility_id = 
GETPOST(
"civility_id", 
'alphanohtml');
 
  453    $lastname = 
GETPOST(
"lastname", 
'alphanohtml');
 
  454    $firstname = 
GETPOST(
"firstname", 
'alphanohtml');
 
  455    $gender = 
GETPOST(
"gender", 
'alphanohtml');
 
  456    $societe = 
GETPOST(
"societe", 
'alphanohtml');
 
  457    $address = 
GETPOST(
"address", 
'alphanohtml');
 
  458    $zip = 
GETPOST(
"zipcode", 
'alphanohtml');
 
  459    $town = 
GETPOST(
"town", 
'alphanohtml');
 
  460    $state_id = 
GETPOST(
"state_id", 
'int');
 
  461    $country_id = 
GETPOST(
"country_id", 
'int');
 
  463    $phone = 
GETPOST(
"phone", 
'alpha');
 
  464    $phone_perso = 
GETPOST(
"phone_perso", 
'alpha');
 
  465    $phone_mobile = 
GETPOST(
"phone_mobile", 
'alpha');
 
  470    $email = preg_replace(
'/\s+/', 
'', 
GETPOST(
"member_email", 
'alpha'));
 
  471    $url = trim(
GETPOST(
'url', 
'custom', 0, FILTER_SANITIZE_URL));
 
  472    $login = 
GETPOST(
"member_login", 
'alphanohtml');
 
  473    $pass = 
GETPOST(
"password", 
'none');  
 
  474    $photo = 
GETPOST(
"photo", 
'alphanohtml');
 
  475    $morphy = 
GETPOST(
"morphy", 
'alphanohtml');
 
  476    $public = 
GETPOST(
"public", 
'alphanohtml');
 
  478    $userid = 
GETPOST(
"userid", 
'int');
 
  479    $socid = 
GETPOST(
"socid", 
'int');
 
  480    $default_lang = 
GETPOST(
'default_lang', 
'alpha');
 
  482    $object->civility_id = $civility_id;
 
  483    $object->firstname   = $firstname;
 
  484    $object->lastname    = $lastname;
 
  485    $object->gender      = $gender;
 
  486    $object->societe     = $societe; 
 
  487    $object->company     = $societe;
 
  488    $object->address     = $address;
 
  490    $object->town        = $town;
 
  491    $object->state_id    = $state_id;
 
  492    $object->country_id  = $country_id;
 
  493    $object->phone       = $phone;
 
  494    $object->phone_perso = $phone_perso;
 
  495    $object->phone_mobile = $phone_mobile;
 
  496    $object->socialnetworks = array();
 
  497    if (isModEnabled(
'socialnetworks')) {
 
  498      foreach ($socialnetworks as $key => $value) {
 
  499        if (GETPOSTISSET($key) && 
GETPOST($key, 
'alphanohtml') != 
'') {
 
  500          $object->socialnetworks[$key] = 
GETPOST(
"member_".$key, 
'alphanohtml');
 
  505    $object->email       = $email;
 
  507    $object->login       = $login;
 
  508    $object->pass        = $pass;
 
  509    $object->birth       = $birthdate;
 
  510    $object->photo       = $photo;
 
  511    $object->typeid      = $typeid;
 
  513    $object->morphy      = $morphy;
 
  514    $object->user_id     = $userid;
 
  515    $object->socid = $socid;
 
  516    $object->public      = $public;
 
  517    $object->default_lang = $default_lang;
 
  519    $ret = $extrafields->setOptionalsFromPost(
null, $object);
 
  525    if (empty($morphy) || $morphy == 
"-1") {
 
  527      setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"MemberNature")), 
null, 
'errors');
 
  530    if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
 
  533        setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Login")), 
null, 
'errors');
 
  535        $sql = 
"SELECT login FROM ".MAIN_DB_PREFIX.
"adherent WHERE login='".$db->escape($login).
"'";
 
  536        $result = $db->query($sql);
 
  538          $num = $db->num_rows($result);
 
  542          $langs->load(
"errors");
 
  543          setEventMessages($langs->trans(
"ErrorLoginAlreadyExists", $login), 
null, 
'errors');
 
  548        setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Password")), 
null, 
'errors');
 
  551    if ($morphy == 
'mor' && empty($societe)) {
 
  553      $langs->load(
"errors");
 
  554      setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Company")), 
null, 
'errors');
 
  556    if ($morphy != 
'mor' && empty($lastname)) {
 
  558      $langs->load(
"errors");
 
  559      setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Lastname")), 
null, 
'errors');
 
  561    if ($morphy != 
'mor' && (!isset($firstname) || $firstname == 
'')) {
 
  563      $langs->load(
"errors");
 
  564      setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Firstname")), 
null, 
'errors');
 
  566    if (!($typeid > 0)) { 
 
  568      setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Type")), 
null, 
'errors');
 
  570    if (!empty($conf->global->ADHERENT_MAIL_REQUIRED) && !isValidEMail($email)) {
 
  572      $langs->load(
"errors");
 
  575    if (!empty($object->url) && !
isValidUrl($object->url)) {
 
  576      $langs->load(
"errors");
 
  577      setEventMessages($langs->trans(
"ErrorBadUrl", $object->url), 
null, 
'errors');
 
  580    if (isset($public)) {
 
  588      $result = $object->create($user);
 
  591        $memcats = 
GETPOST(
'memcats', 
'array');
 
  592        $object->setCategories($memcats);
 
  596        $rowid = $object->id;
 
  599        $backtopage = preg_replace(
'/__ID__/', $id, $backtopage);
 
  608      if (!empty($conf->global->ADHERENT_DEFAULT_CREATE_THIRDPARTY)) {
 
  612          $result = $company->create_from_member($object);
 
  614            $langs->load(
"errors");
 
  623    $action = ($result < 0 || !$error) ?  
'' : 
'create';
 
  625    if (!$error && $backtopage) {
 
  626      header(
"Location: ".$backtopage);
 
  631  if ($user->hasRight(
'adherent', 
'supprimer') && $action == 
'confirm_delete' && $confirm == 
'yes') {
 
  632    $result = $object->delete($id, $user);
 
  635      if (!empty($backtopage) && !preg_match(
'/'.preg_quote($_SERVER[
"PHP_SELF"], 
'/').
'/', $backtopage)) {
 
  636        header(
"Location: ".$backtopage);
 
  639        header(
"Location: list.php");
 
  647  if ($user->hasRight(
'adherent', 
'creer') && $action == 
'confirm_valid' && $confirm == 
'yes') {
 
  653    $adht->fetch($object->typeid);
 
  655    $result = $object->validate($user);
 
  657    if ($result >= 0 && !count($object->errors)) {
 
  659      if ($object->email && 
GETPOST(
"send_mail")) {
 
  664        include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
 
  668        $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
 
  670        $outputlangs->loadLangs(array(
"main", 
"members", 
"companies", 
"install", 
"other"));
 
  672        $arraydefaultmessage = 
null;
 
  675        if (!empty($labeltouse)) {
 
  676          $arraydefaultmessage = $formmail->getEMailTemplate($db, 
'member', $user, $outputlangs, 0, 1, $labeltouse);
 
  679        if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
 
  680          $subject = $arraydefaultmessage->topic;
 
  681          $msg     = $arraydefaultmessage->content;
 
  684        if (empty($labeltouse) || (
int) $labeltouse === -1) {
 
  686          $langs->load(
"errors");
 
  687          setEventMessages(
'<a href="'.DOL_URL_ROOT.
'/adherents/admin/member_emails.php">'.$langs->trans(
'WarningMandatorySetupNotComplete').
'</a>', 
null, 
'errors');
 
  695          $moreinheader = 
'X-Dolibarr-Info: send_an_email by adherents/card.php'.
"\r\n";
 
  697          $result = $object->sendEmail($texttosend, $subjecttosend, array(), array(), array(), 
"", 
"", 0, -1, 
'', $moreinheader);
 
  706      if ($object->error) {
 
  721  if ($user->hasRight(
'adherent', 
'supprimer') && $action == 
'confirm_resiliate') {
 
  724    if ($confirm == 
'yes') {
 
  726      $adht->fetch($object->typeid);
 
  728      $result = $object->resiliate($user);
 
  730      if ($result >= 0 && !count($object->errors)) {
 
  731        if ($object->email && 
GETPOST(
"send_mail")) {
 
  736          include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
 
  740          $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
 
  742          $outputlangs->loadLangs(array(
"main", 
"members", 
"companies", 
"install", 
"other"));
 
  744          $arraydefaultmessage = 
null;
 
  747          if (!empty($labeltouse)) {
 
  748            $arraydefaultmessage = $formmail->getEMailTemplate($db, 
'member', $user, $outputlangs, 0, 1, $labeltouse);
 
  751          if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
 
  752            $subject = $arraydefaultmessage->topic;
 
  753            $msg     = $arraydefaultmessage->content;
 
  756          if (empty($labeltouse) || (
int) $labeltouse === -1) {
 
  766            $moreinheader = 
'X-Dolibarr-Info: send_an_email by adherents/card.php'.
"\r\n";
 
  768            $result = $object->sendEmail($texttosend, $subjecttosend, array(), array(), array(), 
"", 
"", 0, -1, 
'', $moreinheader);
 
  778        if ($object->error) {
 
  786    if (!empty($backtopage) && !$error) {
 
  787      header(
"Location: ".$backtopage);
 
  792  if ($user->hasRight(
'adherent', 
'supprimer') && $action == 
'confirm_exclude') {
 
  795    if ($confirm == 
'yes') {
 
  797      $adht->fetch($object->typeid);
 
  799      $result = $object->exclude($user);
 
  801      if ($result >= 0 && !count($object->errors)) {
 
  802        if ($object->email && 
GETPOST(
"send_mail")) {
 
  807          include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
 
  811          $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
 
  813          $outputlangs->loadLangs(array(
"main", 
"members", 
"companies", 
"install", 
"other"));
 
  815          $arraydefaultmessage = 
null;
 
  818          if (!empty($labeltouse)) {
 
  819            $arraydefaultmessage = $formmail->getEMailTemplate($db, 
'member', $user, $outputlangs, 0, 1, $labeltouse);
 
  822          if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
 
  823            $subject = $arraydefaultmessage->topic;
 
  824            $msg     = $arraydefaultmessage->content;
 
  827          if (empty($labeltouse) || (
int) $labeltouse === -1) {
 
  837            $moreinheader = 
'X-Dolibarr-Info: send_an_email by adherents/card.php'.
"\r\n";
 
  839            $result = $object->sendEmail($texttosend, $subjecttosend, array(), array(), array(), 
"", 
"", 0, -1, 
'', $moreinheader);
 
  849        if ($object->error) {
 
  857    if (!empty($backtopage) && !$error) {
 
  858      header(
"Location: ".$backtopage);
 
  864  if ($user->hasRight(
'adherent', 
'supprimer') && $action == 
'confirm_del_spip' && $confirm == 
'yes') {
 
  865    if (!count($object->errors)) {
 
  866      if (!$mailmanspip->del_to_spip($object)) {
 
  867        setEventMessages($langs->trans(
'DeleteIntoSpipError').
': '.$mailmanspip->error, 
null, 
'errors');
 
  872  if ($user->hasRight(
'adherent', 
'creer') && $action == 
'confirm_add_spip' && $confirm == 
'yes') {
 
  873    if (!count($object->errors)) {
 
  874      if (!$mailmanspip->add_to_spip($object)) {
 
  875        setEventMessages($langs->trans(
'AddIntoSpipError').
': '.$mailmanspip->error, 
null, 
'errors');
 
  881  include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
 
  884  $upload_dir = $conf->adherent->dir_output;
 
  885  $permissiontoadd = $user->hasRight(
'adherent', 
'creer');
 
  886  include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
 
  889  $triggersendname = 
'MEMBER_SENTBYMAIL';
 
  891  $mode = 
'emailfrommember';
 
  892  $trackid = 
'mem'.$object->id;
 
  893  include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
 
  901$form = 
new Form($db);
 
  906$title = $langs->trans(
"Member").
" - ".$langs->trans(
"Card");
 
  907$help_url = 
'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros|DE:Modul_Mitglieder';
 
  910$countrynotdefined = $langs->trans(
"ErrorSetACountryFirst").
' ('.$langs->trans(
"SeeAbove").
')';
 
  912if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
 
  916  if (empty($object->error) && $id) {
 
  918    $result = $object->fetch($id);
 
  923  $objcanvas->assign_values($action, $object->id, $object->ref); 
 
  924  $objcanvas->display_canvas($action); 
 
  931  if ($action == 
'create') {
 
  932    $object->canvas = $canvas;
 
  933    $object->state_id = 
GETPOST(
'state_id', 
'int');
 
  936    $object->country_id = 
GETPOST(
'country_id', 
'int') ? 
GETPOST(
'country_id', 
'int') : $mysoc->country_id;
 
  937    if ($object->country_id) {
 
  938      $tmparray = 
getCountry($object->country_id, 
'all');
 
  939      $object->country_code = $tmparray[
'code'];
 
  940      $object->country = $tmparray[
'label'];
 
  944    if (!empty($socid)) {
 
  949      if (!($soc->id > 0)) {
 
  950        $langs->load(
"errors");
 
  951        print($langs->trans(
'ErrorRecordNotFound'));
 
  960    if ($conf->use_javascript_ajax) {
 
  961      print 
"\n".
'<script type="text/javascript">'.
"\n";
 
  962      print 
'jQuery(document).ready(function () { 
  963            jQuery("#selectcountry_id").change(function() { 
  964              document.formsoc.action.value="create"; 
  965              document.formsoc.submit(); 
  967            function initfieldrequired() { 
  968              jQuery("#tdcompany").removeClass("fieldrequired"); 
  969              jQuery("#tdlastname").removeClass("fieldrequired"); 
  970              jQuery("#tdfirstname").removeClass("fieldrequired"); 
  971              if (jQuery("#morphy").val() == \'mor\') { 
  972                jQuery("#tdcompany").addClass("fieldrequired"); 
  974              if (jQuery("#morphy").val() == \'phy\') { 
  975                jQuery("#tdlastname").addClass("fieldrequired"); 
  976                jQuery("#tdfirstname").addClass("fieldrequired"); 
  979            jQuery("#morphy").change(function() { 
  984      print 
'</script>'.
"\n";
 
  987    print 
'<form name="formsoc" action="'.$_SERVER[
"PHP_SELF"].
'" method="post" enctype="multipart/form-data">';
 
  988    print 
'<input type="hidden" name="token" value="'.newToken().
'">';
 
  989    print 
'<input type="hidden" name="action" value="add">';
 
  990    print 
'<input type="hidden" name="socid" value="'.$socid.
'">';
 
  992      print 
'<input type="hidden" name="backtopage" value="'.($backtopage != 
'1' ? $backtopage : $_SERVER[
"HTTP_REFERER"]).
'">';
 
  997    print 
'<table class="border centpercent">';
 
 1001    if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
 
 1002      print 
'<tr><td><span class="fieldrequired">'.$langs->trans(
"Login").
' / '.$langs->trans(
"Id").
'</span></td><td><input type="text" name="member_login" class="minwidth300" maxlength="50" value="'.(GETPOSTISSET(
"member_login") ? 
GETPOST(
"member_login", 
'alphanohtml', 2) : $object->login).
'" autofocus="autofocus"></td></tr>';
 
 1006    if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
 
 1007      require_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
 
 1009      print 
'<tr><td><span class="fieldrequired">'.$langs->trans(
"Password").
'</span></td><td>';
 
 1010      print 
'<input type="text" class="minwidth300" maxlength="50" name="password" value="'.dol_escape_htmltag($generated_password).
'">';
 
 1015    print 
'<tr><td class="fieldrequired">'.$langs->trans(
"MemberType").
'</td><td>';
 
 1016    $listetype = $adht->liste_array(1);
 
 1017    print 
img_picto(
'', $adht->picto, 
'class="pictofixedwidth"');
 
 1018    if (count($listetype)) {
 
 1019      print $form->selectarray(
"typeid", $listetype, (
GETPOST(
'typeid', 
'int') ? 
GETPOST(
'typeid', 
'int') : $typeid), (count($listetype) > 1 ? 1 : 0), 0, 0, 
'', 0, 0, 0, 
'', 
'minwidth150', 1);
 
 1021      print 
'<span class="error">'.$langs->trans(
"NoTypeDefinedGoToSetup").
'</span>';
 
 1026    $morphys[
"phy"] = $langs->trans(
"Physical");
 
 1027    $morphys[
"mor"] = $langs->trans(
"Moral");
 
 1028    print 
'<tr><td class="fieldrequired">'.$langs->trans(
"MemberNature").
"</td><td>\n";
 
 1029    print $form->selectarray(
"morphy", $morphys, (
GETPOST(
'morphy', 
'alpha') ?
GETPOST(
'morphy', 
'alpha') : $object->morphy), 1, 0, 0, 
'', 0, 0, 0, 
'', 
'', 1);
 
 1033    print 
'<tr><td id="tdcompany">'.$langs->trans(
"Company").
'</td><td><input type="text" name="societe" class="minwidth300" maxlength="128" value="'.(GETPOSTISSET(
'societe') ? 
GETPOST(
'societe', 
'alphanohtml') : $soc->
name).
'"></td></tr>';
 
 1036    print 
'<tr><td>'.$langs->trans(
"UserTitle").
'</td><td>';
 
 1037    print $formcompany->select_civility(
GETPOST(
'civility_id', 
'int') ? 
GETPOST(
'civility_id', 
'int') : $object->civility_id, 
'civility_id', 
'maxwidth150', 1).
'</td>';
 
 1041    print 
'<tr><td id="tdlastname">'.$langs->trans(
"Lastname").
'</td><td><input type="text" name="lastname" class="minwidth300" maxlength="50" value="'.(GETPOSTISSET(
'lastname') ? 
GETPOST(
'lastname', 
'alphanohtml') : $object->lastname).
'"></td>';
 
 1045    print 
'<tr><td id="tdfirstname">'.$langs->trans(
"Firstname").
'</td><td><input type="text" name="firstname" class="minwidth300" maxlength="50" value="'.(GETPOSTISSET(
'firstname') ? 
GETPOST(
'firstname', 
'alphanohtml') : $object->firstname).
'"></td>';
 
 1049    print 
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
 
 1051    $arraygender = array(
'man'=>$langs->trans(
"Genderman"), 
'woman'=>$langs->trans(
"Genderwoman"), 
'other'=>$langs->trans(
"Genderother"));
 
 1052    print $form->selectarray(
'gender', $arraygender, 
GETPOST(
'gender', 
'alphanohtml'), 1, 0, 0, 
'', 0, 0, 0, 
'', 
'', 1);
 
 1056    print 
'<tr><td>'.(!empty($conf->global->ADHERENT_MAIL_REQUIRED) ? 
'<span class="fieldrequired">' : 
'').$langs->trans(
"EMail").(!empty($conf->global->ADHERENT_MAIL_REQUIRED) ? 
'</span>' : 
'').
'</td>';
 
 1057    print 
'<td>'.img_picto(
'', 
'object_email').
' <input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(GETPOSTISSET(
'member_email') ? 
GETPOST(
'member_email', 
'alpha') : $soc->email).
'"></td></tr>';
 
 1060    print 
'<tr><td>'.$form->editfieldkey(
'Web', 
'member_url', 
GETPOST(
'member_url', 
'alpha'), $object, 0).
'</td>';
 
 1061    print 
'<td>'.img_picto(
'', 
'globe').
' <input type="text" class="maxwidth500 widthcentpercentminusx" name="member_url" id="member_url" value="'.(GETPOSTISSET(
'member_url') ? 
GETPOST(
'member_url', 
'alpha') : $object->url).
'"></td></tr>';
 
 1064    print 
'<tr><td class="tdtop">'.$langs->trans(
"Address").
'</td><td>';
 
 1065    print 
'<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="2">'.(GETPOSTISSET(
'address') ?
GETPOST(
'address', 
'alphanohtml') : $soc->address).
'</textarea>';
 
 1069    print 
'<tr><td>'.$langs->trans(
"Zip").
' / '.$langs->trans(
"Town").
'</td><td>';
 
 1070    print $formcompany->select_ziptown((GETPOSTISSET(
'zipcode') ? 
GETPOST(
'zipcode', 
'alphanohtml') : $soc->zip), 
'zipcode', array(
'town', 
'selectcountry_id', 
'state_id'), 6);
 
 1072    print $formcompany->select_ziptown((GETPOSTISSET(
'town') ? 
GETPOST(
'town', 
'alphanohtml') : $soc->town), 
'town', array(
'zipcode', 
'selectcountry_id', 
'state_id'));
 
 1076    if (empty($soc->country_id)) {
 
 1077      $soc->country_id = $mysoc->country_id;
 
 1078      $soc->country_code = $mysoc->country_code;
 
 1079      $soc->state_id = $mysoc->state_id;
 
 1081    print 
'<tr><td>'.$langs->trans(
'Country').
'</td><td>';
 
 1082    print 
img_picto(
'', 
'country', 
'class="pictofixedwidth"');
 
 1083    print $form->select_country(GETPOSTISSET(
'country_id') ? 
GETPOST(
'country_id', 
'alpha') : $soc->country_id, 
'country_id');
 
 1085      print 
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
 
 1090    if (empty($conf->global->MEMBER_DISABLE_STATE)) {
 
 1091      print 
'<tr><td>'.$langs->trans(
'State').
'</td><td>';
 
 1092      if ($soc->country_id) {
 
 1093        print 
img_picto(
'', 
'state', 
'class="pictofixedwidth"');
 
 1094        print $formcompany->select_state(GETPOSTISSET(
'state_id') ? 
GETPOST(
'state_id', 
'int') : $soc->state_id, $soc->country_code);
 
 1096        print $countrynotdefined;
 
 1102    print 
'<tr><td>'.$langs->trans(
"PhonePro").
'</td>';
 
 1103    print 
'<td>'.img_picto(
'', 
'object_phoning', 
'class="pictofixedwidth"').
'<input type="text" name="phone" size="20" value="'.(GETPOSTISSET(
'phone') ? 
GETPOST(
'phone', 
'alpha') : $soc->phone).
'"></td></tr>';
 
 1106    print 
'<tr><td>'.$langs->trans(
"PhonePerso").
'</td>';
 
 1107    print 
'<td>'.img_picto(
'', 
'object_phoning', 
'class="pictofixedwidth"').
'<input type="text" name="phone_perso" size="20" value="'.(GETPOSTISSET(
'phone_perso') ? 
GETPOST(
'phone_perso', 
'alpha') : $object->phone_perso).
'"></td></tr>';
 
 1110    print 
'<tr><td>'.$langs->trans(
"PhoneMobile").
'</td>';
 
 1111    print 
'<td>'.img_picto(
'', 
'object_phoning_mobile', 
'class="pictofixedwidth"').
'<input type="text" name="phone_mobile" size="20" value="'.(GETPOSTISSET(
'phone_mobile') ? 
GETPOST(
'phone_mobile', 
'alpha') : $object->phone_mobile).
'"></td></tr>';
 
 1113    if (isModEnabled(
'socialnetworks')) {
 
 1114      foreach ($socialnetworks as $key => $value) {
 
 1115        if (!$value[
'active']) {
 
 1118        $val = (GETPOSTISSET(
'member_'.$key) ? 
GETPOST(
'member_'.$key, 
'alpha') : (empty($object->socialnetworks[$key]) ? 
'' : $object->socialnetworks[$key]));
 
 1119        print 
'<tr><td>'.$langs->trans($value[
'label']).
'</td><td><input type="text" name="member_'.$key.
'" size="40" value="'.$val.
'"></td></tr>';
 
 1124    print 
"<tr><td>".$langs->trans(
"DateOfBirth").
"</td><td>\n";
 
 1125    print $form->selectDate(($object->birth ? $object->birth : -1), 
'birth', 
'', 
'', 1, 
'formsoc');
 
 1126    print 
"</td></tr>\n";
 
 1129    print 
"<tr><td>".$langs->trans(
"Public", 
getDolGlobalString(
'MAIN_INFO_SOCIETE_NOM'), $linkofpubliclist).
"</td><td>\n";
 
 1130    print $form->selectyesno(
"public", $object->public, 1);
 
 1131    print 
"</td></tr>\n";
 
 1134    if (isModEnabled(
'categorie') && $user->hasRight(
'categorie', 
'lire')) {
 
 1135      print 
'<tr><td>'.$form->editfieldkey(
"Categories", 
'memcats', 
'', $object, 0).
'</td><td>';
 
 1136      $cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, 
null, 
'parent', 
null, 
null, 1);
 
 1137      print 
img_picto(
'', 
'category').$form->multiselectarray(
'memcats', $cate_arbo, 
GETPOST(
'memcats', 
'array'), 
null, 
null, 
'quatrevingtpercent widthcentpercentminusx', 0, 0);
 
 1142    include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
 
 1149    print $form->buttonsSaveCancel(
"AddMember");
 
 1155  if ($action == 
'edit') {
 
 1156    $res = $object->fetch($id);
 
 1160    $res = $object->fetch_optionals();
 
 1166    $adht->fetch($object->typeid);
 
 1169    $country = 
GETPOST(
'country', 
'int');
 
 1170    if (!empty($country) || $object->country_id) {
 
 1171      $sql = 
"SELECT rowid, code, label from ".MAIN_DB_PREFIX.
"c_country where rowid = ".(!empty($country) ? $country : $object->country_id);
 
 1172      $resql = $db->query($sql);
 
 1174        $obj = $db->fetch_object($resql);
 
 1178      $object->country_id = $obj->rowid;
 
 1179      $object->country_code = $obj->code;
 
 1180      $object->country = $langs->trans(
"Country".$obj->code) ? $langs->trans(
"Country".$obj->code) : $obj->label;
 
 1186    if ($conf->use_javascript_ajax) {
 
 1187      print 
"\n".
'<script type="text/javascript">';
 
 1188      print 
'jQuery(document).ready(function () { 
 1189        jQuery("#selectcountry_id").change(function() { 
 1190          document.formsoc.action.value="edit"; 
 1191          document.formsoc.submit(); 
 1193        function initfieldrequired() { 
 1194          jQuery("#tdcompany").removeClass("fieldrequired"); 
 1195          jQuery("#tdlastname").removeClass("fieldrequired"); 
 1196          jQuery("#tdfirstname").removeClass("fieldrequired"); 
 1197          if (jQuery("#morphy").val() == \'mor\') { 
 1198            jQuery("#tdcompany").addClass("fieldrequired"); 
 1200          if (jQuery("#morphy").val() == \'phy\') { 
 1201            jQuery("#tdlastname").addClass("fieldrequired"); 
 1202            jQuery("#tdfirstname").addClass("fieldrequired"); 
 1205        jQuery("#morphy").change(function() { 
 1206          initfieldrequired(); 
 1208        initfieldrequired(); 
 1210      print 
'</script>'.
"\n";
 
 1213    print 
'<form name="formsoc" action="'.$_SERVER[
"PHP_SELF"].
'" method="post" enctype="multipart/form-data">';
 
 1214    print 
'<input type="hidden" name="token" value="'.newToken().
'" />';
 
 1215    print 
'<input type="hidden" name="action" value="update" />';
 
 1216    print 
'<input type="hidden" name="rowid" value="'.$id.
'" />';
 
 1217    print 
'<input type="hidden" name="statut" value="'.$object->statut.
'" />';
 
 1219      print 
'<input type="hidden" name="backtopage" value="'.($backtopage != 
'1' ? $backtopage : $_SERVER[
"HTTP_REFERER"]).
'">';
 
 1224    print 
'<table class="border centpercent">';
 
 1227    print 
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Ref").
'</td><td class="valeur">'.$object->ref.
'</td></tr>';
 
 1230    if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
 
 1231      print 
'<tr><td><span class="fieldrequired">'.$langs->trans(
"Login").
' / '.$langs->trans(
"Id").
'</span></td><td><input type="text" name="login" class="minwidth300" maxlength="50" value="'.(GETPOSTISSET(
"login") ? 
GETPOST(
"login", 
'alphanohtml', 2) : $object->login).
'"></td></tr>';
 
 1235    if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
 
 1236      print 
'<tr><td class="fieldrequired">'.$langs->trans(
"Password").
'</td><td><input type="password" name="pass" class="minwidth300" maxlength="50" value="'.
dol_escape_htmltag(GETPOSTISSET(
"pass") ? 
GETPOST(
"pass", 
'none', 2) : 
'').
'"></td></tr>';
 
 1240    print 
'<tr><td class="fieldrequired">'.$langs->trans(
"Type").
'</td><td>';
 
 1241    if ($user->hasRight(
'adherent', 
'creer')) {
 
 1242      print $form->selectarray(
"typeid", $adht->liste_array(), (GETPOSTISSET(
"typeid") ? 
GETPOST(
"typeid", 
'int') : $object->typeid), 0, 0, 0, 
'', 0, 0, 0, 
'', 
'', 1);
 
 1244      print $adht->getNomUrl(1);
 
 1245      print 
'<input type="hidden" name="typeid" value="'.$object->typeid.
'">';
 
 1250    $morphys[
"phy"] = $langs->trans(
"Physical");
 
 1251    $morphys[
"mor"] = $langs->trans(
"Moral");
 
 1252    print 
'<tr><td><span class="fieldrequired">'.$langs->trans(
"MemberNature").
'</span></td><td>';
 
 1253    print $form->selectarray(
"morphy", $morphys, (GETPOSTISSET(
"morphy") ? 
GETPOST(
"morphy", 
'alpha') : $object->morphy), 0, 0, 0, 
'', 0, 0, 0, 
'', 
'', 1);
 
 1257    print 
'<tr><td id="tdcompany">'.$langs->trans(
"Company").
'</td><td><input type="text" name="societe" class="minwidth300" maxlength="128" value="'.(GETPOSTISSET(
"societe") ? 
GETPOST(
"societe", 
'alphanohtml', 2) : $object->company).
'"></td></tr>';
 
 1260    print 
'<tr><td>'.$langs->trans(
"UserTitle").
'</td><td>';
 
 1261    print $formcompany->select_civility(GETPOSTISSET(
"civility_id") ? 
GETPOST(
"civility_id", 
'alpha') : $object->civility_id, 
'civility_id', 
'maxwidth150', 1);
 
 1266    print 
'<tr><td id="tdlastname">'.$langs->trans(
"Lastname").
'</td><td><input type="text" name="lastname" class="minwidth300" maxlength="50" value="'.(GETPOSTISSET(
"lastname") ? 
GETPOST(
"lastname", 
'alphanohtml', 2) : $object->lastname).
'"></td>';
 
 1270    print 
'<tr><td id="tdfirstname">'.$langs->trans(
"Firstname").
'</td><td><input type="text" name="firstname" class="minwidth300" maxlength="50" value="'.(GETPOSTISSET(
"firstname") ? 
GETPOST(
"firstname", 
'alphanohtml', 3) : $object->firstname).
'"></td>';
 
 1274    print 
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
 
 1276    $arraygender = array(
'man'=>$langs->trans(
"Genderman"), 
'woman'=>$langs->trans(
"Genderwoman"), 
'other'=>$langs->trans(
"Genderother"));
 
 1277    print $form->selectarray(
'gender', $arraygender, GETPOSTISSET(
'gender') ? 
GETPOST(
'gender', 
'alphanohtml') : $object->gender, 1, 0, 0, 
'', 0, 0, 0, 
'', 
'', 1);
 
 1281    print 
'<tr><td>'.$langs->trans(
"Photo").
'</td>';
 
 1282    print 
'<td class="hideonsmartphone" valign="middle">';
 
 1283    print $form->showphoto(
'memberphoto', $object).
"\n";
 
 1284    if ($caneditfieldmember) {
 
 1285      if ($object->photo) {
 
 1288      print 
'<table class="nobordernopadding">';
 
 1289      if ($object->photo) {
 
 1290        print 
'<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> '.$langs->trans(
"Delete").
'<br><br></td></tr>';
 
 1292      print 
'<tr><td>'.$langs->trans(
"PhotoFile").
'</td></tr>';
 
 1295      $maxmin = $maxfilesizearray[
'maxmin'];
 
 1297        print 
'<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).
'">';  
 
 1299      print 
'<input type="file" class="flat" name="photo" id="photoinput">';
 
 1306    print 
'<tr><td>'.(getDolGlobalString(
"ADHERENT_MAIL_REQUIRED") ? 
'<span class="fieldrequired">' : 
'').$langs->trans(
"EMail").(getDolGlobalString(
"ADHERENT_MAIL_REQUIRED") ? 
'</span>' : 
'').
'</td>';
 
 1307    print 
'<td>'.img_picto(
'', 
'object_email', 
'class="pictofixedwidth"').
'<input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(GETPOSTISSET(
"member_email") ? 
GETPOST(
"member_email", 
'', 2) : $object->email).
'"></td></tr>';
 
 1310    print 
'<tr><td>'.$form->editfieldkey(
'Web', 
'member_url', 
GETPOST(
'member_url', 
'alpha'), $object, 0).
'</td>';
 
 1311    print 
'<td>'.img_picto(
'', 
'globe', 
'class="pictofixedwidth"').
'<input type="text" name="member_url" id="member_url" class="maxwidth200onsmartphone maxwidth500 widthcentpercentminusx " value="'.(GETPOSTISSET(
'member_url') ?
GETPOST(
'member_url', 
'alpha') : $object->url).
'"></td></tr>';
 
 1314    print 
'<tr><td>'.$langs->trans(
"Address").
'</td><td>';
 
 1315    print 
'<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_2.
'">'.(GETPOSTISSET(
"address") ? 
GETPOST(
"address", 
'alphanohtml', 2) : $object->address).
'</textarea>';
 
 1319    print 
'<tr><td>'.$langs->trans(
"Zip").
' / '.$langs->trans(
"Town").
'</td><td>';
 
 1320    print $formcompany->select_ziptown((GETPOSTISSET(
"zipcode") ? 
GETPOST(
"zipcode", 
'alphanohtml', 2) : $object->zip), 
'zipcode', array(
'town', 
'selectcountry_id', 
'state_id'), 6);
 
 1322    print $formcompany->select_ziptown((GETPOSTISSET(
"town") ? 
GETPOST(
"town", 
'alphanohtml', 2) : $object->town), 
'town', array(
'zipcode', 
'selectcountry_id', 
'state_id'));
 
 1327    print 
'<tr><td>'.$langs->trans(
'Country').
'</td><td>';
 
 1328    print 
img_picto(
'', 
'country', 
'class="pictofixedwidth"');
 
 1329    print $form->select_country(GETPOSTISSET(
"country_id") ? 
GETPOST(
"country_id", 
"alpha") : $object->country_id, 
'country_id');
 
 1331      print 
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
 
 1336    if (empty($conf->global->MEMBER_DISABLE_STATE)) {
 
 1337      print 
'<tr><td>'.$langs->trans(
'State').
'</td><td>';
 
 1338      print 
img_picto(
'', 
'state', 
'class="pictofixedwidth"');
 
 1339      print $formcompany->select_state($object->state_id, GETPOSTISSET(
"country_id") ? 
GETPOST(
"country_id", 
"alpha") : $object->country_id);
 
 1344    print 
'<tr><td>'.$langs->trans(
"PhonePro").
'</td>';
 
 1345    print 
'<td>'.img_picto(
'', 
'object_phoning', 
'class="pictofixedwidth"').
'<input type="text" name="phone" value="'.(GETPOSTISSET(
"phone") ? 
GETPOST(
"phone") : $object->phone).
'"></td></tr>';
 
 1348    print 
'<tr><td>'.$langs->trans(
"PhonePerso").
'</td>';
 
 1349    print 
'<td>'.img_picto(
'', 
'object_phoning', 
'class="pictofixedwidth"').
'<input type="text" name="phone_perso" value="'.(GETPOSTISSET(
"phone_perso") ? 
GETPOST(
"phone_perso") : $object->phone_perso).
'"></td></tr>';
 
 1352    print 
'<tr><td>'.$langs->trans(
"PhoneMobile").
'</td>';
 
 1353    print 
'<td>'.img_picto(
'', 
'object_phoning_mobile', 
'class="pictofixedwidth"').
'<input type="text" name="phone_mobile" value="'.(GETPOSTISSET(
"phone_mobile") ? 
GETPOST(
"phone_mobile") : $object->phone_mobile).
'"></td></tr>';
 
 1355    if (isModEnabled(
'socialnetworks')) {
 
 1356      foreach ($socialnetworks as $key => $value) {
 
 1357        if (!$value[
'active']) {
 
 1360        print 
'<tr><td>'.$langs->trans($value[
'label']).
'</td><td><input type="text" name="'.$key.
'" class="minwidth100" value="'.(GETPOSTISSET($key) ? 
GETPOST($key, 
'alphanohtml') : (isset($object->socialnetworks[$key])? $object->socialnetworks[$key] : null)).
'"></td></tr>';
 
 1365    print 
"<tr><td>".$langs->trans(
"DateOfBirth").
"</td><td>\n";
 
 1366    print $form->selectDate(($object->birth ? $object->birth : -1), 
'birth', 
'', 
'', 1, 
'formsoc');
 
 1367    print 
"</td></tr>\n";
 
 1371      print 
'<tr><td>'.$form->editfieldkey(
'DefaultLang', 
'default_lang', 
'', $object, 0).
'</td><td colspan="3">'.
"\n";
 
 1372      print 
img_picto(
'', 
'language').$formadmin->select_language($object->default_lang, 
'default_lang', 0, 0, 1);
 
 1378    print 
"<tr><td>".$langs->trans(
"Public", 
getDolGlobalString(
'MAIN_INFO_SOCIETE_NOM'), $linkofpubliclist).
"</td><td>\n";
 
 1379    print $form->selectyesno(
"public", (GETPOSTISSET(
"public") ? 
GETPOST(
"public", 
'alphanohtml', 2) : $object->public), 1);
 
 1380    print 
"</td></tr>\n";
 
 1383    if (isModEnabled(
'categorie') && $user->hasRight(
'categorie', 
'lire')) {
 
 1384      print 
'<tr><td>'.$form->editfieldkey(
"Categories", 
'memcats', 
'', $object, 0).
'</td>';
 
 1386      $cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, 
null, 
null, 
null, 
null, 1);
 
 1388      $cats = $c->containing($object->id, Categorie::TYPE_MEMBER);
 
 1389      $arrayselected = array();
 
 1390      if (is_array($cats)) {
 
 1391        foreach ($cats as $cat) {
 
 1392          $arrayselected[] = $cat->id;
 
 1395      print $form->multiselectarray(
'memcats', $cate_arbo, $arrayselected, 
'', 0, 
'', 0, 
'100%');
 
 1400    if (isModEnabled(
'societe')) {
 
 1401      print 
'<tr><td>'.$langs->trans(
"LinkedToDolibarrThirdParty").
'</td><td colspan="2" class="valeur">';
 
 1402      if ($object->socid) {
 
 1404        $result = $company->fetch($object->socid);
 
 1405        print $company->getNomUrl(1);
 
 1407        print $langs->trans(
"NoThirdPartyAssociatedToMember");
 
 1413    print 
'<tr><td>'.$langs->trans(
"LinkedToDolibarrUser").
'</td><td colspan="2" class="valeur">';
 
 1414    if ($object->user_id) {
 
 1415      $form->form_users($_SERVER[
'PHP_SELF'].
'?rowid='.$object->id, $object->user_id, 
'none');
 
 1417      print $langs->trans(
"NoDolibarrAccess");
 
 1422    include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
 
 1427    print $form->buttonsSaveCancel(
"Save", 
'Cancel');
 
 1433  if ($id > 0 && $action != 
'edit') {
 
 1434    $res = $object->fetch($id);
 
 1438    $res = $object->fetch_optionals();
 
 1444    $res = $adht->fetch($object->typeid);
 
 1458    if ($action == 
'create_user') {
 
 1459      $login = (GETPOSTISSET(
'login') ? 
GETPOST(
'login', 
'alphanohtml') : $object->login);
 
 1460      if (empty($login)) {
 
 1462        include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
 
 1465      if (empty($login)) {
 
 1466        $login = strtolower(substr($object->firstname, 0, 4)).strtolower(substr($object->lastname, 0, 4));
 
 1470      $formquestion = array(
 
 1471          array(
'label' => $langs->trans(
"LoginToCreate"), 
'type' => 
'text', 
'name' => 
'login', 
'value' => $login)
 
 1473      if (isModEnabled(
'societe') && $object->socid > 0) {
 
 1474        $object->fetch_thirdparty();
 
 1475        $formquestion[] = array(
'label' => $langs->trans(
"UserWillBe"), 
'type' => 
'radio', 
'name' => 
'internalorexternal', 
'default'=>
'external', 
'values' => array(
'external'=>$langs->trans(
"External").
' - '.$langs->trans(
"LinkedToDolibarrThirdParty").
' '.$object->thirdparty->getNomUrl(1, 
'', 0, 1), 
'internal'=>$langs->trans(
"Internal")));
 
 1478      if (isModEnabled(
'societe') && $object->socid <= 0) {
 
 1479        $text .= $langs->trans(
"UserWillBeInternalUser").
'<br>';
 
 1481      $text .= $langs->trans(
"ConfirmCreateLogin");
 
 1482      print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?rowid=".$object->id, $langs->trans(
"CreateDolibarrLogin"), $text, 
"confirm_create_user", $formquestion, 
'yes');
 
 1486    if ($action == 
'create_thirdparty') {
 
 1488      $fullname = $object->getFullName($langs);
 
 1490      if ($object->morphy == 
'mor') {
 
 1491        $companyname = $object->company;
 
 1492        if (!empty($fullname)) {
 
 1493          $companyalias = $fullname;
 
 1496        $companyname = $fullname;
 
 1497        if (!empty($object->company)) {
 
 1498          $companyalias = $object->company;
 
 1503      $formquestion = array(
 
 1504        array(
'label' => $langs->trans(
"NameToCreate"), 
'type' => 
'text', 
'name' => 
'companyname', 
'value' => $companyname, 
'morecss' => 
'minwidth300', 
'moreattr' => 
'maxlength="128"'),
 
 1505        array(
'label' => $langs->trans(
"AliasNames"), 
'type' => 
'text', 
'name' => 
'companyalias', 
'value' => $companyalias, 
'morecss' => 
'minwidth300', 
'moreattr' => 
'maxlength="128"')
 
 1508      print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?rowid=".$object->id, $langs->trans(
"CreateDolibarrThirdParty"), $langs->trans(
"ConfirmCreateThirdParty"), 
"confirm_create_thirdparty", $formquestion, 
'yes');
 
 1512    if ($action == 
'valid') {
 
 1513      $langs->load(
"mails");
 
 1516      $adht->fetch($object->typeid);
 
 1522      include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
 
 1525      $outputlangs = 
new Translate(
'', $conf);
 
 1526      $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
 
 1528      $outputlangs->loadLangs(array(
"main", 
"members", 
"companies", 
"install", 
"other"));
 
 1530      $arraydefaultmessage = 
null;
 
 1533      if (!empty($labeltouse)) {
 
 1534        $arraydefaultmessage = $formmail->getEMailTemplate($db, 
'member', $user, $outputlangs, 0, 1, $labeltouse);
 
 1537      if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
 
 1538        $subject = $arraydefaultmessage->topic;
 
 1539        $msg = $arraydefaultmessage->content;
 
 1547      $tmp = $langs->trans(
"SendingAnEMailToMember");
 
 1548      $tmp .= 
'<br>'.$langs->trans(
"MailFrom").
': <b>'.
getDolGlobalString(
'ADHERENT_MAIL_FROM').
'</b>, ';
 
 1549      $tmp .= 
'<br>'.$langs->trans(
"MailRecipient").
': <b>'.$object->email.
'</b>';
 
 1551      $helpcontent .= 
'<b>'.$langs->trans(
"MailFrom").
'</b>: '.
getDolGlobalString(
'ADHERENT_MAIL_FROM').
'<br>'.
"\n";
 
 1552      $helpcontent .= 
'<b>'.$langs->trans(
"MailRecipient").
'</b>: '.$object->email.
'<br>'.
"\n";
 
 1553      $helpcontent .= 
'<b>'.$langs->trans(
"Subject").
'</b>:<br>'.
"\n";
 
 1554      $helpcontent .= $subjecttosend.
"\n";
 
 1555      $helpcontent .= 
"<br>";
 
 1556      $helpcontent .= 
'<b>'.$langs->trans(
"Content").
'</b>:<br>';
 
 1558      $label = $form->textwithpicto($tmp, $helpcontent, 1, 
'help');
 
 1561      $formquestion = array();
 
 1562      if ($object->email) {
 
 1563        $formquestion[] = array(
'type' => 
'checkbox', 
'name' => 
'send_mail', 
'label' => $label, 
'value' => (
getDolGlobalString(
'ADHERENT_DEFAULT_SENDINFOBYMAIL') ? 
true : false));
 
 1565      if (isModEnabled(
'mailman') && !empty($conf->global->ADHERENT_USE_MAILMAN)) {
 
 1566        $formquestion[] = array(
'type'=>
'other', 
'label'=>$langs->transnoentitiesnoconv(
"SynchroMailManEnabled"), 
'value'=>
'');
 
 1568      if (isModEnabled(
'mailman') && !empty($conf->global->ADHERENT_USE_SPIP)) {
 
 1569        $formquestion[] = array(
'type'=>
'other', 
'label'=>$langs->transnoentitiesnoconv(
"SynchroSpipEnabled"), 
'value'=>
'');
 
 1571      print $form->formconfirm(
"card.php?rowid=".$id, $langs->trans(
"ValidateMember"), $langs->trans(
"ConfirmValidateMember"), 
"confirm_valid", $formquestion, 
'yes', 1, 220);
 
 1575    if ($action == 
'resiliate') {
 
 1576      $langs->load(
"mails");
 
 1579      $adht->fetch($object->typeid);
 
 1585      include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
 
 1588      $outputlangs = 
new Translate(
'', $conf);
 
 1589      $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
 
 1591      $outputlangs->loadLangs(array(
"main", 
"members"));
 
 1593      $arraydefaultmessage = 
null;
 
 1596      if (!empty($labeltouse)) {
 
 1597        $arraydefaultmessage = $formmail->getEMailTemplate($db, 
'member', $user, $outputlangs, 0, 1, $labeltouse);
 
 1600      if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
 
 1601        $subject = $arraydefaultmessage->topic;
 
 1602        $msg     = $arraydefaultmessage->content;
 
 1610      $tmp = $langs->trans(
"SendingAnEMailToMember");
 
 1611      $tmp .= 
'<br>('.$langs->trans(
"MailFrom").
': <b>'.
getDolGlobalString(
'ADHERENT_MAIL_FROM').
'</b>, ';
 
 1612      $tmp .= $langs->trans(
"MailRecipient").
': <b>'.$object->email.
'</b>)';
 
 1614      $helpcontent .= 
'<b>'.$langs->trans(
"MailFrom").
'</b>: '.
getDolGlobalString(
'ADHERENT_MAIL_FROM').
'<br>'.
"\n";
 
 1615      $helpcontent .= 
'<b>'.$langs->trans(
"MailRecipient").
'</b>: '.$object->email.
'<br>'.
"\n";
 
 1616      $helpcontent .= 
'<b>'.$langs->trans(
"Subject").
'</b>:<br>'.
"\n";
 
 1617      $helpcontent .= $subjecttosend.
"\n";
 
 1618      $helpcontent .= 
"<br>";
 
 1619      $helpcontent .= 
'<b>'.$langs->trans(
"Content").
'</b>:<br>';
 
 1621      $label = $form->textwithpicto($tmp, $helpcontent, 1, 
'help');
 
 1624      $formquestion = array();
 
 1625      if ($object->email) {
 
 1626        $formquestion[] = array(
'type' => 
'checkbox', 
'name' => 
'send_mail', 
'label' => $label, 
'value' => (!empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL) ? 
'true' : 
'false'));
 
 1629        $formquestion[] = array(
'type' => 
'hidden', 
'name' => 
'backtopage', 
'value' => ($backtopage != 
'1' ? $backtopage : $_SERVER[
"HTTP_REFERER"]));
 
 1631      print $form->formconfirm(
"card.php?rowid=".$id, $langs->trans(
"ResiliateMember"), $langs->trans(
"ConfirmResiliateMember"), 
"confirm_resiliate", $formquestion, 
'no', 1, 240);
 
 1635    if ($action == 
'exclude') {
 
 1636      $langs->load(
"mails");
 
 1639      $adht->fetch($object->typeid);
 
 1645      include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
 
 1648      $outputlangs = 
new Translate(
'', $conf);
 
 1649      $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
 
 1651      $outputlangs->loadLangs(array(
"main", 
"members"));
 
 1653      $arraydefaultmessage = 
null;
 
 1656      if (!empty($labeltouse)) {
 
 1657        $arraydefaultmessage = $formmail->getEMailTemplate($db, 
'member', $user, $outputlangs, 0, 1, $labeltouse);
 
 1660      if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
 
 1661        $subject = $arraydefaultmessage->topic;
 
 1662        $msg     = $arraydefaultmessage->content;
 
 1670      $tmp = $langs->trans(
"SendingAnEMailToMember");
 
 1671      $tmp .= 
'<br>('.$langs->trans(
"MailFrom").
': <b>'.
getDolGlobalString(
'ADHERENT_MAIL_FROM').
'</b>, ';
 
 1672      $tmp .= $langs->trans(
"MailRecipient").
': <b>'.$object->email.
'</b>)';
 
 1674      $helpcontent .= 
'<b>'.$langs->trans(
"MailFrom").
'</b>: '.
getDolGlobalString(
'ADHERENT_MAIL_FROM').
'<br>'.
"\n";
 
 1675      $helpcontent .= 
'<b>'.$langs->trans(
"MailRecipient").
'</b>: '.$object->email.
'<br>'.
"\n";
 
 1676      $helpcontent .= 
'<b>'.$langs->trans(
"Subject").
'</b>:<br>'.
"\n";
 
 1677      $helpcontent .= $subjecttosend.
"\n";
 
 1678      $helpcontent .= 
"<br>";
 
 1679      $helpcontent .= 
'<b>'.$langs->trans(
"Content").
'</b>:<br>';
 
 1681      $label = $form->textwithpicto($tmp, $helpcontent, 1, 
'help');
 
 1684      $formquestion = array();
 
 1685      if ($object->email) {
 
 1686        $formquestion[] = array(
'type' => 
'checkbox', 
'name' => 
'send_mail', 
'label' => $label, 
'value' => (!empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL) ? 
'true' : 
'false'));
 
 1689        $formquestion[] = array(
'type' => 
'hidden', 
'name' => 
'backtopage', 
'value' => ($backtopage != 
'1' ? $backtopage : $_SERVER[
"HTTP_REFERER"]));
 
 1691      print $form->formconfirm(
"card.php?rowid=".$id, $langs->trans(
"ExcludeMember"), $langs->trans(
"ConfirmExcludeMember"), 
"confirm_exclude", $formquestion, 
'no', 1, 240);
 
 1695    if ($action == 
'delete') {
 
 1696      $formquestion = array();
 
 1698        $formquestion[] = array(
'type' => 
'hidden', 
'name' => 
'backtopage', 
'value' => ($backtopage != 
'1' ? $backtopage : $_SERVER[
"HTTP_REFERER"]));
 
 1700      print $form->formconfirm(
"card.php?rowid=".$id, $langs->trans(
"DeleteMember"), $langs->trans(
"ConfirmDeleteMember"), 
"confirm_delete", $formquestion, 
'no', 1);
 
 1704    if ($action == 
'add_spip') {
 
 1705      print $form->formconfirm(
"card.php?rowid=".$id, $langs->trans(
'AddIntoSpip'), $langs->trans(
'AddIntoSpipConfirmation'), 
'confirm_add_spip');
 
 1708    if ($action == 
'del_spip') {
 
 1709      print $form->formconfirm(
"card.php?rowid=$id", $langs->trans(
'DeleteIntoSpip'), $langs->trans(
'DeleteIntoSpipConfirmation'), 
'confirm_del_spip');
 
 1713    if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
 
 1716    if (isModEnabled(
'societe')) {
 
 1720    $linkback = 
'<a href="'.DOL_URL_ROOT.
'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
 
 1722    $morehtmlref = 
'<a href="'.DOL_URL_ROOT.
'/adherents/vcard.php?id='.$object->id.
'" class="refid">';
 
 1723    $morehtmlref .= 
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"), 
'vcard.png', 
'class="valignmiddle marginleftonly paddingrightonly"');
 
 1724    $morehtmlref .= 
'</a>';
 
 1727    dol_banner_tab($object, 
'rowid', $linkback, 1, 
'rowid', 
'ref', $morehtmlref);
 
 1729    print 
'<div class="fichecenter">';
 
 1730    print 
'<div class="fichehalfleft">';
 
 1732    print 
'<div class="underbanner clearboth"></div>';
 
 1733    print 
'<table class="border tableforfield centpercent">';
 
 1736    if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
 
 1737      print 
'<tr><td class="titlefield">'.$langs->trans(
"Login").
' / '.$langs->trans(
"Id").
'</td><td class="valeur">'.
dol_escape_htmltag($object->login).
'</td></tr>';
 
 1741    print 
'<tr><td class="titlefield">'.$langs->trans(
"Type").
'</td>';
 
 1742    print 
'<td class="valeur">'.$adht->getNomUrl(1).
"</td></tr>\n";
 
 1745    print 
'<tr><td>'.$langs->trans(
"MemberNature").
'</td>';
 
 1746    print 
'<td class="valeur" >'.$object->getmorphylib(
'', 1).
'</td>';
 
 1750    print 
'<tr><td>'.$langs->trans(
"Company").
'</td><td class="valeur">'.
dol_escape_htmltag($object->company).
'</td></tr>';
 
 1753    print 
'<tr><td>'.$langs->trans(
"UserTitle").
'</td><td class="valeur">'.$object->getCivilityLabel().
'</td>';
 
 1757    if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
 
 1758      print 
'<tr><td>'.$langs->trans(
"Password").
'</td><td>';
 
 1759      if ($object->pass) {
 
 1760        print preg_replace(
'/./i', 
'*', $object->pass);
 
 1763          print 
'<!-- '.$langs->trans(
"Crypted").
': '.$object->pass_indatabase_crypted.
' -->';
 
 1765        print 
'<span class="opacitymedium">'.$langs->trans(
"Hidden").
'</span>';
 
 1767      if (!empty($object->pass_indatabase) && empty($object->user_id)) {  
 
 1768        $langs->load(
"errors");
 
 1769        $htmltext = $langs->trans(
"WarningPasswordSetWithNoAccount");
 
 1770        print 
' '.$form->textwithpicto(
'', $htmltext, 1, 
'warning');
 
 1776    print 
'<tr><td>'.$langs->trans(
"SubscriptionEndDate").
'</td><td class="valeur">';
 
 1777    if ($object->datefin) {
 
 1779      if ($object->hasDelay()) {
 
 1780        print 
" ".img_warning($langs->trans(
"Late"));
 
 1783      if ($object->need_subscription == 0) {
 
 1784        print $langs->trans(
"SubscriptionNotNeeded");
 
 1785      } elseif (!$adht->subscription) {
 
 1786        print $langs->trans(
"SubscriptionNotRecorded");
 
 1788          print 
" ".img_warning($langs->trans(
"Late")); 
 
 1791        print $langs->trans(
"SubscriptionNotReceived");
 
 1793          print 
" ".img_warning($langs->trans(
"Late")); 
 
 1803    print 
'<div class="fichehalfright">';
 
 1804    print 
'<div class="underbanner clearboth"></div>';
 
 1806    print 
'<table class="border tableforfield centpercent">';
 
 1809    if (isModEnabled(
'categorie') && $user->hasRight(
'categorie', 
'lire')) {
 
 1810      print 
'<tr><td>'.$langs->trans(
"Categories").
'</td>';
 
 1811      print 
'<td colspan="2">';
 
 1812      print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1);
 
 1817    print 
'<tr><td class="titlefield">'.$langs->trans(
"DateOfBirth").
'</td><td class="valeur">'.
dol_print_date($object->birth, 
'day').
'</td></tr>';
 
 1821      require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
 
 1822      print 
'<tr><td>'.$langs->trans(
"DefaultLang").
'</td><td>';
 
 1825      $langs->load(
"languages");
 
 1826      $labellang = ($object->default_lang ? $langs->trans(
'Language_'.$object->default_lang) : 
'');
 
 1827      print 
picto_from_langcode($object->default_lang, 
'class="paddingrightonly saturatemedium opacitylow"');
 
 1833    print 
'<tr><td>'.$langs->trans(
"Public", 
getDolGlobalString(
'MAIN_INFO_SOCIETE_NOM'), $linkofpubliclist).
'</td><td class="valeur">'.
yn($object->public).
'</td></tr>';
 
 1836    include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
 
 1839    if (isModEnabled(
'societe')) {
 
 1841      $editenable = $user->hasRight(
'adherent', 
'creer');
 
 1842      print $form->editfieldkey(
'LinkedToDolibarrThirdParty', 
'thirdparty', 
'', $object, $editenable);
 
 1843      print 
'</td><td colspan="2" class="valeur">';
 
 1844      if ($action == 
'editthirdparty') {
 
 1845        $htmlname = 
'socid';
 
 1846        print 
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'" name="form'.$htmlname.
'">';
 
 1847        print 
'<input type="hidden" name="rowid" value="'.$object->id.
'">';
 
 1848        print 
'<input type="hidden" name="action" value="set'.$htmlname.
'">';
 
 1849        print 
'<input type="hidden" name="token" value="'.newToken().
'">';
 
 1850        print 
'<table class="nobordernopadding">';
 
 1852        print $form->select_company($object->socid, 
'socid', 
'', 1);
 
 1854        print 
'<td class="left"><input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
 
 1855        print 
'</tr></table></form>';
 
 1857        if ($object->socid) {
 
 1859          $result = $company->fetch($object->socid);
 
 1860          print $company->getNomUrl(1);
 
 1863          $tmparray = $company->getOutstandingBills(
'customer');
 
 1864          if (!empty($tmparray[
'refs'])) {
 
 1865            print 
' - '.img_picto($langs->trans(
"Invoices"), 
'bill', 
'class="paddingright"').
'<a href="'.DOL_URL_ROOT.
'/compta/facture/list.php?socid='.$object->socid.
'">'.$langs->trans(
"Invoices").
' ('.count($tmparray[
'refs']).
')';
 
 1870          print 
'<span class="opacitymedium">'.$langs->trans(
"NoThirdPartyAssociatedToMember").
'</span>';
 
 1878    $editenable = $user->hasRight(
'adherent', 
'creer') && $user->hasRight(
'user', 
'user', 
'creer');
 
 1879    print $form->editfieldkey(
'LinkedToDolibarrUser', 
'login', 
'', $object, $editenable);
 
 1880    print 
'</td><td colspan="2" class="valeur">';
 
 1881    if ($action == 
'editlogin') {
 
 1882      $form->form_users($_SERVER[
'PHP_SELF'].
'?rowid='.$object->id, $object->user_id, 
'userid', 
'');
 
 1884      if ($object->user_id) {
 
 1885        $linkeduser = 
new User($db);
 
 1886        $linkeduser->fetch($object->user_id);
 
 1887        print $linkeduser->getNomUrl(-1);
 
 1889        print 
'<span class="opacitymedium">'.$langs->trans(
"NoDolibarrAccess").
'</span>';
 
 1896    print 
"</div></div>\n";
 
 1897    print 
'<div class="clearboth"></div>';
 
 1906    print 
'<div class="tabsAction">';
 
 1908    $parameters = array();
 
 1909    $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action); 
 
 1910    if (empty($reshook)) {
 
 1911      if ($action != 
'editlogin' && $action != 
'editthirdparty') {
 
 1913        if (empty($user->socid)) {
 
 1915            print 
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.((int) $object->id).
'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans(
'SendMail').
'</a>'.
"\n";
 
 1934        if ($user->hasRight(
'adherent', 
'creer')) {
 
 1935          print 
'<a class="butAction" href="card.php?rowid='.((int) $object->id).
'&action=edit&token='.newToken().
'">'.$langs->trans(
"Modify").
'</a>'.
"\n";
 
 1937          print 
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Modify").
'</span>'.
"\n";
 
 1942          if ($user->hasRight(
'adherent', 
'creer')) {
 
 1943            print 
'<a class="butAction" href="card.php?rowid='.((int) $object->id).
'&action=valid&token='.newToken().
'">'.$langs->trans(
"Validate").
'</a>'.
"\n";
 
 1945            print 
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Validate").
'</span>'.
"\n";
 
 1951          if ($user->hasRight(
'adherent', 
'creer')) {
 
 1952            print 
'<a class="butAction" href="card.php?rowid='.((int) $object->id).
'&action=valid">'.$langs->trans(
"Reenable").
"</a>\n";
 
 1954            print 
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Reenable").
'</span>'.
"\n";
 
 1960          if ($user->hasRight(
'adherent', 
'supprimer')) {
 
 1961            print 
'<a class="butAction" href="card.php?rowid='.((int) $object->id).
'&action=resiliate">'.$langs->trans(
"Resiliate").
"</a></span>\n";
 
 1963            print 
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Resiliate").
'</span>'.
"\n";
 
 1969          if ($user->hasRight(
'adherent', 
'supprimer')) {
 
 1970            print 
'<a class="butAction" href="card.php?rowid='.((int) $object->id).
'&action=exclude">'.$langs->trans(
"Exclude").
"</a></span>\n";
 
 1972            print 
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Exclude").
'</span>'.
"\n";
 
 1977        if (isModEnabled(
'societe') && !$object->socid) {
 
 1978          if ($user->hasRight(
'societe', 
'creer')) {
 
 1980              print 
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?rowid='.((int) $object->id).
'&action=create_thirdparty" title="'.
dol_escape_htmltag($langs->trans(
"CreateDolibarrThirdPartyDesc")).
'">'.$langs->trans(
"CreateDolibarrThirdParty").
'</a>'.
"\n";
 
 1982              print 
'<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"ValidateBefore")).
'">'.$langs->trans(
"CreateDolibarrThirdParty").
'</a>'.
"\n";
 
 1985            print 
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"CreateDolibarrThirdParty").
'</span>'.
"\n";
 
 1990        if (!$user->socid && !$object->user_id) {
 
 1991          if ($user->hasRight(
'user', 
'user', 
'creer')) {
 
 1993              print 
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?rowid='.((int) $object->id).
'&action=create_user" title="'.
dol_escape_htmltag($langs->trans(
"CreateDolibarrLoginDesc")).
'">'.$langs->trans(
"CreateDolibarrLogin").
'</a>'.
"\n";
 
 1995              print 
'<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"ValidateBefore")).
'">'.$langs->trans(
"CreateDolibarrLogin").
'</a>'.
"\n";
 
 1998            print 
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"CreateDolibarrLogin").
'</span>'.
"\n";
 
 2003        if (isModEnabled(
'mailmanspip') && !empty($conf->global->ADHERENT_USE_SPIP)) {
 
 2004          $isinspip = $mailmanspip->is_in_spip($object);
 
 2006          if ($isinspip == 1) {
 
 2007            print 
'<a class="butAction" href="card.php?rowid='.((int) $object->id).
'&action=del_spip&token='.newToken().
'">'.$langs->trans(
"DeleteIntoSpip").
'</a>'.
"\n";
 
 2009          if ($isinspip == 0) {
 
 2010            print 
'<a class="butAction" href="card.php?rowid='.((int) $object->id).
'&action=add_spip&token='.newToken().
'">'.$langs->trans(
"AddIntoSpip").
'</a>'.
"\n";
 
 2015        if ($user->hasRight(
'adherent', 
'supprimer')) {
 
 2016          print 
'<a class="butActionDelete" href="card.php?rowid='.((int) $object->id).
'&action=delete&token='.newToken().
'">'.$langs->trans(
"Delete").
'</a>'.
"\n";
 
 2018          print 
'<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
"Delete").
'</span>'.
"\n";
 
 2024    if ($isinspip == -1) {
 
 2025      print 
'<br><br><span class="error">'.$langs->trans(
'SPIPConnectionFailed').
': '.$mailmanspip->error.
'</span>';
 
 2030    if (
GETPOST(
'modelselected')) {
 
 2031      $action = 
'presend';
 
 2034    if ($action != 
'presend') {
 
 2035      print 
'<div class="fichecenter"><div class="fichehalfleft">';
 
 2036      print 
'<a name="builddoc"></a>'; 
 
 2040      $filedir = $conf->adherent->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $object, 
'member');
 
 2041      $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$object->id;
 
 2042      $genallowed = $user->hasRight(
'adherent', 
'lire');
 
 2043      $delallowed = $user->hasRight(
'adherent', 
'creer');
 
 2045      print $formfile->showdocuments(
'member', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, 
'', 
'', 
'', (empty($object->default_lang) ? 
'' : $object->default_lang), 
'', $object);
 
 2046      $somethingshown = $formfile->numoffiles;
 
 2060      $useonlinepayment = (isModEnabled(
'paypal') || isModEnabled(
'stripe') || isModEnabled(
'paybox'));
 
 2062      if ($useonlinepayment) {
 
 2064        if (empty($amount)) {   
 
 2065          $amount = max($adht->amount, $object->first_subscription_amount, $object->last_subscription_amount);
 
 2067        if (empty($amount)) {
 
 2070        require_once DOL_DOCUMENT_ROOT.
'/core/lib/payments.lib.php';
 
 2071        print showOnlinePaymentUrl(
'membersubscription', $object->ref, $amount);
 
 2074      print 
'</div><div class="fichehalfright">';
 
 2078      $morehtmlcenter = 
dolGetButtonTitle($langs->trans(
'SeeAll'), 
'', 
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/adherents/agenda.php?id='.$object->id);
 
 2081      include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
 
 2083      $somethingshown = 
$formactions->showactions($object, $object->element, $socid, 1, 
'listactions', $MAX, 
'', $morehtmlcenter);
 
 2085      print 
'</div></div>';
 
 2089    $modelmail = 
'member';
 
 2090    $defaulttopic = 
'CardContent';
 
 2091    $diroutput = $conf->adherent->dir_output;
 
 2092    $trackid = 
'mem'.$object->id;
 
 2094    include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
 
if(preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) if(preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) if($action=='set') elseif( $action=='specimen') elseif($action=='setmodel') elseif( $action=='del') elseif($action=='setdoc') $formactions
View.
 
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
 
Class to manage members of a foundation.
 
const STATUS_EXCLUDED
Excluded.
 
const STATUS_DRAFT
Draft status.
 
const STATUS_RESILIATED
Resiliated.
 
const STATUS_VALIDATED
Validated status.
 
Class to manage members type.
 
Class to manage categories.
 
Class to manage mailman and spip.
 
Class to manage third parties objects (customers, suppliers, prospects...)
 
Class to manage translations.
 
Class to manage Dolibarr users.
 
getCountry($searchkey, $withcode='', $dbtouse=0, $outputlangs='', $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
 
dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0, $indexdatabase=1, $nolog=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories)
 
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
 
dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $varfiles='addedfile', $upload_dir='')
Make control on an uploaded file from an GUI page and move it to final destination.
 
dol_buildlogin($lastname, $firstname)
Build a login from lastname, firstname.
 
isValidUrl($url, $http=0, $pass=0, $port=0, $path=0, $query=0, $anchor=0)
Url string validation <http[s]> :// [user[:pass]@] hostname [port] [/path] [?getquery] [anchor].
 
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
 
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
 
picto_from_langcode($codelang, $moreatt='', $notitlealt=0)
Return img flag of country for a language code or country code.
 
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
 
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
 
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
 
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
 
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
 
dol_get_fiche_end($notab=0)
Return tab footer of a card.
 
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
 
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
 
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
 
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
 
dol_concatdesc($text1, $text2, $forxml=false, $invert=false)
Concat 2 descriptions with a new line between them (second operand after first one with appropriate n...
 
complete_substitutions_array(&$substitutionarray, $outputlangs, $object=null, $parameters=null, $callfunc="completesubstitutionarray")
Complete the $substitutionarray with more entries coming from external module that had set the "subst...
 
make_substitutions($text, $substitutionarray, $outputlangs=null, $converttextinhtmlifnecessary=0)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
 
getArrayOfSocialNetworks()
Get array of social network dictionary.
 
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
 
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
 
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
 
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
 
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
 
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null, $include=null)
Return array of possible common substitutions.
 
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
 
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
 
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
 
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
 
image_format_supported($file, $acceptsvg=0)
Return if a filename is file name of a supported image format.
 
member_prepare_head(Adherent $object)
Return array head with list of tabs to view object informations.
 
$conf db name
Only used if Module[ID]Name translation string is not found.
 
getRandomPassword($generic=false, $replaceambiguouschars=null, $length=32)
Return a generated password using default module.
 
getMaxFileSizeArray()
Return the max allowed for file upload.
 
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
 
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.