164 global $conf, $langs;
170 if (!empty($conf->use_javascript_ajax)) {
171 print
"\n".
'<!-- Includes JS Footer of Dolibarr -->'.
"\n";
172 print
'<script src="'.DOL_URL_ROOT.
'/core/js/lib_foot.js.php?lang='.$langs->defaultlang.(!empty($ext) ?
'&'.$ext :
'').
'"></script>'.
"\n";
185$parameters = array();
187$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
193if (empty($reshook) && $action ==
'add') {
200 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
203 $errmsg .= $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Login")).
"<br>\n";
205 $sql =
"SELECT login FROM ".MAIN_DB_PREFIX.
"adherent WHERE login = '".$db->escape(
GETPOST(
'login')).
"'";
206 $result = $db->query($sql);
208 $num = $db->num_rows($result);
212 $langs->load(
"errors");
213 $errmsg .= $langs->trans(
"ErrorLoginAlreadyExists").
"<br>\n";
215 if (!GETPOSTISSET(
"pass1") || !GETPOSTISSET(
"pass2") ||
GETPOST(
"pass1",
'none') ==
'' ||
GETPOST(
"pass2",
'none') ==
'' ||
GETPOST(
"pass1",
'none') !=
GETPOST(
"pass2",
'none')) {
217 $langs->load(
"errors");
218 $errmsg .= $langs->trans(
"ErrorPasswordsMustMatch").
"<br>\n";
222 $errmsg .= $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"EMail")).
"<br>\n";
227 $errmsg .= $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Type")).
"<br>\n";
229 if (!in_array(
GETPOST(
'morphy'), array(
'mor',
'phy'))) {
231 $errmsg .= $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
'Nature')).
"<br>\n";
235 $errmsg .= $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Lastname")).
"<br>\n";
239 $errmsg .= $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Firstname")).
"<br>\n";
241 if (!empty($conf->global->ADHERENT_MAIL_REQUIRED) && empty(
GETPOST(
'email'))) {
243 $errmsg .= $langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'Email')).
"<br>\n";
245 $langs->load(
'errors');
247 $errmsg .= $langs->trans(
"ErrorBadEMail",
GETPOST(
"email")).
"<br>\n";
249 $birthday =
dol_mktime(
GETPOST(
"birthhour",
'int'),
GETPOST(
"birthmin",
'int'),
GETPOST(
"birthsec",
'int'),
GETPOST(
"birthmonth",
'int'),
GETPOST(
"birthday",
'int'),
GETPOST(
"birthyear",
'int'));
250 if (
GETPOST(
"birthmonth") && empty($birthday)) {
252 $langs->load(
"errors");
253 $errmsg .= $langs->trans(
"ErrorBadDateFormat").
"<br>\n";
255 if (!empty($conf->global->MEMBER_NEWFORM_DOLIBARRTURNOVER)) {
258 $errmsg .= $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"TurnoverOrBudget")).
"<br>\n";
263 if (!empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) {
264 $sessionkey =
'dol_antispam_value';
265 $ok = (array_key_exists($sessionkey, $_SESSION) ===
true && (strtolower($_SESSION[$sessionkey]) == strtolower($_POST[
'code'])));
268 $errmsg .= $langs->trans(
"ErrorBadValueForCode").
"<br>\n";
273 $public = GETPOSTISSET(
'public') ? 1 : 0;
279 $adh->public = $public;
280 $adh->firstname =
GETPOST(
'firstname');
281 $adh->lastname =
GETPOST(
'lastname');
282 $adh->gender =
GETPOST(
'gender');
283 $adh->civility_id =
GETPOST(
'civility_id');
284 $adh->societe =
GETPOST(
'societe');
285 $adh->address =
GETPOST(
'address');
286 $adh->zip =
GETPOST(
'zipcode');
288 $adh->email =
GETPOST(
'email');
289 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
290 $adh->login =
GETPOST(
'login');
293 $adh->photo =
GETPOST(
'photo');
295 $adh->state_id =
GETPOST(
'state_id',
'int');
297 $adh->note_private =
GETPOST(
'note_private');
299 $adh->birth = $birthday;
303 $nb_post_max =
getDolGlobalInt(
"MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 200);
308 if ($nb_post_max > 0) {
309 $sql =
"SELECT COUNT(ref) as nb_adh";
310 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent";
311 $sql .=
" WHERE ip = '".$db->escape($adh->ip).
"'";
312 $sql .=
" AND datec > '".$db->idate($minmonthpost).
"'";
313 $resql = $db->query($sql);
315 $num = $db->num_rows($resql);
319 $obj = $db->fetch_object($resql);
320 $nb_post_ip = $obj->nb_adh;
327 $extrafields->fetch_name_optionals_label($adh->table_element);
328 $ret = $extrafields->setOptionalsFromPost(
null, $adh);
331 $errmsg .= $adh->error;
334 if ($nb_post_max > 0 && $nb_post_ip >= $nb_post_max) {
336 $errmsg .= $langs->trans(
"AlreadyTooMuchPostOnThisIPAdress");
337 array_push($adh->errors, $langs->trans(
"AlreadyTooMuchPostOnThisIPAdress"));
341 $result = $adh->create($user);
343 require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
347 $adht->fetch($object->typeid);
349 if ($object->email) {
354 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
358 $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
360 $outputlangs->loadLangs(array(
"main",
"members"));
362 $arraydefaultmessage =
null;
363 $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_AUTOREGISTER;
365 if (!empty($labeltouse)) {
366 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
369 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
370 $subject = $arraydefaultmessage->topic;
371 $msg = $arraydefaultmessage->content;
379 if ($subjecttosend && $texttosend) {
380 $moreinheader =
'X-Dolibarr-Info: send_an_email by public/members/new.php'.
"\r\n";
382 $result = $object->sendEmail($texttosend, $subjecttosend, array(), array(), array(),
"",
"", 0, -1,
'', $moreinheader);
391 if (!empty($conf->global->MAIN_INFO_SOCIETE_MAIL) && !empty($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT) &&
392 !empty($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL)) {
394 $appli = constant(
'DOL_APPLICATION_TITLE');
395 if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
396 $appli = $conf->global->MAIN_APPLICATION_TITLE;
397 if (preg_match(
'/\d\.\d/', $appli)) {
398 if (!preg_match(
'/'.preg_quote(DOL_VERSION).
'/', $appli)) {
399 $appli .=
" (".DOL_VERSION.
")";
402 $appli .=
" ".DOL_VERSION;
405 $appli .=
" ".DOL_VERSION;
408 $to = $adh->makeSubstitution($conf->global->MAIN_INFO_SOCIETE_MAIL);
411 '['.$appli.
'] '.$conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT,
414 $adh->makeSubstitution($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL),
424 if (!$mailfile->sendfile()) {
425 dol_syslog($langs->trans(
"ErrorFailedToSendMail", $from, $to), LOG_ERR);
430 if (!empty($conf->global->ADHERENT_DEFAULT_CREATE_THIRDPARTY)) {
432 $result = $company->create_from_member($adh);
435 $errmsg .= join(
'<br>', $company->errors);
439 if (!empty($backtopage)) {
440 $urlback = $backtopage;
441 } elseif (!empty($conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION)) {
442 $urlback = $conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION;
445 $urlback = $_SERVER[
"PHP_SELF"].
"?action=added&token=".newToken();
448 if (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE) && $conf->global->MEMBER_NEWFORM_PAYONLINE !=
'-1') {
449 if (empty($adht->caneditamount)) {
454 $urlback = getOnlinePaymentUrl(0,
'member', $adh->ref,
price2num(
GETPOST(
'amount',
'alpha'),
'MT'),
'', 0);
457 $urlback .=
'&email='.urlencode(
GETPOST(
'email'));
459 if ($conf->global->MEMBER_NEWFORM_PAYONLINE !=
'-1' && $conf->global->MEMBER_NEWFORM_PAYONLINE !=
'all') {
460 $urlback .=
'&paymentmethod='.urlencode($conf->global->MEMBER_NEWFORM_PAYONLINE);
463 if (!empty($entity)) {
464 $urlback .=
'&entity='.((int) $entity);
469 $errmsg .= join(
'<br>', $adh->errors);
477 Header(
"Location: ".$urlback);
489if (empty($reshook) && $action ==
'added') {
494 print
'<div class="center">';
495 print $langs->trans(
"NewMemberbyWeb");
508$form =
new Form($db);
511$extrafields->fetch_name_optionals_label($object->table_element);
517print
load_fiche_titre(
img_picto(
'',
'member_nocolor',
'class="pictofixedwidth"').
' '.$langs->trans(
"NewSubscription"),
'',
'', 0, 0,
'center');
520print
'<div align="center">';
521print
'<div id="divsubscribe">';
523print
'<div class="center subscriptionformhelptext opacitymedium justify">';
524if (!empty($conf->global->MEMBER_NEWFORM_TEXT)) {
525 print $langs->trans($conf->global->MEMBER_NEWFORM_TEXT).
"<br>\n";
527 print $langs->trans(
"NewSubscriptionDesc",
getDolGlobalString(
"MAIN_INFO_SOCIETE_MAIL")).
"<br>\n";
535print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" name="newmember">'.
"\n";
536print
'<input type="hidden" name="token" value="'.newToken().
'" / >';
537print
'<input type="hidden" name="entity" value="'.$entity.
'" />';
539if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEWFORM_FORCETYPE) || $action ==
'create') {
540 print
'<input type="hidden" name="action" value="add" />';
543 $messagemandatory =
'<span class="">'.$langs->trans(
"FieldsWithAreMandatory",
'*').
'</span>';
549 print
'<script type="text/javascript">
550 jQuery(document).ready(function () {
551 jQuery(document).ready(function () {
552 function initmorphy()
554 console.log("Call initmorphy");
555 if (jQuery("#morphy").val() == \'phy\') {
556 jQuery("#trcompany").hide();
558 if (jQuery("#morphy").val() == \'mor\') {
559 jQuery("#trcompany").show();
563 jQuery("#morphy").change(function() {
566 jQuery("#selectcountry_id").change(function() {
567 document.newmember.action.value="create";
568 document.newmember.submit();
570 jQuery("#typeid").change(function() {
571 document.newmember.action.value="create";
572 document.newmember.submit();
579 print
'<table class="border" summary="form to subscribe" id="tablesubscribe">'.
"\n";
582 if (empty($conf->global->MEMBER_NEWFORM_FORCETYPE)) {
583 $listoftype = $adht->liste_array();
584 $tmp = array_keys($listoftype);
587 if (count($listoftype) == 1) {
588 $defaulttype = $tmp[0];
591 print
'<tr><td class="titlefield classfortooltip" title="'.dol_escape_htmltag($messagemandatory).
'">'.$langs->trans(
"Type").
' <span class="star">*</span></td><td>';
592 print $form->selectarray(
"typeid", $adht->liste_array(1),
GETPOST(
'typeid') ?
GETPOST(
'typeid') : $defaulttype, $isempty);
593 print
'</td></tr>'.
"\n";
595 $adht->fetch($conf->global->MEMBER_NEWFORM_FORCETYPE);
596 print
'<input type="hidden" id="typeid" name="typeid" value="'.$conf->global->MEMBER_NEWFORM_FORCETYPE.
'">';
600 $morphys[
"phy"] = $langs->trans(
"Physical");
601 $morphys[
"mor"] = $langs->trans(
"Moral");
602 if (empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY)) {
603 print
'<tr class="morphy"><td class="titlefield classfortooltip" title="'.dol_escape_htmltag($messagemandatory).
'">'.$langs->trans(
'MemberNature').
' <span class="star">*</span></td><td>'.
"\n";
604 print $form->selectarray(
"morphy", $morphys,
GETPOST(
'morphy'), 1);
605 print
'</td></tr>'.
"\n";
608 print
'<input type="hidden" id="morphy" name="morphy" value="'.$conf->global->MEMBER_NEWFORM_FORCEMORPHY.
'">';
612 print
'<tr id="trcompany" class="trcompany"><td>'.$langs->trans(
"Company").
'</td><td>';
613 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
614 print
'<input type="text" name="societe" class="minwidth150 widthcentpercentminusx" value="'.dol_escape_htmltag(
GETPOST(
'societe')).
'"></td></tr>'.
"\n";
617 print
'<tr><td class="titlefield">'.$langs->trans(
'UserTitle').
'</td><td>';
618 print $formcompany->select_civility(
GETPOST(
'civility_id'),
'civility_id').
'</td></tr>'.
"\n";
621 print
'<tr><td class="classfortooltip" title="'.dol_escape_htmltag($messagemandatory).
'">'.$langs->trans(
"Lastname").
' <span class="star">*</span></td><td><input type="text" name="lastname" class="minwidth150" value="'.
dol_escape_htmltag(
GETPOST(
'lastname')).
'"></td></tr>'.
"\n";
624 print
'<tr><td class="classfortooltip" title="'.dol_escape_htmltag($messagemandatory).
'">'.$langs->trans(
"Firstname").
' <span class="star">*</span></td><td><input type="text" name="firstname" class="minwidth150" value="'.
dol_escape_htmltag(
GETPOST(
'firstname')).
'"></td></tr>'.
"\n";
627 print
'<tr><td class="'.(getDolGlobalString(
"ADHERENT_MAIL_REQUIRED") ?
'classfortooltip' :
'').
'" title="'.
dol_escape_htmltag($messagemandatory).
'">'.$langs->trans(
"Email").(getDolGlobalString(
"ADHERENT_MAIL_REQUIRED") ?
' <span class="star">*</span>' :
'').
'</td><td>';
629 print
'<input type="text" name="email" maxlength="255" class="minwidth200" value="'.dol_escape_htmltag(
GETPOST(
'email')).
'"></td></tr>'.
"\n";
632 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
633 print
'<tr><td>'.$langs->trans(
"Login").
' <span class="star">*</span></td><td><input type="text" name="login" maxlength="50" class="minwidth100"value="'.
dol_escape_htmltag(
GETPOST(
'login')).
'"></td></tr>'.
"\n";
634 print
'<tr><td>'.$langs->trans(
"Password").
' <span class="star">*</span></td><td><input type="password" maxlength="128" name="pass1" class="minwidth100" value="'.
dol_escape_htmltag(
GETPOST(
"pass1",
"none", 2)).
'"></td></tr>'.
"\n";
635 print
'<tr><td>'.$langs->trans(
"PasswordRetype").
' <span class="star">*</span></td><td><input type="password" maxlength="128" name="pass2" class="minwidth100" value="'.
dol_escape_htmltag(
GETPOST(
"pass2",
"none", 2)).
'"></td></tr>'.
"\n";
639 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
641 $arraygender = array(
'man'=>$langs->trans(
"Genderman"),
'woman'=>$langs->trans(
"Genderwoman"),
'other'=>$langs->trans(
"Genderother"));
642 print $form->selectarray(
'gender', $arraygender,
GETPOST(
'gender',
'alphanohtml'), 1, 0, 0,
'', 0, 0, 0,
'',
'', 1);
646 print
'<tr><td>'.$langs->trans(
"Address").
'</td><td>'.
"\n";
647 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";
650 print
'<tr><td>'.$langs->trans(
'Zip').
' / '.$langs->trans(
'Town').
'</td><td>';
651 print $formcompany->select_ziptown(
GETPOST(
'zipcode'),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 0, 1,
'',
'width75');
653 print $formcompany->select_ziptown(
GETPOST(
'town'),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'), 0, 1);
657 print
'<tr><td>'.$langs->trans(
'Country').
'</td><td>';
658 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
659 $country_id =
GETPOST(
'country_id',
'int');
660 if (!$country_id && !empty($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE)) {
661 $country_id =
getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE, 2, $db, $langs);
663 if (!$country_id && !empty($conf->geoipmaxmind->enabled)) {
667 $new_country_id =
getCountry($country_code, 3, $db, $langs);
669 if ($new_country_id) {
670 $country_id = $new_country_id;
674 $country_code =
getCountry($country_id, 2, $db, $langs);
675 print $form->select_country($country_id,
'country_id');
678 if (empty($conf->global->SOCIETE_DISABLE_STATE)) {
679 print
'<tr><td>'.$langs->trans(
'State').
'</td><td>';
681 print $formcompany->select_state(
GETPOST(
"state_id"), $country_code);
687 print
'<tr id="trbirth" class="trbirth"><td>'.$langs->trans(
"DateOfBirth").
'</td><td>';
688 print $form->selectDate(!empty($birthday) ? $birthday :
"",
'birth', 0, 0, 1,
"newmember", 1, 0);
689 print
'</td></tr>'.
"\n";
692 print
'<tr><td>'.$langs->trans(
"URLPhoto").
'</td><td><input type="text" name="photo" class="minwidth150" value="'.
dol_escape_htmltag(
GETPOST(
'photo')).
'"></td></tr>'.
"\n";
695 if (!empty($conf->global->MEMBER_PUBLIC_ENABLED)) {
696 $linkofpubliclist = DOL_MAIN_URL_ROOT.
'/public/members/public_list.php'.((isModEnabled(
'multicompany')) ?
'?entity='.$conf->entity :
'');
697 $publiclabel = $langs->trans(
"Public",
getDolGlobalString(
'MAIN_INFO_SOCIETE_NOM'), $linkofpubliclist);
698 print
'<tr><td>'.$publiclabel.
'</td><td><input type="checkbox" name="public"></td></tr>'.
"\n";
702 $parameters[
'tpl_context']=
'public';
703 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
707 print
'<td class="tdtop">'.$langs->trans(
"Comments").
'</td>';
708 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>';
713 if (!empty($conf->global->MEMBER_NEWFORM_DOLIBARRTURNOVER)) {
714 $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+');
715 print
'<tr id="trbudget" class="trcompany"><td>'.$langs->trans(
"TurnoverOrBudget").
' <span class="star">*</span></td><td>';
716 print $form->selectarray(
'budget', $arraybudget,
GETPOST(
'budget'), 1);
719 print
'<script type="text/javascript">
720 jQuery(document).ready(function () {
722 jQuery("#morphy").click(function() {
725 jQuery("#budget").change(function() {
726 if (jQuery("#budget").val() > 0) { jQuery(".amount").val(jQuery("#budget").val()); }
727 else { jQuery("#budget").val(\'\'); }
729 /*jQuery("#typeid").change(function() {
730 if (jQuery("#typeid").val()==1) { jQuery("#morphy").val(\'mor\'); }
731 if (jQuery("#typeid").val()==2) { jQuery("#morphy").val(\'phy\'); }
732 if (jQuery("#typeid").val()==3) { jQuery("#morphy").val(\'mor\'); }
733 if (jQuery("#typeid").val()==4) { jQuery("#morphy").val(\'mor\'); }
736 function initturnover() {
737 if (jQuery("#morphy").val()==\'phy\') {
738 jQuery(".amount").val(20);
739 jQuery("#trbudget").hide();
740 jQuery("#trcompany").hide();
742 if (jQuery("#morphy").val()==\'mor\') {
743 jQuery(".amount").val(\'\');
744 jQuery("#trcompany").show();
745 jQuery("#trbirth").hide();
746 jQuery("#trbudget").show();
747 if (jQuery("#budget").val() > 0) { jQuery(".amount").val(jQuery("#budget").val()); }
748 else { jQuery("#budget").val(\'\'); }
753 print
'</td></tr>'.
"\n";
756 if (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE)) {
757 $typeid = $conf->global->MEMBER_NEWFORM_FORCETYPE ? $conf->global->MEMBER_NEWFORM_FORCETYPE :
GETPOST(
'typeid',
'int');
759 $adht->fetch($typeid);
760 $caneditamount = $adht->caneditamount;
764 $amountbytype = $adht->amountByType(1);
765 $amount = empty($amountbytype[$typeid]) ? (isset($amount) ? $amount : 0) : $amountbytype[$typeid];
767 if ($caneditamount && empty($amount) && !empty($conf->global->MEMBER_NEWFORM_AMOUNT)) {
768 $amount = $conf->global->MEMBER_NEWFORM_AMOUNT;
771 if (empty($amount)) {
777 $showedamount = $amount>0? $amount: 0;
779 print
'<tr><td>'.$langs->trans(
"Subscription");
780 if (!empty($conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO)) {
781 print
' - <a href="'.$conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO.
'" rel="external" target="_blank" rel="noopener noreferrer">'.$langs->trans(
"SeeHere").
'</a>';
783 print
'</td><td class="nowrap">';
785 if (empty($amount) && !empty($conf->global->MEMBER_NEWFORM_AMOUNT)) {
786 $amount = $conf->global->MEMBER_NEWFORM_AMOUNT;
789 if ($caneditamount) {
790 print
'<input type="text" name="amount" id="amount" class="flat amount width50" value="'.$showedamount.
'">';
791 print
' '.$langs->trans(
"Currency".$conf->currency).
'<span class="opacitymedium"> – ';
792 print $amount > 0 ? $langs->trans(
"AnyAmountWithAdvisedAmount",
price($amount, 0, $langs, 1, -1, -1, $conf->currency)): $langs->trans(
"AnyAmountWithoutAdvisedAmount");
795 print
'<input type="hidden" name="amount" id="amount" class="flat amount" value="'.$showedamount.
'">';
796 print
'<input type="text" name="amount" id="amounthidden" class="flat amount width50" disabled value="'.$showedamount.
'">';
797 print
' '.$langs->trans(
"Currency".$conf->currency);
803 if (!empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) {
804 require_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
805 print
'<tr><td class="titlefield"><label for="email"><span class="fieldrequired">'.$langs->trans(
"SecurityCode").
'</span></label></td><td>';
806 print
'<span class="span-icon-security inline-block">';
807 print
'<input id="securitycode" placeholder="'.$langs->trans(
"SecurityCode").
'" class="flat input-icon-security width150" type="text" maxlength="5" name="code" tabindex="3" />';
809 print
'<span class="nowrap inline-block">';
810 print
'<img class="inline-block valignmiddle" src="'.DOL_URL_ROOT.
'/core/antispamimage.php" border="0" width="80" height="32" id="img_securitycode" />';
811 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>';
821 print
'<div class="center">';
822 print
'<input type="submit" value="'.$langs->trans(
"GetMembershipButtonLabel").
'" id="submitsave" class="button">';
823 if (!empty($backtopage)) {
824 print
' <input type="submit" value="'.$langs->trans(
"Cancel").
'" id="submitcancel" class="button button-cancel">';
831 print
'</div></div>';
834 $measuringUnits =
new CUnits($db);
835 $result = $measuringUnits->fetchAll(
'',
'', 0, 0, array(
't.active' => 1));
837 foreach ($measuringUnits->records as $lines)
838 $units[$lines->short_label] = $langs->trans(ucfirst($lines->label));
843 $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,";
844 $sql .=
" COUNT(a.rowid) AS membercount";
845 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent_type as d";
846 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"adherent as a";
847 $sql .=
" ON d.rowid = a.fk_adherent_type AND a.statut > 0";
848 $sql .=
" WHERE d.entity IN (".getEntity(
'member_type').
")";
849 $sql .=
" AND d.statut=1";
850 $sql .=
" GROUP BY d.rowid, d.libelle, d.subscription, d.amount, d.caneditamount, d.vote, d.note, d.duration, d.statut, d.morphy";
852 $result = $db->query($sql);
854 $num = $db->num_rows($result);
856 print
'<br><div class="div-table-responsive">';
857 print
'<table class="tagtable liste">'.
"\n";
858 print
'<input type="hidden" name="action" value="create">';
860 print
'<tr class="liste_titre">';
861 print
'<th>'.$langs->trans(
"Label").
'</th>';
862 print
'<th class="center">'.$langs->trans(
"MembershipDuration").
'</th>';
863 print
'<th class="center">'.$langs->trans(
"Amount").
'</th>';
864 print
'<th class="center">'.$langs->trans(
"MembersNature").
'</th>';
865 if (empty($hidevoteallowed)) print
'<th class="center">'.$langs->trans(
"VoteAllowed").
'</th>';
866 if ($publiccounters) print
'<th class="center">'.$langs->trans(
"Members").
'</th>';
867 print
'<th class="center">'.$langs->trans(
"NewSubscription").
'</th>';
872 $objp = $db->fetch_object($result);
874 print
'<tr class="oddeven">';
875 print
'<td>'.dol_escape_htmltag($objp->label).
'</td>';
876 print
'<td class="nowrap">';
877 $unit = preg_replace(
"/[^a-zA-Z]+/",
"", $objp->duration);
878 print max(1, intval($objp->duration)).
' '.$units[$unit];
880 print
'<td class="center"><span class="amount nowrap">';
881 $displayedamount = max(intval($objp->amount), intval(
getDolGlobalInt(
"MEMBER_MIN_AMOUNT")));
882 $caneditamount = $objp->caneditamount;
883 if ($objp->subscription) {
884 if ($displayedamount > 0 || !$caneditamount) {
885 print $displayedamount.
' '.strtoupper($conf->currency);
887 if ($caneditamount && $displayedamount>0) {
888 print $form->textwithpicto(
'', $langs->transnoentities(
"CanEditAmountShortForValues"), 1,
'help',
'', 0, 3);
889 } elseif ($caneditamount) {
890 print $langs->transnoentities(
"CanEditAmountShort");
895 print
'</span></td>';
896 print
'<td class="center">';
897 if ($objp->morphy ==
'phy') {
898 print $langs->trans(
"Physical");
899 } elseif ($objp->morphy ==
'mor') {
900 print $langs->trans(
"Moral");
902 print $langs->trans(
"MorAndPhy");
905 if (empty($hidevoteallowed)) print
'<td class="center">'.yn($objp->vote).
'</td>';
906 $membercount = $objp->membercount>0? $objp->membercount:
"–";
907 if ($publiccounters) print
'<td class="center">'.$membercount.
'</td>';
908 print
'<td class="center"><button class="button button-save reposition" name="typeid" type="submit" name="submit" value="'.$objp->rowid.
'">'.$langs->trans(
"GetMembershipButtonLabel").
'</button></td>';
916 print
'<tr><td colspan="'.$colspan.
'" class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</td></tr>';