28require 
'../../main.inc.php';
 
   29require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
 
   30require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
 
   31require_once DOL_DOCUMENT_ROOT.
'/core/lib/member.lib.php';
 
   32require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent_type.class.php';
 
   35$langs->loadLangs(array(
"admin", 
"members"));
 
   37$action = 
GETPOST(
'action', 
'aZ09');
 
   50if ($action == 
'setMEMBER_ENABLE_PUBLIC') {
 
   58if ($action == 
'update') {
 
   59  $public = 
GETPOST(
'MEMBER_ENABLE_PUBLIC');
 
   61  $minamount = 
GETPOST(
'MEMBER_MIN_AMOUNT');
 
   62  $publiccounters = 
GETPOST(
'MEMBER_COUNTERS_ARE_PUBLIC');
 
   63  $showtable = 
GETPOST(
'MEMBER_SHOW_TABLE');
 
   64  $showvoteallowed = 
GETPOST(
'MEMBER_SHOW_VOTE_ALLOWED');
 
   65  $payonline = 
GETPOST(
'MEMBER_NEWFORM_PAYONLINE');
 
   66  $forcetype = 
GETPOST(
'MEMBER_NEWFORM_FORCETYPE', 
'int');
 
   67  $forcemorphy = 
GETPOST(
'MEMBER_NEWFORM_FORCEMORPHY', 
'aZ09');
 
   69  $res = 
dolibarr_set_const($db, 
"MEMBER_ENABLE_PUBLIC", $public, 
'chaine', 0, 
'', $conf->entity);
 
   70  $res = 
dolibarr_set_const($db, 
"MEMBER_NEWFORM_AMOUNT", $amount, 
'chaine', 0, 
'', $conf->entity);
 
   71  $res = 
dolibarr_set_const($db, 
"MEMBER_MIN_AMOUNT", $minamount, 
'chaine', 0, 
'', $conf->entity);
 
   72  $res = 
dolibarr_set_const($db, 
"MEMBER_COUNTERS_ARE_PUBLIC", $publiccounters, 
'chaine', 0, 
'', $conf->entity);
 
   73  $res = 
dolibarr_set_const($db, 
"MEMBER_SKIP_TABLE", !$showtable, 
'chaine', 0, 
'', $conf->entity); 
 
   74  $res = 
dolibarr_set_const($db, 
"MEMBER_HIDE_VOTE_ALLOWED", !$showvoteallowed, 
'chaine', 0, 
'', $conf->entity); 
 
   75  $res = 
dolibarr_set_const($db, 
"MEMBER_NEWFORM_PAYONLINE", $payonline, 
'chaine', 0, 
'', $conf->entity);
 
   79    $res = 
dolibarr_set_const($db, 
"MEMBER_NEWFORM_FORCETYPE", $forcetype, 
'chaine', 0, 
'', $conf->entity);
 
   81  if ($forcemorphy == 
'-1') {
 
   84    $res = 
dolibarr_set_const($db, 
"MEMBER_NEWFORM_FORCEMORPHY", $forcemorphy, 
'chaine', 0, 
'', $conf->entity);
 
  103$form = 
new Form($db);
 
  105$title = $langs->trans(
"MembersSetup");
 
  106$help_url = 
'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros|DE:Modul_Mitglieder';
 
  110$linkback = 
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
 
  117print 
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
 
  118print 
'<input type="hidden" name="action" value="update">';
 
  119print 
'<input type="hidden" name="token" value="'.newToken().
'">';
 
  123if ($conf->use_javascript_ajax) {
 
  124  print 
"\n".
'<script type="text/javascript">';
 
  125  print 
'jQuery(document).ready(function () { 
  128                    if (jQuery("#MEMBER_NEWFORM_PAYONLINE").val()==\'-1\') 
  130                        jQuery("#tremail").hide(); 
  134                        jQuery("#tremail").show(); 
  137                function initfields() 
  139          if (jQuery("#MEMBER_ENABLE_PUBLIC").val()==\'0\') 
  141                        jQuery("#trforcetype, #tramount, #tredit, #trpayment, #tremail").hide(); 
  143                    if (jQuery("#MEMBER_ENABLE_PUBLIC").val()==\'1\') 
  145                        jQuery("#trforcetype, #tramount, #tredit, #trpayment").show(); 
  146                        if (jQuery("#MEMBER_NEWFORM_PAYONLINE").val()==\'-1\') jQuery("#tremail").hide(); 
  147                        else jQuery("#tremail").show(); 
  151                jQuery("#MEMBER_ENABLE_PUBLIC").change(function() { initfields(); }); 
  152                jQuery("#MEMBER_NEWFORM_PAYONLINE").change(function() { initemail(); }); 
  154  print 
'</script>'.
"\n";
 
  158print 
'<span class="opacitymedium">'.$langs->trans(
"BlankSubscriptionFormDesc").
'</span><br><br>';
 
  162$enabledisablehtml = $langs->trans(
"EnablePublicSubscriptionForm").
' ';
 
  163if (empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
 
  165  $enabledisablehtml .= 
'<a class="reposition valignmiddle" href="'.$_SERVER[
"PHP_SELF"].
'?action=setMEMBER_ENABLE_PUBLIC&token='.newToken().
'&value=1'.$param.
'">';
 
  166  $enabledisablehtml .= 
img_picto($langs->trans(
"Disabled"), 
'switch_off');
 
  167  $enabledisablehtml .= 
'</a>';
 
  170  $enabledisablehtml .= 
'<a class="reposition valignmiddle" href="'.$_SERVER[
"PHP_SELF"].
'?action=setMEMBER_ENABLE_PUBLIC&token='.newToken().
'&value=0'.$param.
'">';
 
  171  $enabledisablehtml .= 
img_picto($langs->trans(
"Activated"), 
'switch_on');
 
  172  $enabledisablehtml .= 
'</a>';
 
  174print $enabledisablehtml;
 
  175print 
'<input type="hidden" id="MEMBER_ENABLE_PUBLIC" name="MEMBER_ENABLE_PUBLIC" value="'.(empty($conf->global->MEMBER_ENABLE_PUBLIC) ? 0 : 1).
'">';
 
  180if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
 
  183  print 
img_picto(
'', 
'globe').
' <span class="opacitymedium">'.$langs->trans(
'BlankSubscriptionForm').
'</span><br>';
 
  184  if (isModEnabled(
'multicompany')) {
 
  185    $entity_qr = 
'?entity='.((int) $conf->entity);
 
  191  $urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT, 
'/').
'$/i', 
'', trim($dolibarr_main_url_root));
 
  192  $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; 
 
  195  print 
'<div class="urllink">';
 
  196  print 
'<input type="text" id="publicurlmember" class="quatrevingtpercentminusx" value="'.$urlwithroot.
'/public/members/new.php'.$entity_qr.
'">';
 
  197  print 
'<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.
'/public/members/new.php'.$entity_qr.
'">'.
img_picto(
'', 
'globe', 
'class="paddingleft"').
'</a>';
 
  203  print 
'<div class="div-table-responsive-no-min">';
 
  204  print 
'<table class="noborder centpercent">';
 
  206  print 
'<tr class="liste_titre">';
 
  207  print 
'<td>'.$langs->trans(
"Parameter").
'</td>';
 
  208  print 
'<td>'.$langs->trans(
"Value").
'</td>';
 
  213  print 
'<tr class="oddeven drag" id="trforcetype"><td>';
 
  214  print $langs->trans(
"ForceMemberType");
 
  216  $listofval = array();
 
  217  $listofval += $adht->liste_array(1);
 
  218  $forcetype = empty($conf->global->MEMBER_NEWFORM_FORCETYPE) ? -1 : $conf->global->MEMBER_NEWFORM_FORCETYPE;
 
  219  print $form->selectarray(
"MEMBER_NEWFORM_FORCETYPE", $listofval, $forcetype, count($listofval) > 1 ? 1 : 0);
 
  220  print 
"</td></tr>\n";
 
  223  $morphys[
"phy"] = $langs->trans(
"Physical");
 
  224  $morphys[
"mor"] = $langs->trans(
"Moral");
 
  225  print 
'<tr class="oddeven drag" id="trforcenature"><td>';
 
  226  print $langs->trans(
"ForceMemberNature");
 
  228  $forcenature = empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY) ? 0 : $conf->global->MEMBER_NEWFORM_FORCEMORPHY;
 
  229  print $form->selectarray(
"MEMBER_NEWFORM_FORCEMORPHY", $morphys, $forcenature, 1);
 
  230  print 
"</td></tr>\n";
 
  233  print 
'<tr class="oddeven" id="tramount"><td>';
 
  234  print $langs->trans(
"DefaultAmount");
 
  236  print 
'<input type="text" class="right width50" id="MEMBER_NEWFORM_AMOUNT" name="MEMBER_NEWFORM_AMOUNT" value="'.(!empty($conf->global->MEMBER_NEWFORM_AMOUNT) ? $conf->global->MEMBER_NEWFORM_AMOUNT : 
'').
'">';
 
  237  print 
"</td></tr>\n";
 
  240  print 
'<tr class="oddeven" id="tredit"><td>';
 
  241  print $langs->trans(
"MinimumAmount");
 
  243  print 
'<input type="text" class="right width50" id="MEMBER_MIN_AMOUNT" name="MEMBER_MIN_AMOUNT" value="'.(!empty($conf->global->MEMBER_MIN_AMOUNT) ? $conf->global->MEMBER_MIN_AMOUNT : 
'').
'">';
 
  244  print 
"</td></tr>\n";
 
  247  print 
'<tr class="oddeven" id="tredit"><td>';
 
  248  print $langs->trans(
"MemberCountersArePublic");
 
  250  print $form->selectyesno(
"MEMBER_COUNTERS_ARE_PUBLIC", (!empty($conf->global->MEMBER_COUNTERS_ARE_PUBLIC) ? $conf->global->MEMBER_COUNTERS_ARE_PUBLIC : 0), 1);
 
  251  print 
"</td></tr>\n";
 
  254  $skiptable = (!empty($conf->global->MEMBER_SKIP_TABLE) ? $conf->global->MEMBER_SKIP_TABLE : 0);
 
  255  print 
'<tr class="oddeven" id="tredit"><td>';
 
  256  print $langs->trans(
"MembersShowMembershipTypesTable");
 
  258  print $form->selectyesno(
"MEMBER_SHOW_TABLE", !$skiptable, 1); 
 
  259  print 
"</td></tr>\n";
 
  262  $hidevoteallowed = (!empty($conf->global->MEMBER_HIDE_VOTE_ALLOWED) ? $conf->global->MEMBER_HIDE_VOTE_ALLOWED : 0);
 
  263  print 
'<tr class="oddeven" id="tredit"><td>';
 
  264  print $langs->trans(
"MembersShowVotesAllowed");
 
  266  print $form->selectyesno(
"MEMBER_SHOW_VOTE_ALLOWED", !$hidevoteallowed, 1); 
 
  267  print 
"</td></tr>\n";
 
  270  print 
'<tr class="oddeven" id="trpayment"><td>';
 
  271  print $langs->trans(
"MEMBER_NEWFORM_PAYONLINE");
 
  273  $listofval = array();
 
  274  $listofval[
'-1'] = $langs->trans(
'No');
 
  275  $listofval[
'all'] = $langs->trans(
'Yes').
' ('.$langs->trans(
"VisitorCanChooseItsPaymentMode").
')';
 
  276  if (isModEnabled(
'paybox')) {
 
  277    $listofval[
'paybox'] = 
'Paybox';
 
  279  if (isModEnabled(
'paypal')) {
 
  280    $listofval[
'paypal'] = 
'PayPal';
 
  282  if (isModEnabled(
'stripe')) {
 
  283    $listofval[
'stripe'] = 
'Stripe';
 
  285  print $form->selectarray(
"MEMBER_NEWFORM_PAYONLINE", $listofval, (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE) ? $conf->global->MEMBER_NEWFORM_PAYONLINE : 
''), 0);
 
  286  print 
"</td></tr>\n";
 
  291  print 
'<div class="center">';
 
  292  print 
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
 
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).
 
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
 
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 type.
 
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
 
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.
 
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
 
dol_get_fiche_end($notab=0)
Return tab footer of a card.
 
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
 
ajax_autoselect($htmlname, $addlink='', $textonlink='Link')
Make content of an input box selected when we click into input field.
 
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
 
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
 
member_admin_prepare_head()
Return array head with list of tabs to view object informations.
 
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.