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.
'"></script>'.
"\n";
185$parameters = array();
187$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
193if (empty($reshook) && $action ==
'add') {
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";
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";
258 $errmsg .= $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"TurnoverOrBudget")).
"<br>\n";
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');
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);
394 $appli = constant(
'DOL_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);
414 $adh->makeSubstitution($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL),
424 if (!$mailfile->sendfile()) {
425 dol_syslog($langs->trans(
"ErrorFailedToSendMail", $from, $to), LOG_ERR);
432 $result = $company->create_from_member($adh);
435 $errmsg .= join(
'<br>', $company->errors);
439 if (!empty($backtopage)) {
440 $urlback = $backtopage;
442 $urlback = $conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION;
445 $urlback = $_SERVER[
"PHP_SELF"].
"?action=added&token=".newToken();
449 if (empty($adht->caneditamount)) {
454 $urlback = getOnlinePaymentUrl(0,
'member', $adh->ref,
price2num(
GETPOST(
'amount',
'alpha'),
'MT'),
'', 0);
457 $urlback .=
'&email='.urlencode(
GETPOST(
'email'));
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">';
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.
'" />';
538print
'<input type="hidden" name="page_y" value="" />';
541 print
'<input type="hidden" name="action" value="add" />';
544 $messagemandatory =
'<span class="">'.$langs->trans(
"FieldsWithAreMandatory",
'*').
'</span>';
550 print
'<script type="text/javascript">
551 jQuery(document).ready(function () {
552 jQuery(document).ready(function () {
553 function initmorphy()
555 console.log("Call initmorphy");
556 if (jQuery("#morphy").val() == \'phy\') {
557 jQuery("#trcompany").hide();
559 if (jQuery("#morphy").val() == \'mor\') {
560 jQuery("#trcompany").show();
564 jQuery("#morphy").change(function() {
567 jQuery("#selectcountry_id").change(function() {
568 document.newmember.action.value="create";
569 document.newmember.submit();
571 jQuery("#typeid").change(function() {
572 document.newmember.action.value="create";
573 document.newmember.submit();
580 print
'<table class="border" summary="form to subscribe" id="tablesubscribe">'.
"\n";
584 $listoftype = $adht->liste_array();
585 $tmp = array_keys($listoftype);
588 if (count($listoftype) == 1) {
589 $defaulttype = $tmp[0];
592 print
'<tr><td class="titlefield classfortooltip" title="'.dol_escape_htmltag($messagemandatory).
'">'.$langs->trans(
"Type").
' <span class="star">*</span></td><td>';
593 print $form->selectarray(
"typeid", $adht->liste_array(1),
GETPOST(
'typeid') ?
GETPOST(
'typeid') : $defaulttype, $isempty);
594 print
'</td></tr>'.
"\n";
596 $adht->fetch($conf->global->MEMBER_NEWFORM_FORCETYPE);
597 print
'<input type="hidden" id="typeid" name="typeid" value="' .
getDolGlobalString(
'MEMBER_NEWFORM_FORCETYPE').
'">';
601 $morphys[
"phy"] = $langs->trans(
"Physical");
602 $morphys[
"mor"] = $langs->trans(
"Moral");
604 print
'<tr class="morphy"><td class="titlefield classfortooltip" title="'.dol_escape_htmltag($messagemandatory).
'">'.$langs->trans(
'MemberNature').
' <span class="star">*</span></td><td>'.
"\n";
605 print $form->selectarray(
"morphy", $morphys,
GETPOST(
'morphy'), 1);
606 print
'</td></tr>'.
"\n";
609 print
'<input type="hidden" id="morphy" name="morphy" value="' .
getDolGlobalString(
'MEMBER_NEWFORM_FORCEMORPHY').
'">';
613 print
'<tr id="trcompany" class="trcompany"><td>'.$langs->trans(
"Company").
'</td><td>';
614 print
img_picto(
'',
'company',
'class="pictofixedwidth paddingright"');
615 print
'<input type="text" name="societe" class="minwidth150 widthcentpercentminusx" value="'.dol_escape_htmltag(
GETPOST(
'societe')).
'"></td></tr>'.
"\n";
619 print
'<tr><td class="titlefield">'.$langs->trans(
'UserTitle').
'</td><td>';
620 print $formcompany->select_civility(
GETPOST(
'civility_id'),
'civility_id').
'</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="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";
630 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>';
632 print
'<input type="text" name="email" maxlength="255" class="minwidth200" value="'.dol_escape_htmltag(
GETPOST(
'email')).
'"></td></tr>'.
"\n";
636 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";
637 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";
638 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";
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 paddingright"');
662 $country_id =
GETPOST(
'country_id',
'int');
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');
682 print
'<tr><td>'.$langs->trans(
'State').
'</td><td>';
684 print
img_picto(
'',
'state',
'class="pictofixedwidth paddingright"');
685 print $formcompany->select_state(
GETPOST(
"state_id"), $country_code);
691 print
'<tr id="trbirth" class="trbirth"><td>'.$langs->trans(
"DateOfBirth").
'</td><td>';
692 print $form->selectDate(!empty($birthday) ? $birthday :
"",
'birth', 0, 0, 1,
"newmember", 1, 0);
693 print
'</td></tr>'.
"\n";
696 print
'<tr><td>'.$langs->trans(
"URLPhoto").
'</td><td><input type="text" name="photo" class="minwidth200" value="'.
dol_escape_htmltag(
GETPOST(
'photo')).
'"></td></tr>'.
"\n";
700 $linkofpubliclist = DOL_MAIN_URL_ROOT.
'/public/members/public_list.php'.((isModEnabled(
'multicompany')) ?
'?entity='.$conf->entity :
'');
701 $publiclabel = $langs->trans(
"Public",
getDolGlobalString(
'MAIN_INFO_SOCIETE_NOM'), $linkofpubliclist);
702 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"MembershipPublic"), $publiclabel).
'</td><td><input type="checkbox" name="public"></td></tr>'.
"\n";
706 $parameters[
'tpl_context']=
'public';
707 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
711 print
'<td class="tdtop">'.$langs->trans(
"Comments").
'</td>';
712 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>';
718 $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+');
719 print
'<tr id="trbudget" class="trcompany"><td>'.$langs->trans(
"TurnoverOrBudget").
' <span class="star">*</span></td><td>';
720 print $form->selectarray(
'budget', $arraybudget,
GETPOST(
'budget'), 1);
723 print
'<script type="text/javascript">
724 jQuery(document).ready(function () {
726 jQuery("#morphy").click(function() {
729 jQuery("#budget").change(function() {
730 if (jQuery("#budget").val() > 0) { jQuery(".amount").val(jQuery("#budget").val()); }
731 else { jQuery("#budget").val(\'\'); }
733 /*jQuery("#typeid").change(function() {
734 if (jQuery("#typeid").val()==1) { jQuery("#morphy").val(\'mor\'); }
735 if (jQuery("#typeid").val()==2) { jQuery("#morphy").val(\'phy\'); }
736 if (jQuery("#typeid").val()==3) { jQuery("#morphy").val(\'mor\'); }
737 if (jQuery("#typeid").val()==4) { jQuery("#morphy").val(\'mor\'); }
740 function initturnover() {
741 if (jQuery("#morphy").val()==\'phy\') {
742 jQuery(".amount").val(20);
743 jQuery("#trbudget").hide();
744 jQuery("#trcompany").hide();
746 if (jQuery("#morphy").val()==\'mor\') {
747 jQuery(".amount").val(\'\');
748 jQuery("#trcompany").show();
749 jQuery("#trbirth").hide();
750 jQuery("#trbudget").show();
751 if (jQuery("#budget").val() > 0) { jQuery(".amount").val(jQuery("#budget").val()); }
752 else { jQuery("#budget").val(\'\'); }
757 print
'</td></tr>'.
"\n";
761 $typeid = $conf->global->MEMBER_NEWFORM_FORCETYPE ? $conf->global->MEMBER_NEWFORM_FORCETYPE :
GETPOST(
'typeid',
'int');
763 $adht->fetch($typeid);
764 $caneditamount = $adht->caneditamount;
768 $amountbytype = $adht->amountByType(1);
769 $amount = empty($amountbytype[$typeid]) ? (isset($amount) ? $amount : 0) : $amountbytype[$typeid];
771 if ($caneditamount && empty($amount) &&
getDolGlobalString(
'MEMBER_NEWFORM_AMOUNT')) {
772 $amount = $conf->global->MEMBER_NEWFORM_AMOUNT;
775 if (empty($amount)) {
781 $showedamount = $amount>0 ? $amount : 0;
783 print
'<tr><td>'.$langs->trans(
"Subscription");
785 print
' - <a href="' .
getDolGlobalString(
'MEMBER_EXT_URL_SUBSCRIPTION_INFO').
'" rel="external" target="_blank" rel="noopener noreferrer">'.$langs->trans(
"SeeHere").
'</a>';
787 print
'</td><td class="nowrap">';
790 $amount = $conf->global->MEMBER_NEWFORM_AMOUNT;
793 if ($caneditamount) {
794 print
'<input type="text" name="amount" id="amount" class="flat amount width50" value="'.$showedamount.
'">';
795 print
' '.$langs->trans(
"Currency".$conf->currency).
'<span class="opacitymedium"> – ';
796 print $amount > 0 ? $langs->trans(
"AnyAmountWithAdvisedAmount",
price($amount, 0, $langs, 1, -1, -1, $conf->currency)) : $langs->trans(
"AnyAmountWithoutAdvisedAmount");
799 print
'<input type="hidden" name="amount" id="amount" class="flat amount" value="'.$showedamount.
'">';
800 print
'<input type="text" name="amount" id="amounthidden" class="flat amount width50" disabled value="'.$showedamount.
'">';
801 print
' '.$langs->trans(
"Currency".$conf->currency);
808 require_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
809 print
'<tr><td class="titlefield"><label for="email"><span class="fieldrequired">'.$langs->trans(
"SecurityCode").
'</span></label></td><td>';
810 print
'<span class="span-icon-security inline-block">';
811 print
'<input id="securitycode" placeholder="'.$langs->trans(
"SecurityCode").
'" class="flat input-icon-security width150" type="text" maxlength="5" name="code" tabindex="3" />';
813 print
'<span class="nowrap inline-block">';
814 print
'<img class="inline-block valignmiddle" src="'.DOL_URL_ROOT.
'/core/antispamimage.php" border="0" width="80" height="32" id="img_securitycode" />';
815 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>';
825 print
'<div class="center">';
826 print
'<input type="submit" value="'.$langs->trans(
"GetMembershipButtonLabel").
'" id="submitsave" class="button">';
827 if (!empty($backtopage)) {
828 print
' <input type="submit" value="'.$langs->trans(
"Cancel").
'" id="submitcancel" class="button button-cancel">';
835 print
'</div></div>';
838 $measuringUnits =
new CUnits($db);
839 $result = $measuringUnits->fetchAll(
'',
'', 0, 0, array(
't.active' => 1));
841 foreach ($measuringUnits->records as $lines) {
842 $units[$lines->short_label] = $langs->trans(ucfirst($lines->label));
848 $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,";
849 $sql .=
" COUNT(a.rowid) AS membercount";
850 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent_type as d";
851 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"adherent as a";
852 $sql .=
" ON d.rowid = a.fk_adherent_type AND a.statut > 0";
853 $sql .=
" WHERE d.entity IN (".getEntity(
'member_type').
")";
854 $sql .=
" AND d.statut=1";
855 $sql .=
" GROUP BY d.rowid, d.libelle, d.subscription, d.amount, d.caneditamount, d.vote, d.note, d.duration, d.statut, d.morphy";
857 $result = $db->query($sql);
859 $num = $db->num_rows($result);
861 print
'<br><div class="div-table-responsive">';
862 print
'<table class="tagtable liste">'.
"\n";
863 print
'<input type="hidden" name="action" value="create">';
865 print
'<tr class="liste_titre">';
866 print
'<th>'.$langs->trans(
"Label").
'</th>';
867 print
'<th class="center">'.$langs->trans(
"MembershipDuration").
'</th>';
868 print
'<th class="center">'.$langs->trans(
"Amount").
'</th>';
869 print
'<th class="center">'.$langs->trans(
"MembersNature").
'</th>';
870 if (empty($hidevoteallowed)) {
871 print
'<th class="center">'.$langs->trans(
"VoteAllowed").
'</th>';
873 if ($publiccounters) {
874 print
'<th class="center">'.$langs->trans(
"Members").
'</th>';
876 print
'<th class="center">'.$langs->trans(
"NewSubscription").
'</th>';
881 $objp = $db->fetch_object($result);
883 print
'<tr class="oddeven">';
885 print
'<td>'.dol_escape_htmltag($objp->label).
'</td>';
887 print
'<td class="center">';
888 $unit = preg_replace(
"/[^a-zA-Z]+/",
"", $objp->duration);
889 print max(1, intval($objp->duration)).
' '.$units[$unit];
892 print
'<td class="center"><span class="amount nowrap">';
893 $displayedamount = max(intval($objp->amount), intval(
getDolGlobalInt(
"MEMBER_MIN_AMOUNT")));
894 $caneditamount = $objp->caneditamount;
895 if ($objp->subscription) {
896 if ($displayedamount > 0 || !$caneditamount) {
897 print
price($displayedamount, 1, $langs, 1, 0, -1, $conf->currency);
899 if ($caneditamount && $displayedamount>0) {
900 print $form->textwithpicto(
'', $langs->transnoentities(
"CanEditAmountShortForValues"), 1,
'help',
'', 0, 3);
901 } elseif ($caneditamount) {
902 print $langs->transnoentities(
"CanEditAmountShort");
907 print
'</span></td>';
908 print
'<td class="center">';
909 if ($objp->morphy ==
'phy') {
910 print $langs->trans(
"Physical");
911 } elseif ($objp->morphy ==
'mor') {
912 print $langs->trans(
"Moral");
914 print $langs->trans(
"MorAndPhy");
917 if (empty($hidevoteallowed)) {
918 print
'<td class="center">'.yn($objp->vote).
'</td>';
920 $membercount = $objp->membercount>0 ? $objp->membercount :
"–";
921 if ($publiccounters) {
922 print
'<td class="center">'.$membercount.
'</td>';
924 print
'<td class="center"><button class="button button-save reposition" name="typeid" type="submit" name="submit" value="'.$objp->rowid.
'">'.$langs->trans(
"GetMembershipButtonLabel").
'</button></td>';
932 print
'<tr><td colspan="'.$colspan.
'" class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</td></tr>';
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs=array(), $arrayofcss=array(), $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Ouput html header of a page.