43 if (!defined(
'NOLOGIN')) {
46 if (!defined(
'NOCSRFCHECK')) {
47 define(
"NOCSRFCHECK", 1);
49 if (!defined(
'NOIPCHECK')) {
50 define(
'NOIPCHECK',
'1');
52 if (!defined(
'NOBROWSERNOTIF')) {
53 define(
'NOBROWSERNOTIF',
'1');
59 $entity = (!empty($_GET[
'entity']) ? (int) $_GET[
'entity'] : (!empty($_POST[
'entity']) ? (int) $_POST[
'entity'] : 1));
60 if (is_numeric($entity)) {
61 define(
"DOLENTITY", $entity);
66 require
'../../main.inc.php';
67 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
68 require_once DOL_DOCUMENT_ROOT.
'/core/lib/payments.lib.php';
69 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
70 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent_type.class.php';
71 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
72 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
73 require_once DOL_DOCUMENT_ROOT.
'/core/class/cunits.class.php';
74 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
80 $backtopage =
GETPOST(
'backtopage',
'alpha');
81 $action =
GETPOST(
'action',
'aZ09');
84 $langs->loadLangs(array(
"main",
"members",
"companies",
"install",
"other",
"errors"));
87 if (empty($conf->adherent->enabled)) {
91 if (empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
96 $hookmanager->initHooks(array(
'publicnewmembercard',
'globalcard'));
102 $user->loadDefaultValues();
116 function llxHeaderVierge($title, $head =
"", $disablejs = 0, $disablehead = 0, $arrayofjs =
'', $arrayofcss =
'')
118 global $user, $conf, $langs, $mysoc;
120 top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
122 print
'<body id="mainbody" class="publicnewmemberform">';
125 $urllogo = DOL_URL_ROOT.
'/theme/common/login_logo.png';
127 if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.
'/logos/thumbs/'.$mysoc->logo_small)) {
128 $urllogo = DOL_URL_ROOT.
'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode(
'logos/thumbs/'.$mysoc->logo_small);
129 } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.
'/logos/'.$mysoc->logo)) {
130 $urllogo = DOL_URL_ROOT.
'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode(
'logos/'.$mysoc->logo);
131 } elseif (is_readable(DOL_DOCUMENT_ROOT.
'/theme/dolibarr_logo.svg')) {
132 $urllogo = DOL_URL_ROOT.
'/theme/dolibarr_logo.svg';
135 print
'<div class="center">';
139 print
'<div class="backgreypublicpayment">';
140 print
'<div class="logopublicpayment">';
141 print
'<img id="dolpaymentlogo" src="'.$urllogo.
'">';
143 if (empty($conf->global->MAIN_HIDE_POWERED_BY)) {
144 print
'<div class="poweredbypublicpayment opacitymedium right"><a class="poweredbyhref" href="https://www.dolibarr.org?utm_medium=website&utm_source=poweredby" target="dolibarr" rel="noopener">'.$langs->trans(
"PoweredBy").
'<br><img class="poweredbyimg" src="'.DOL_URL_ROOT.
'/theme/dolibarr_logo.svg" width="80px"></a></div>';
149 if (!empty($conf->global->MEMBER_IMAGE_PUBLIC_REGISTRATION)) {
150 print
'<div class="backimagepublicregistration">';
151 print
'<img id="idEVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE" src="'.$conf->global->MEMBER_IMAGE_PUBLIC_REGISTRATION.
'">';
157 print
'<div class="divmainbodylarge">';
181 $parameters = array();
183 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
189 if (empty($reshook) && $action ==
'add') {
196 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
199 $errmsg .= $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Login")).
"<br>\n";
201 $sql =
"SELECT login FROM ".MAIN_DB_PREFIX.
"adherent WHERE login = '".$db->escape(
GETPOST(
'login')).
"'";
202 $result = $db->query($sql);
204 $num = $db->num_rows($result);
208 $langs->load(
"errors");
209 $errmsg .= $langs->trans(
"ErrorLoginAlreadyExists").
"<br>\n";
213 $langs->load(
"errors");
214 $errmsg .= $langs->trans(
"ErrorPasswordsMustMatch").
"<br>\n";
218 $errmsg .= $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"EMail")).
"<br>\n";
223 $errmsg .= $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Type")).
"<br>\n";
225 if (!in_array(
GETPOST(
'morphy'), array(
'mor',
'phy'))) {
227 $errmsg .= $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
'Nature')).
"<br>\n";
231 $errmsg .= $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Lastname")).
"<br>\n";
235 $errmsg .= $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Firstname")).
"<br>\n";
237 if (!empty($conf->global->ADHERENT_MAIL_REQUIRED) && empty(
GETPOST(
'email'))) {
239 $errmsg .= $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Email')).
"<br>\n";
241 $langs->load(
'errors');
243 $errmsg .= $langs->trans(
"ErrorBadEMail",
GETPOST(
"email")).
"<br>\n";
245 $birthday =
dol_mktime(
GETPOST(
"birthhour",
'int'),
GETPOST(
"birthmin",
'int'),
GETPOST(
"birthsec",
'int'),
GETPOST(
"birthmonth",
'int'),
GETPOST(
"birthday",
'int'),
GETPOST(
"birthyear",
'int'));
246 if (
GETPOST(
"birthmonth") && empty($birthday)) {
248 $langs->load(
"errors");
249 $errmsg .= $langs->trans(
"ErrorBadDateFormat").
"<br>\n";
251 if (!empty($conf->global->MEMBER_NEWFORM_DOLIBARRTURNOVER)) {
254 $errmsg .= $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"TurnoverOrBudget")).
"<br>\n";
259 if (!empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) {
260 $sessionkey =
'dol_antispam_value';
261 $ok = (array_key_exists($sessionkey, $_SESSION) ===
true && (strtolower($_SESSION[$sessionkey]) == strtolower($_POST[
'code'])));
264 $errmsg .= $langs->trans(
"ErrorBadValueForCode").
"<br>\n";
275 $adh->public = $public;
276 $adh->firstname =
GETPOST(
'firstname');
277 $adh->lastname =
GETPOST(
'lastname');
278 $adh->gender =
GETPOST(
'gender');
279 $adh->civility_id =
GETPOST(
'civility_id');
280 $adh->societe =
GETPOST(
'societe');
281 $adh->address =
GETPOST(
'address');
282 $adh->zip =
GETPOST(
'zipcode');
284 $adh->email =
GETPOST(
'email');
285 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
286 $adh->login =
GETPOST(
'login');
289 $adh->photo =
GETPOST(
'photo');
291 $adh->state_id =
GETPOST(
'state_id',
'int');
293 $adh->note_private =
GETPOST(
'note_private');
295 $adh->birth = $birthday;
299 $nb_post_max =
getDolGlobalInt(
"MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 200);
304 if ($nb_post_max > 0) {
305 $sql =
"SELECT COUNT(ref) as nb_adh";
306 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent";
307 $sql .=
" WHERE ip = '".$db->escape($adh->ip).
"'";
308 $sql .=
" AND datec > '".$db->idate($minmonthpost).
"'";
309 $resql = $db->query($sql);
311 $num = $db->num_rows(
$resql);
315 $obj = $db->fetch_object(
$resql);
316 $nb_post_ip = $obj->nb_adh;
323 $extrafields->fetch_name_optionals_label($adh->table_element);
324 $ret = $extrafields->setOptionalsFromPost(
null, $adh);
327 $errmsg .= $adh->error;
330 if ($nb_post_max > 0 && $nb_post_ip >= $nb_post_max) {
332 $errmsg .= $langs->trans(
"AlreadyTooMuchPostOnThisIPAdress");
333 array_push($adh->errors, $langs->trans(
"AlreadyTooMuchPostOnThisIPAdress"));
337 $result = $adh->create($user);
339 require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
343 $adht->fetch($object->typeid);
345 if ($object->email) {
350 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
354 $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
356 $outputlangs->loadLangs(array(
"main",
"members"));
358 $arraydefaultmessage =
null;
359 $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_AUTOREGISTER;
361 if (!empty($labeltouse)) {
362 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
365 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
366 $subject = $arraydefaultmessage->topic;
367 $msg = $arraydefaultmessage->content;
375 if ($subjecttosend && $texttosend) {
376 $moreinheader =
'X-Dolibarr-Info: send_an_email by public/members/new.php'.
"\r\n";
378 $result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(),
"",
"", 0, -1,
'', $moreinheader);
387 if (!empty($conf->global->MAIN_INFO_SOCIETE_MAIL) && !empty($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT) &&
388 !empty($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL)) {
390 $appli = constant(
'DOL_APPLICATION_TITLE');
391 if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
392 $appli = $conf->global->MAIN_APPLICATION_TITLE;
393 if (preg_match(
'/\d\.\d/', $appli)) {
394 if (!preg_match(
'/'.preg_quote(DOL_VERSION).
'/', $appli)) {
395 $appli .=
" (".DOL_VERSION.
")";
398 $appli .=
" ".DOL_VERSION;
401 $appli .=
" ".DOL_VERSION;
404 $to = $adh->makeSubstitution($conf->global->MAIN_INFO_SOCIETE_MAIL);
407 '['.$appli.
'] '.$conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT,
410 $adh->makeSubstitution($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL),
420 if (!$mailfile->sendfile()) {
421 dol_syslog($langs->trans(
"ErrorFailedToSendMail", $from, $to), LOG_ERR);
426 if (!empty($conf->global->ADHERENT_DEFAULT_CREATE_THIRDPARTY)) {
428 $result = $company->create_from_member($adh);
431 $errmsg .= join(
'<br>', $company->errors);
435 if (!empty($backtopage)) {
436 $urlback = $backtopage;
437 } elseif (!empty($conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION)) {
438 $urlback = $conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION;
441 $urlback = $_SERVER[
"PHP_SELF"].
"?action=added&token=".
newToken();
444 if (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE) && $conf->global->MEMBER_NEWFORM_PAYONLINE !=
'-1') {
445 if (empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) {
450 $urlback = getOnlinePaymentUrl(0,
'member', $adh->ref,
price2num(
GETPOST(
'amount',
'alpha'),
'MT'),
'', 0);
453 $urlback .=
'&email='.urlencode(
GETPOST(
'email'));
455 if ($conf->global->MEMBER_NEWFORM_PAYONLINE !=
'-1' && $conf->global->MEMBER_NEWFORM_PAYONLINE !=
'all') {
456 $urlback .=
'&paymentmethod='.urlencode($conf->global->MEMBER_NEWFORM_PAYONLINE);
459 if (!empty($entity)) {
460 $urlback .=
'&entity='.((int) $entity);
465 if (!empty($backtopage)) {
466 $urlback = $backtopage;
467 dol_syslog(
"member ".$adh->ref.
" was created, we redirect to ".$urlback);
468 } elseif (!empty($conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION)) {
469 $urlback = $conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION;
471 dol_syslog(
"member ".$adh->ref.
" was created, we redirect to ".$urlback);
474 $errmsg .= join(
'<br>', $adh->errors);
482 Header(
"Location: ".$urlback);
494 if (empty($reshook) && $action ==
'added') {
499 print
'<div class="center">';
500 print $langs->trans(
"NewMemberbyWeb");
516 $extrafields->fetch_name_optionals_label($object->table_element);
522 print
load_fiche_titre($langs->trans(
"NewSubscription"),
'',
'', 0, 0,
'center');
525 print
'<div align="center">';
526 print
'<div id="divsubscribe">';
528 print
'<div class="center subscriptionformhelptext justify">';
529 if (!empty($conf->global->MEMBER_NEWFORM_TEXT)) {
530 print $langs->trans($conf->global->MEMBER_NEWFORM_TEXT).
"<br>\n";
532 print $langs->trans(
"NewSubscriptionDesc",
getDolGlobalString(
"MAIN_INFO_SOCIETE_MAIL")).
"<br>\n";
540 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" name="newmember">'.
"\n";
541 print
'<input type="hidden" name="token" value="'.newToken().
'" / >';
542 print
'<input type="hidden" name="entity" value="'.$entity.
'" />';
544 if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEWFORM_FORCETYPE) || $action ==
'create') {
545 print
'<input type="hidden" name="action" value="add" />';
547 print
'<br><span class="opacitymedium">'.$langs->trans(
"FieldsWithAreMandatory",
'*').
'</span><br>';
552 print
'<script type="text/javascript">
553 jQuery(document).ready(function () {
554 jQuery(document).ready(function () {
555 function initmorphy()
557 console.log("Call initmorphy");
558 if (jQuery("#morphy").val() == \'phy\') {
559 jQuery("#trcompany").hide();
561 if (jQuery("#morphy").val() == \'mor\') {
562 jQuery("#trcompany").show();
566 jQuery("#morphy").change(function() {
569 jQuery("#selectcountry_id").change(function() {
570 document.newmember.action.value="create";
571 document.newmember.submit();
573 jQuery("#typeid").change(function() {
574 document.newmember.action.value="create";
575 document.newmember.submit();
582 print
'<table class="border" summary="form to subscribe" id="tablesubscribe">'.
"\n";
585 if (empty($conf->global->MEMBER_NEWFORM_FORCETYPE)) {
586 $listoftype = $adht->liste_array();
587 $tmp = array_keys($listoftype);
590 if (count($listoftype) == 1) {
591 $defaulttype = $tmp[0];
594 print
'<tr><td class="titlefield">'.$langs->trans(
"Type").
' <span style="color: red">*</span></td><td>';
595 print
$form->selectarray(
"typeid", $adht->liste_array(1),
GETPOST(
'typeid') ?
GETPOST(
'typeid') : $defaulttype, $isempty);
596 print
'</td></tr>'.
"\n";
598 $adht->fetch($conf->global->MEMBER_NEWFORM_FORCETYPE);
599 print
'<input type="hidden" id="typeid" name="typeid" value="'.$conf->global->MEMBER_NEWFORM_FORCETYPE.
'">';
603 $morphys[
"phy"] = $langs->trans(
"Physical");
604 $morphys[
"mor"] = $langs->trans(
"Moral");
605 if (empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY)) {
606 print
'<tr class="morphy"><td class="titlefield">'.$langs->trans(
'MemberNature').
' <span style="color: red">*</span></td><td>'.
"\n";
607 print
$form->selectarray(
"morphy", $morphys,
GETPOST(
'morphy'), 1);
608 print
'</td></tr>'.
"\n";
610 print $morphys[$conf->global->MEMBER_NEWFORM_FORCEMORPHY];
611 print
'<input type="hidden" id="morphy" name="morphy" value="'.$conf->global->MEMBER_NEWFORM_FORCEMORPHY.
'">';
615 print
'<tr id="trcompany" class="trcompany"><td>'.$langs->trans(
"Company").
'</td><td>';
616 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
617 print
'<input type="text" name="societe" class="minwidth150 widthcentpercentminusx" value="'.dol_escape_htmltag(
GETPOST(
'societe')).
'"></td></tr>'.
"\n";
620 print
'<tr><td class="titlefield">'.$langs->trans(
'UserTitle').
'</td><td>';
621 print $formcompany->select_civility(
GETPOST(
'civility_id'),
'civility_id').
'</td></tr>'.
"\n";
624 print
'<tr><td>'.$langs->trans(
"Lastname").
' <span style="color: red">*</span></td><td><input type="text" name="lastname" class="minwidth150" value="'.
dol_escape_htmltag(
GETPOST(
'lastname')).
'"></td></tr>'.
"\n";
627 print
'<tr><td>'.$langs->trans(
"Firstname").
' <span style="color: red">*</span></td><td><input type="text" name="firstname" class="minwidth150" value="'.
dol_escape_htmltag(
GETPOST(
'firstname')).
'"></td></tr>'.
"\n";
630 print
'<tr><td>'.$langs->trans(
"Email").(getDolGlobalString(
"ADHERENT_MAIL_REQUIRED") ?
' <span style="color:red;">*</span>' :
'').
'</td><td>';
632 print
'<input type="text" name="email" maxlength="255" class="minwidth200" value="'.dol_escape_htmltag(
GETPOST(
'email')).
'"></td></tr>'.
"\n";
635 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
636 print
'<tr><td>'.$langs->trans(
"Login").
' <span style="color: red">*</span></td><td><input type="text" name="login" maxlength="50" class="minwidth100"value="'.
dol_escape_htmltag(
GETPOST(
'login')).
'"></td></tr>'.
"\n";
637 print
'<tr><td>'.$langs->trans(
"Password").
' <span style="color: red">*</span></td><td><input type="password" maxlength="128" name="pass1" class="minwidth100" value="'.
dol_escape_htmltag(
GETPOST(
"pass1",
"none", 2)).
'"></td></tr>'.
"\n";
638 print
'<tr><td>'.$langs->trans(
"PasswordRetype").
' <span style="color: red">*</span></td><td><input type="password" maxlength="128" name="pass2" class="minwidth100" value="'.
dol_escape_htmltag(
GETPOST(
"pass2",
"none", 2)).
'"></td></tr>'.
"\n";
642 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
644 $arraygender = array(
'man'=>$langs->trans(
"Genderman"),
'woman'=>$langs->trans(
"Genderwoman"),
'other'=>$langs->trans(
"Genderother"));
645 print
$form->selectarray(
'gender', $arraygender,
GETPOST(
'gender',
'alphanohtml'), 1, 0, 0,
'', 0, 0, 0,
'',
'', 1);
649 print
'<tr><td>'.$langs->trans(
"Address").
'</td><td>'.
"\n";
650 print
'<textarea name="address" id="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.
'">'.
dol_escape_htmltag(
GETPOST(
'address',
'restricthtml'), 0, 1).
'</textarea></td></tr>'.
"\n";
653 print
'<tr><td>'.$langs->trans(
'Zip').
' / '.$langs->trans(
'Town').
'</td><td>';
654 print $formcompany->select_ziptown(
GETPOST(
'zipcode'),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 0, 1,
'',
'width75');
656 print $formcompany->select_ziptown(
GETPOST(
'town'),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'), 0, 1);
660 print
'<tr><td>'.$langs->trans(
'Country').
'</td><td>';
661 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
662 $country_id =
GETPOST(
'country_id',
'int');
663 if (!$country_id && !empty($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE)) {
664 $country_id =
getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE, 2, $db, $langs);
666 if (!$country_id && !empty($conf->geoipmaxmind->enabled)) {
670 $new_country_id =
getCountry($country_code, 3, $db, $langs);
672 if ($new_country_id) {
673 $country_id = $new_country_id;
677 $country_code =
getCountry($country_id, 2, $db, $langs);
678 print
$form->select_country($country_id,
'country_id');
681 if (empty($conf->global->SOCIETE_DISABLE_STATE)) {
682 print
'<tr><td>'.$langs->trans(
'State').
'</td><td>';
684 print $formcompany->select_state(
GETPOST(
"state_id"), $country_code);
690 print
'<tr id="trbirth" class="trbirth"><td>'.$langs->trans(
"DateOfBirth").
'</td><td>';
691 print
$form->selectDate(!empty($birthday) ? $birthday :
"",
'birth', 0, 0, 1,
"newmember", 1, 0);
692 print
'</td></tr>'.
"\n";
695 print
'<tr><td>'.$langs->trans(
"URLPhoto").
'</td><td><input type="text" name="photo" class="minwidth150" value="'.
dol_escape_htmltag(
GETPOST(
'photo')).
'"></td></tr>'.
"\n";
698 print
'<tr><td>'.$langs->trans(
"Public").
'</td><td><input type="checkbox" name="public"></td></tr>'.
"\n";
701 $tpl_context =
'public';
702 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
706 print
'<td class="tdtop">'.$langs->trans(
"Comments").
'</td>';
707 print
'<td class="tdtop"><textarea name="note_private" id="note_private" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.
'">'.
dol_escape_htmltag(
GETPOST(
'note_private',
'restricthtml'), 0, 1).
'</textarea></td>';
712 if (!empty($conf->global->MEMBER_NEWFORM_DOLIBARRTURNOVER)) {
713 $arraybudget = array(
'50'=>
'<= 100 000',
'100'=>
'<= 200 000',
'200'=>
'<= 500 000',
'300'=>
'<= 1 500 000',
'600'=>
'<= 3 000 000',
'1000'=>
'<= 5 000 000',
'2000'=>
'5 000 000+');
714 print
'<tr id="trbudget" class="trcompany"><td>'.$langs->trans(
"TurnoverOrBudget").
' <span style="color: red">*</span></td><td>';
715 print
$form->selectarray(
'budget', $arraybudget,
GETPOST(
'budget'), 1);
718 print
'<script type="text/javascript">
719 jQuery(document).ready(function () {
721 jQuery("#morphy").click(function() {
724 jQuery("#budget").change(function() {
725 if (jQuery("#budget").val() > 0) { jQuery(".amount").val(jQuery("#budget").val()); }
726 else { jQuery("#budget").val(\'\'); }
728 /*jQuery("#typeid").change(function() {
729 if (jQuery("#typeid").val()==1) { jQuery("#morphy").val(\'mor\'); }
730 if (jQuery("#typeid").val()==2) { jQuery("#morphy").val(\'phy\'); }
731 if (jQuery("#typeid").val()==3) { jQuery("#morphy").val(\'mor\'); }
732 if (jQuery("#typeid").val()==4) { jQuery("#morphy").val(\'mor\'); }
735 function initturnover() {
736 if (jQuery("#morphy").val()==\'phy\') {
737 jQuery(".amount").val(20);
738 jQuery("#trbudget").hide();
739 jQuery("#trcompany").hide();
741 if (jQuery("#morphy").val()==\'mor\') {
742 jQuery(".amount").val(\'\');
743 jQuery("#trcompany").show();
744 jQuery("#trbirth").hide();
745 jQuery("#trbudget").show();
746 if (jQuery("#budget").val() > 0) { jQuery(".amount").val(jQuery("#budget").val()); }
747 else { jQuery("#budget").val(\'\'); }
752 print
'</td></tr>'.
"\n";
755 if (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE)) {
756 $typeid = $conf->global->MEMBER_NEWFORM_FORCETYPE ? $conf->global->MEMBER_NEWFORM_FORCETYPE :
GETPOST(
'typeid',
'int');
758 $adht->fetch($typeid);
759 $caneditamount = $adht->caneditamount;
763 $amountbytype = $adht->amountByType(1);
764 $amount = empty($amountbytype[$typeid]) ? (isset($amount) ? $amount : 0) : $amountbytype[$typeid];
766 if ($caneditamount && empty($amount) && !empty($conf->global->MEMBER_NEWFORM_AMOUNT)) {
767 $amount = $conf->global->MEMBER_NEWFORM_AMOUNT;
770 if (empty($amount)) {
776 $showedamount = $amount>0? $amount: 0;
778 print
'<tr><td>'.$langs->trans(
"Subscription");
779 if (!empty($conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO)) {
780 print
' - <a href="'.$conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO.
'" rel="external" target="_blank" rel="noopener noreferrer">'.$langs->trans(
"SeeHere").
'</a>';
782 print
'</td><td class="nowrap">';
784 if (empty($amount) && !empty($conf->global->MEMBER_NEWFORM_AMOUNT)) {
785 $amount = $conf->global->MEMBER_NEWFORM_AMOUNT;
788 if (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT) || $caneditamount) {
789 print
'<input type="text" name="amount" id="amount" class="flat amount width50" value="'.$showedamount.
'">';
790 print
' '.$langs->trans(
"Currency".$conf->currency).
'<span class="opacitymedium"> – ';
791 print $amount > 0 ? $langs->trans(
"AnyAmountWithAdvisedAmount",
price($amount, 0, $langs, 1, -1, -1, $conf->currency)): $langs->trans(
"AnyAmountWithoutAdvisedAmount");
794 print
'<input type="hidden" name="amount" id="amount" class="flat amount" value="'.$showedamount.
'">';
795 print
'<input type="text" name="amount" id="amounthidden" class="flat amount width50" disabled value="'.$showedamount.
'">';
796 print
' '.$langs->trans(
"Currency".$conf->currency);
802 if (!empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) {
803 require_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
804 print
'<tr><td class="titlefield"><label for="email"><span class="fieldrequired">'.$langs->trans(
"SecurityCode").
'</span></label></td><td>';
805 print
'<span class="span-icon-security inline-block">';
806 print
'<input id="securitycode" placeholder="'.$langs->trans(
"SecurityCode").
'" class="flat input-icon-security width150" type="text" maxlength="5" name="code" tabindex="3" />';
808 print
'<span class="nowrap inline-block">';
809 print
'<img class="inline-block valignmiddle" src="'.DOL_URL_ROOT.
'/core/antispamimage.php" border="0" width="80" height="32" id="img_securitycode" />';
810 print
'<a class="inline-block valignmiddle" href="'.$php_self.
'" tabindex="4" data-role="button">'.
img_picto($langs->trans(
"Refresh"),
'refresh',
'id="captcha_refresh_img"').
'</a>';
820 print
'<div class="center">';
821 print
'<input type="submit" value="'.$langs->trans(
"GetMembershipButtonLabel").
'" id="submitsave" class="button">';
822 if (!empty($backtopage)) {
823 print
' <input type="submit" value="'.$langs->trans(
"Cancel").
'" id="submitcancel" class="button button-cancel">';
830 print
'</div></div>';
833 $measuringUnits =
new CUnits($db);
834 $result = $measuringUnits->fetchAll(
'',
'', 0, 0, array(
't.active' => 1));
836 foreach ($measuringUnits->records as $lines)
837 $units[$lines->short_label] = $langs->trans(ucfirst($lines->label));
841 $sql =
"SELECT d.rowid, d.libelle as label, d.subscription, d.amount, d.caneditamount, d.vote, d.note, d.duration, d.statut as status, d.morphy,";
842 $sql .=
" COUNT(a.rowid) AS membercount";
843 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent_type as d";
844 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"adherent as a";
845 $sql .=
" ON d.rowid = a.fk_adherent_type AND a.statut > 0";
846 $sql .=
" WHERE d.entity IN (".getEntity(
'member_type').
")";
847 $sql .=
" AND d.statut=1";
848 $sql .=
" GROUP BY d.rowid, d.libelle, d.subscription, d.amount, d.caneditamount, d.vote, d.note, d.duration, d.statut, d.morphy";
850 $result = $db->query($sql);
852 $num = $db->num_rows($result);
854 print
'<br><div class="div-table-responsive">';
855 print
'<table class="tagtable liste">'.
"\n";
856 print
'<input type="hidden" name="action" value="create">';
858 print
'<tr class="liste_titre">';
859 print
'<th>'.$langs->trans(
"Label").
'</th>';
860 print
'<th class="center">'.$langs->trans(
"MembershipDuration").
'</th>';
861 print
'<th class="center">'.$langs->trans(
"Amount").
'</th>';
862 print
'<th class="center">'.$langs->trans(
"MembersNature").
'</th>';
863 print
'<th class="center">'.$langs->trans(
"VoteAllowed").
'</th>';
864 if ($publiccounters) print
'<th class="center">'.$langs->trans(
"Members").
'</th>';
865 print
'<th class="center">'.$langs->trans(
"NewSubscription").
'</th>';
870 $objp = $db->fetch_object($result);
872 print
'<tr class="oddeven">';
873 print
'<td>'.dol_escape_htmltag($objp->label).
'</td>';
874 print
'<td class="nowrap">';
875 $unit = preg_replace(
"/[^a-zA-Z]+/",
"", $objp->duration);
876 print max(1, intval($objp->duration)).
' '.$units[$unit];
878 print
'<td class="center"><span class="amount nowrap">';
879 $displayedamount = max(intval($objp->amount), intval(
getDolGlobalInt(
"MEMBER_MIN_AMOUNT")));
880 $caneditamount = !empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT) || $objp->caneditamount;
881 if ($objp->subscription) {
882 if ($displayedamount > 0 || !$caneditamount) {
883 print $displayedamount.
' '.strtoupper($conf->currency);
885 if ($caneditamount && $displayedamount>0) {
886 print
$form->textwithpicto(
'', $langs->transnoentities(
"CanEditAmountShortForValues"), 1,
'help',
'', 0, 3);
887 } elseif ($caneditamount) {
888 print $langs->transnoentities(
"CanEditAmountShort");
893 print
'</span></td>';
894 print
'<td class="center">';
895 if ($objp->morphy ==
'phy') {
896 print $langs->trans(
"Physical");
897 } elseif ($objp->morphy ==
'mor') {
898 print $langs->trans(
"Moral");
900 print $langs->trans(
"MorAndPhy");
903 print
'<td class="center">'.yn($objp->vote).
'</td>';
904 $membercount = $objp->membercount>0? $objp->membercount:
"–";
905 if ($publiccounters) print
'<td class="center">'.$membercount.
'</td>';
906 print
'<td class="center"><button class="button button-save reposition" name="typeid" type="submit" name="submit" value="'.$objp->rowid.
'">'.$langs->trans(
"GetMembershipButtonLabel").
'</button></td>';
914 print
'<tr><td colspan="'.$colspan.
'" class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</td></tr>';
Class to manage members of a foundation.
Class to manage members type.
Class to send emails (with attachments or not) Usage: $mailfile = new CMailFile($subject,...
Class of dictionary type of thirdparty (used by imports)
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage translations.
getCountry($searchkey, $withcode='', $dbtouse=0, $outputlangs='', $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
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...
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='')
Show tabs of a record.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_user_country()
Return country code for current user.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
printCommonFooter($zone='private')
Print common footer : conf->global->MAIN_HTML_FOOTER js for switch of menu hider js for conf->global-...
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_now($mode='auto')
Return date for now.
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)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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...
dol_htmloutput_events($disabledoutputofmessages=0)
Print formated messages to output (Used to show messages on html output).
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...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null)
Return array of possible common substitutions.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isValidEmail($address, $acceptsupervisorkey=0, $acceptuserkey=0)
Return true if email syntax is ok.
getUserRemoteIP()
Return the IP of remote user.
dol_htmloutput_errors($mesgstring='', $mesgarray=array(), $keepembedded=0)
Print formated error messages to output (Used to show messages on html output).
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Ouput html header of a page.
llxHeaderVierge($title, $head="", $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='')
Show header for new member.
llxFooterVierge()
Show footer for new member.
httponly_accessforbidden($message=1, $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.