27 require
'../../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/member.lib.php';
31 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent_type.class.php';
34 $langs->loadLangs(array(
"admin",
"members"));
36 $action =
GETPOST(
'action',
'aZ09');
45 if ($action ==
'setMEMBER_ENABLE_PUBLIC') {
47 else dolibarr_set_const($db,
'MEMBER_ENABLE_PUBLIC', 0,
'chaine', 0,
'', $conf->entity);
50 if ($action ==
'update') {
51 $public =
GETPOST(
'MEMBER_ENABLE_PUBLIC');
52 $amount =
GETPOST(
'MEMBER_NEWFORM_AMOUNT');
53 $editamount =
GETPOST(
'MEMBER_NEWFORM_EDITAMOUNT');
54 $payonline =
GETPOST(
'MEMBER_NEWFORM_PAYONLINE');
55 $forcetype =
GETPOST(
'MEMBER_NEWFORM_FORCETYPE');
57 $res =
dolibarr_set_const($db,
"MEMBER_ENABLE_PUBLIC", $public,
'chaine', 0,
'', $conf->entity);
58 $res =
dolibarr_set_const($db,
"MEMBER_NEWFORM_AMOUNT", $amount,
'chaine', 0,
'', $conf->entity);
59 $res =
dolibarr_set_const($db,
"MEMBER_NEWFORM_EDITAMOUNT", $editamount,
'chaine', 0,
'', $conf->entity);
60 $res =
dolibarr_set_const($db,
"MEMBER_NEWFORM_PAYONLINE", $payonline,
'chaine', 0,
'', $conf->entity);
61 if ($forcetype < 0) $res =
dolibarr_del_const($db,
"MEMBER_NEWFORM_FORCETYPE", $conf->entity);
63 $res =
dolibarr_set_const($db,
"MEMBER_NEWFORM_FORCETYPE", $forcetype,
'chaine', 0,
'', $conf->entity);
66 if (!($res > 0)) $error++;
80 $form =
new Form($db);
82 $help_url =
'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros';
83 llxHeader(
'', $langs->trans(
"MembersSetup"), $help_url);
86 $linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
93 print '<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
94 print '<input type="hidden" name="action" value="update">';
95 print '<input type="hidden" name="token" value="'.newToken().
'">';
99 if ($conf->use_javascript_ajax) {
100 print "\n".
'<script type="text/javascript" language="javascript">';
101 print 'jQuery(document).ready(function () {
104 if (jQuery("#MEMBER_NEWFORM_PAYONLINE").val()==\'-1\')
106 jQuery("#tremail").hide();
110 jQuery("#tremail").show();
113 function initfields()
115 if (jQuery("#MEMBER_ENABLE_PUBLIC").val()==\'0\')
117 jQuery("#trforcetype, #tramount, #tredit, #trpayment, #tremail").hide();
119 if (jQuery("#MEMBER_ENABLE_PUBLIC").val()==\'1\')
121 jQuery("#trforcetype, #tramount, #tredit, #trpayment").show();
122 if (jQuery("#MEMBER_NEWFORM_PAYONLINE").val()==\'-1\') jQuery("#tremail").hide();
123 else jQuery("#tremail").show();
127 jQuery("#MEMBER_ENABLE_PUBLIC").change(function() { initfields(); });
128 jQuery("#MEMBER_NEWFORM_PAYONLINE").change(function() { initemail(); });
130 print '</script>'.
"\n";
134 print '<span class="opacitymedium">'.$langs->trans(
"BlankSubscriptionFormDesc").
'</span><br><br>';
137 $enabledisablehtml = $langs->trans(
"EnablePublicSubscriptionForm").
' ';
138 if (empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
140 $enabledisablehtml .=
'<a class="reposition valignmiddle" href="'.$_SERVER[
"PHP_SELF"].
'?action=setMEMBER_ENABLE_PUBLIC&token='.
newToken().
'&value=1'.$param.
'">';
141 $enabledisablehtml .=
img_picto($langs->trans(
"Disabled"),
'switch_off');
142 $enabledisablehtml .=
'</a>';
145 $enabledisablehtml .=
'<a class="reposition valignmiddle" href="'.$_SERVER[
"PHP_SELF"].
'?action=setMEMBER_ENABLE_PUBLIC&token='.
newToken().
'&value=0'.$param.
'">';
146 $enabledisablehtml .=
img_picto($langs->trans(
"Activated"),
'switch_on');
147 $enabledisablehtml .=
'</a>';
149 print $enabledisablehtml;
150 print '<input type="hidden" id="MEMBER_ENABLE_PUBLIC" name="MEMBER_ENABLE_PUBLIC" value="'.(empty($conf->global->MEMBER_ENABLE_PUBLIC) ? 0 : 1).
'">';
155 if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
158 print
'<table class="noborder centpercent">';
160 print
'<tr class="liste_titre">';
161 print
'<td>'.$langs->trans(
"Parameter").
'</td>';
162 print
'<td class="right">'.$langs->trans(
"Value").
'</td>';
167 print
'<tr class="oddeven drag" id="trforcetype"><td>';
168 print $langs->trans(
"ForceMemberType");
169 print
'</td><td class="right">';
170 $listofval = array();
171 $listofval += $adht->liste_array();
172 $forcetype = $conf->global->MEMBER_NEWFORM_FORCETYPE ?: -1;
173 print $form->selectarray(
"MEMBER_NEWFORM_FORCETYPE", $listofval, $forcetype, count($listofval) > 1 ? 1 : 0);
174 print
"</td></tr>\n";
177 print
'<tr class="oddeven" id="tramount"><td>';
178 print $langs->trans(
"DefaultAmount");
179 print
'</td><td class="right">';
180 print
'<input type="text" id="MEMBER_NEWFORM_AMOUNT" name="MEMBER_NEWFORM_AMOUNT" size="5" value="'.(!empty($conf->global->MEMBER_NEWFORM_AMOUNT) ? $conf->global->MEMBER_NEWFORM_AMOUNT :
'').
'">';
181 print
"</td></tr>\n";
184 print
'<tr class="oddeven" id="tredit"><td>';
185 print $langs->trans(
"CanEditAmount");
186 print
'</td><td class="right">';
187 print $form->selectyesno(
"MEMBER_NEWFORM_EDITAMOUNT", (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT) ? $conf->global->MEMBER_NEWFORM_EDITAMOUNT : 0), 1);
188 print
"</td></tr>\n";
191 print
'<tr class="oddeven" id="trpayment"><td>';
192 print $langs->trans(
"MEMBER_NEWFORM_PAYONLINE");
193 print
'</td><td class="right">';
194 $listofval = array();
195 $listofval[
'-1'] = $langs->trans(
'No');
196 $listofval[
'all'] = $langs->trans(
'Yes').
' ('.$langs->trans(
"VisitorCanChooseItsPaymentMode").
')';
197 if (!empty($conf->paybox->enabled)) $listofval[
'paybox'] =
'Paybox';
198 if (!empty($conf->paypal->enabled)) $listofval[
'paypal'] =
'PayPal';
199 if (!empty($conf->stripe->enabled)) $listofval[
'stripe'] =
'Stripe';
200 print $form->selectarray(
"MEMBER_NEWFORM_PAYONLINE", $listofval, (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE) ? $conf->global->MEMBER_NEWFORM_PAYONLINE :
''), 0);
201 print
"</td></tr>\n";
205 print
'<div class="center">';
206 print
'<input type="submit" class="button" value="'.$langs->trans(
"Modify").
'">';
216 if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
219 print
img_picto(
'',
'globe').
' '.$langs->trans(
'BlankSubscriptionForm').
':<br>';
220 if ($conf->multicompany->enabled) {
221 $entity_qr =
'?entity='.$conf->entity;
227 $urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim($dolibarr_main_url_root));
228 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
231 print
'<a target="_blank" href="'.$urlwithroot.
'/public/members/new.php'.$entity_qr.
'">'.$urlwithroot.
'/public/members/new.php'.$entity_qr.
'</a>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
member_admin_prepare_head()
Return array head with list of tabs to view object informations.
dolibarr_set_const($db, $name, $value, $type= 'chaine', $visible=0, $note= '', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
dolibarr_del_const($db, $name, $entity=1)
Effacement d'une constante dans la base de donnees.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Class to manage members type.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_get_fiche_end($notab=0)
Return tab footer of a card.