diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index b10e1dc3f05d8..f4495fb2bcbb1 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -8,6 +8,7 @@ * Copyright (C) 2015-2018 Alexandre Spangaro * Copyright (C) 2018-2022 Frédéric France * Copyright (C) 2021 Waël Almoman + * Copyright (C) 2022-2023 Udo Tamm * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,38 +37,46 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; -require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; -require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; -require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; +require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; +require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; + +if (isModEnabled('banque')) { + require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; +} + +if (isModEnabled('categorie')) { + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +} // Load translation files required by the page -$langs->loadLangs(array("companies", "bills", "members", "users", "other", "paypal")); +$langs->loadLangs(array('bills', 'companies', 'members', 'other', 'users')); + +if (isModEnabled('paypal')) { + $langs->load('paypal'); +} // Get parameters -$action = GETPOST('action', 'aZ09'); -$cancel = GETPOST('cancel', 'alpha'); +$action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); -$rowid = GETPOST('rowid', 'int'); -$id = GETPOST('id') ?GETPOST('id', 'int') : $rowid; -$typeid = GETPOST('typeid', 'int'); -$userid = GETPOST('userid', 'int'); -$socid = GETPOST('socid', 'int'); -$ref = GETPOST('ref', 'alpha'); +$rowid = GETPOST('rowid', 'int'); +$id = GETPOST('id') ?GETPOST('id', 'int') : $rowid; +$typeid = GETPOST('typeid', 'int'); +$userid = GETPOST('userid', 'int'); +$socid = GETPOST('socid', 'int'); +$ref = GETPOST('ref', 'alpha'); if (isModEnabled('mailmanspip')) { include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php'; - $langs->load('mailmanspip'); - $mailmanspip = new MailmanSpip($db); } @@ -259,12 +268,12 @@ if (GETPOST("birthday", 'int') && GETPOST("birthmonth", 'int') && GETPOST("birthyear", 'int')) { $birthdate = dol_mktime(12, 0, 0, GETPOST("birthmonth", 'int'), GETPOST("birthday", 'int'), GETPOST("birthyear", 'int')); } - $lastname = GETPOST("lastname", 'alphanohtml'); + $lastname = GETPOST("lastname", 'alphanohtml'); $firstname = GETPOST("firstname", 'alphanohtml'); - $gender = GETPOST("gender", 'alphanohtml'); - $societe = GETPOST("societe", 'alphanohtml'); - $morphy = GETPOST("morphy", 'alphanohtml'); - $login = GETPOST("login", 'alphanohtml'); + $gender = GETPOST("gender", 'alphanohtml'); + $societe = GETPOST("societe", 'alphanohtml'); + $morphy = GETPOST("morphy", 'alphanohtml'); + $login = GETPOST("login", 'alphanohtml'); if ($morphy != 'mor' && empty($lastname)) { $error++; $langs->load("errors"); @@ -280,6 +289,7 @@ $langs->load("errors"); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Company")), null, 'errors'); } + // Check if the login already exists if (!getDolGlobalString('ADHERENT_LOGIN_NOT_REQUIRED')) { if (empty($login)) { @@ -287,6 +297,7 @@ setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login")), null, 'errors'); } } + // Create new object if ($result > 0 && !$error) { $object->oldcopy = dol_clone($object, 2); @@ -310,11 +321,11 @@ $object->state_id = GETPOST("state_id", 'int'); $object->country_id = GETPOST("country_id", 'int'); - $object->phone = trim(GETPOST("phone", 'alpha')); - $object->phone_perso = trim(GETPOST("phone_perso", 'alpha')); + $object->phone = trim(GETPOST("phone", 'alpha')); + $object->phone_perso = trim(GETPOST("phone_perso", 'alpha')); $object->phone_mobile = trim(GETPOST("phone_mobile", 'alpha')); - $object->email = preg_replace('/\s+/', '', GETPOST("member_email", 'alpha')); - $object->url = trim(GETPOST('member_url', 'custom', 0, FILTER_SANITIZE_URL)); + $object->email = preg_replace('/\s+/', '', GETPOST("member_email", 'alpha')); + $object->url = trim(GETPOST('member_url', 'custom', 0, FILTER_SANITIZE_URL)); $object->socialnetworks = array(); foreach ($socialnetworks as $key => $value) { if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml') != '') { @@ -508,7 +519,7 @@ //$object->note = $comment; $object->morphy = $morphy; $object->user_id = $userid; - $object->socid = $socid; + $object->socid = $socid; $object->public = $public; $object->default_lang = $default_lang; // Fill array 'array_options' with data from add form @@ -1007,7 +1018,7 @@ function initfieldrequired() { print ''; } - // Type + // Member-Type print ''.$langs->trans("MemberType").''; $listetype = $adht->liste_array(1); print img_picto('', $adht->picto, 'class="pictofixedwidth"'); @@ -1094,11 +1105,11 @@ function initfieldrequired() { print ''; } - // Pro phone + // Phone Pro/Business print ''.$langs->trans("PhonePro").''; print ''.img_picto('', 'object_phoning', 'class="pictofixedwidth"').''; - // Personal phone + // Phone Personal/Private print ''.$langs->trans("PhonePerso").''; print ''.img_picto('', 'object_phoning', 'class="pictofixedwidth"').''; @@ -1161,7 +1172,7 @@ function initfieldrequired() { $adht = new AdherentType($db); $adht->fetch($object->typeid); - // We set country_id, and country_code, country of the chosen country + // We set country_id and country_code, country of the chosen country $country = GETPOST('country', 'int'); if (!empty($country) || $object->country_id) { $sql = "SELECT rowid, code, label from ".MAIN_DB_PREFIX."c_country where rowid = ".(!empty($country) ? $country : $object->country_id); @@ -1926,14 +1937,14 @@ function initfieldrequired() { print ''.$langs->trans("SendCardByMail").""; }*/ - // Modify + // Modify Member if ($user->hasRight('adherent', 'creer')) { print ''.$langs->trans("Modify").''."\n"; } else { print ''.$langs->trans("Modify").''."\n"; } - // Validate + // Validate Member if (Adherent::STATUS_DRAFT == $object->statut) { if ($user->hasRight('adherent', 'creer')) { print ''.$langs->trans("Validate").''."\n"; @@ -1942,7 +1953,7 @@ function initfieldrequired() { } } - // Reactivate + // Reactivate Member if (Adherent::STATUS_RESILIATED == $object->statut || Adherent::STATUS_EXCLUDED == $object->statut) { if ($user->hasRight('adherent', 'creer')) { print ''.$langs->trans("Reenable")."\n"; @@ -1951,7 +1962,7 @@ function initfieldrequired() { } } - // Resiliate + // Resiliate Member if (Adherent::STATUS_VALIDATED == $object->statut) { if ($user->hasRight('adherent', 'supprimer')) { print ''.$langs->trans("Resiliate")."\n"; @@ -1960,7 +1971,7 @@ function initfieldrequired() { } } - // Exclude + // Exclude Member if (Adherent::STATUS_VALIDATED == $object->statut) { if ($user->hasRight('adherent', 'supprimer')) { print ''.$langs->trans("Exclude")."\n"; @@ -1969,6 +1980,13 @@ function initfieldrequired() { } } + // Delete Member + if ($user->hasRight('adherent', 'supprimer')) { + print ''.$langs->trans("Delete").''."\n"; + } else { + print ''.$langs->trans("Delete").''."\n"; + } + // Create third party if (isModEnabled('societe') && !$object->socid) { if ($user->hasRight('societe', 'creer')) { @@ -2006,13 +2024,6 @@ function initfieldrequired() { print ''.$langs->trans("AddIntoSpip").''."\n"; } } - - // Delete - if ($user->hasRight('adherent', 'supprimer')) { - print ''.$langs->trans("Delete").''."\n"; - } else { - print ''.$langs->trans("Delete").''."\n"; - } } } print '';