From 199067e4b8258fc29387d9f3dade2f3d716688e1 Mon Sep 17 00:00:00 2001 From: guillaume-uH57J9 Date: Sun, 9 Apr 2017 22:00:19 +0200 Subject: [PATCH 1/3] members/new.php : non-public by default in the form, disable public by default, to be consistent with class Adherent's default value --- htdocs/public/members/new.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index e01201ccea3..c307512e257 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -223,7 +223,7 @@ if ($action == 'add') // email a peu pres correct et le login n'existe pas $adh = new Adherent($db); $adh->statut = -1; - $adh->public = $_POST["public"]; + $adh->public = $public; $adh->firstname = $_POST["firstname"]; $adh->lastname = $_POST["lastname"]; $adh->civility_id = $_POST["civility_id"]; @@ -508,7 +508,7 @@ print ''."\n"; // Photo print ''.$langs->trans("URLPhoto").''."\n"; // Public -print ''.$langs->trans("Public").''."\n"; +print ''.$langs->trans("Public").''."\n"; // Extrafields foreach($extrafields->attribute_label as $key=>$value) { From e335b757fd23efac8e6e7cad747276484a5ebb9a Mon Sep 17 00:00:00 2001 From: guillaume-uH57J9 Date: Sun, 9 Apr 2017 22:37:17 +0200 Subject: [PATCH 2/3] Add UI to configure MEMBER_NEWFORM_FORCETYPE Use tertiary operator ($var?: -1) instead of (!empty($var) ? $var : -1) --- htdocs/adherents/admin/public.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/htdocs/adherents/admin/public.php b/htdocs/adherents/admin/public.php index a23c1f40def..47ad7a00a97 100644 --- a/htdocs/adherents/admin/public.php +++ b/htdocs/adherents/admin/public.php @@ -29,6 +29,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; $langs->load("members"); $langs->load("admin"); @@ -49,12 +50,15 @@ if ($action == 'update') $editamount=GETPOST('MEMBER_NEWFORM_EDITAMOUNT'); $payonline=GETPOST('MEMBER_NEWFORM_PAYONLINE'); $email=GETPOST('MEMBER_PAYONLINE_SENDEMAIL'); + $forcetype=GETPOST('MEMBER_NEWFORM_FORCETYPE'); $res=dolibarr_set_const($db, "MEMBER_ENABLE_PUBLIC",$public,'chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "MEMBER_NEWFORM_AMOUNT",$amount,'chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "MEMBER_NEWFORM_EDITAMOUNT",$editamount,'chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "MEMBER_NEWFORM_PAYONLINE",$payonline,'chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "MEMBER_PAYONLINE_SENDEMAIL",$email,'chaine',0,'',$conf->entity); + if ($forcetype < 0) $res=dolibarr_del_const($db, "MEMBER_NEWFORM_FORCETYPE",$conf->entity); + else $res=dolibarr_set_const($db, "MEMBER_NEWFORM_FORCETYPE",$forcetype,'chaine',0,'',$conf->entity); if (! $res > 0) $error++; @@ -152,14 +156,18 @@ print ''; print $form->selectyesno("MEMBER_ENABLE_PUBLIC",(! empty($conf->global->MEMBER_ENABLE_PUBLIC)?$conf->global->MEMBER_ENABLE_PUBLIC:0),1); print "\n"; -// Type -/*$var=! $var; +// Force Type +$var=! $var; +$adht = new AdherentType($db); print ''; print ''; -print $langs->trans("EnablePublicSubscriptionForm"); +print $langs->trans("ForceMemberType"); print ''; -print $form->selectyesno("forcedate",$conf->global->MEMBER_NEWFORM_FORCETYPE,1); -print "\n"; */ +$listofval = array(-1 => $langs->trans("Undefined")); +$listofval += $adht->liste_array(); +$forcetype = $conf->global->MEMBER_NEWFORM_FORCETYPE ?: -1; +print $form->selectarray("MEMBER_NEWFORM_FORCETYPE", $listofval, $forcetype, count($listetype)>1?1:0); +print "\n"; // Amount $var=! $var; From f427c8441a267409d44c56217871e6fd93eb0b2f Mon Sep 17 00:00:00 2001 From: Guillaume Date: Sun, 9 Apr 2017 22:49:48 +0200 Subject: [PATCH 3/3] add translation strings for ForceMemberType --- htdocs/langs/en_US/members.lang | 1 + htdocs/langs/fr_FR/members.lang | 1 + 2 files changed, 2 insertions(+) diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index d306d6e4998..db3aefa9363 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -90,6 +90,7 @@ PublicMemberList=Public member list BlankSubscriptionForm=Public auto-subscription form BlankSubscriptionFormDesc=Dolibarr can provide you a public URL to allow external visitors to ask to subscribe to the foundation. If an online payment module is enabled, a payment form will also be automatically provided. EnablePublicSubscriptionForm=Enable the public auto-subscription form +ForceMemberType=Force the member type ExportDataset_member_1=Members and subscriptions ImportDataset_member_1=Members LastMembersModified=Latest %s modified members diff --git a/htdocs/langs/fr_FR/members.lang b/htdocs/langs/fr_FR/members.lang index 45dc1ad0c45..3f74da84dd4 100644 --- a/htdocs/langs/fr_FR/members.lang +++ b/htdocs/langs/fr_FR/members.lang @@ -90,6 +90,7 @@ PublicMemberList=Liste des membres publics BlankSubscriptionForm=Formulaire d'auto-inscription public BlankSubscriptionFormDesc=Dolibarr peut offrir une URL de page publique permettant de postuler à une adhésion pour les visiteurs externes. S'il existe un module de paiement en ligne, un formulaire de paiement sera également automatiquement proposé. EnablePublicSubscriptionForm=Activer le formulaire d'auto-inscription public +ForceMemberType=Forcer le type de membre ExportDataset_member_1=Adhérents et adhésions ImportDataset_member_1=Adhérents LastMembersModified=Les %s derniers adhérents modifiés