diff --git a/htdocs/adherents/admin/member.php b/htdocs/adherents/admin/member.php index 7d3fec544f1..9a7fb4843d7 100644 --- a/htdocs/adherents/admin/member.php +++ b/htdocs/adherents/admin/member.php @@ -322,134 +322,10 @@ foreach ($arrayofmodules as $file => $modCodeMember) { print ''; print ''; + + print "
"; -print '
'; -print ''; -print ''; - - -// Main options - -print load_fiche_titre($langs->trans("MemberMainOptions"), '', ''); - -print '
'; -print ''; -print ''; -print ''; -print ''; -print "\n"; - -// Start date of new membership -$startpoint = array(); -$startpoint[0] = $langs->trans("SubscriptionPayment"); -$startpoint["m"] = $langs->trans("Month"); -$startpoint["Y"] = $langs->trans("Year"); -print '\n"; - -// Delay to start the new membership ([+/-][0-99][Y/m/d], for instance, with "+4m", the subscription will start in 4 month.) -print '\n"; - -// Mail required for members -print '\n"; - -// Login/Pass required for members -print '\n"; - -// Send mail information is on by default -print '\n"; - -// Create an external user login for each new member subscription validated -print '\n"; - -// Create an external user login for each new member subscription validated -$linkofpubliclist = DOL_MAIN_URL_ROOT.'/public/members/public_list.php'.((isModEnabled('multicompany')) ? '?entity='.((int) $conf->entity) : ''); -print '\n"; - -// Allow members to change type on renewal forms -/* To test during next beta -print '\n"; -*/ - -// Insert subscription into bank account -print ''; -$arraychoices = array('0' => $langs->trans("None")); -if (isModEnabled("bank")) { - $arraychoices['bankdirect'] = $langs->trans("MoreActionBankDirect"); -} -if (isModEnabled("bank") && isModEnabled("societe") && isModEnabled('invoice')) { - $arraychoices['invoiceonly'] = $langs->trans("MoreActionInvoiceOnly"); -} -if (isModEnabled("bank") && isModEnabled("societe") && isModEnabled('invoice')) { - $arraychoices['bankviainvoice'] = $langs->trans("MoreActionBankViaInvoice"); -} -print ''; -print "\n"; - -// Use vat for invoice creation -if (isModEnabled('invoice')) { - print ''; - if (isModEnabled("bank")) { - print ''; - } else { - print ''; - } - print "\n"; - - if (isModEnabled("product") || isModEnabled("service")) { - print ''; - print ''; - } - print "\n"; -} - -print '
'.$langs->trans("Description").''.$langs->trans("Value").'
'; -print $langs->trans("MemberSubscriptionStartFirstDayOf"); -print ''; -$startfirstdayof = !getDolGlobalString('MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF') ? 0 : getDolGlobalString('MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF'); -print $form->selectarray("MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF", $startpoint, $startfirstdayof, 0); -print "
'; -print $langs->trans("MemberSubscriptionStartAfter"); -print ''; -print ''; -print "
'.$langs->trans("AdherentMailRequired").''; -print $form->selectyesno('ADHERENT_MAIL_REQUIRED', getDolGlobalInt('ADHERENT_MAIL_REQUIRED'), 1); -print "
'; -print $form->textwithpicto($langs->trans("AdherentLoginRequired"), $langs->trans("AdherentLoginRequiredDesc")); -print ''; -print $form->selectyesno('ADHERENT_LOGIN_NOT_REQUIRED', (getDolGlobalString('ADHERENT_LOGIN_NOT_REQUIRED') ? 0 : 1), 1); -print "
'.$langs->trans("MemberSendInformationByMailByDefault").''; -print $form->selectyesno('ADHERENT_DEFAULT_SENDINFOBYMAIL', getDolGlobalInt('ADHERENT_DEFAULT_SENDINFOBYMAIL', 0), 1); -print "
'.$langs->trans("MemberCreateAnExternalUserForSubscriptionValidated").''; -print $form->selectyesno('ADHERENT_CREATE_EXTERNAL_USER_LOGIN', getDolGlobalInt('ADHERENT_CREATE_EXTERNAL_USER_LOGIN', 0), 1); -print "
'.$langs->trans("Public", getDolGlobalString('MAIN_INFO_SOCIETE_NOM'), $linkofpubliclist).''; -print $form->selectyesno('MEMBER_PUBLIC_ENABLED', getDolGlobalInt('MEMBER_PUBLIC_ENABLED', 0), 1); -print "
'.$langs->trans("MemberAllowchangeOfType").''; -print $form->selectyesno('MEMBER_ALLOW_CHANGE_OF_TYPE', (getDolGlobalInt('MEMBER_ALLOW_CHANGE_OF_TYPE') ? 0 : 1), 1); -print "
'.$langs->trans("MoreActionsOnSubscription").''; -print $form->selectarray('ADHERENT_BANK_USE', $arraychoices, getDolGlobalString('ADHERENT_BANK_USE'), 0); -if (getDolGlobalString('ADHERENT_BANK_USE') == 'bankdirect' || getDolGlobalString('ADHERENT_BANK_USE') == 'bankviainvoice') { - print '
'.$langs->trans("ABankAccountMustBeDefinedOnPaymentModeSetup").'
'; -} -print '
'.$langs->trans("VATToUseForSubscriptions").''; - print $form->selectarray('ADHERENT_VAT_FOR_SUBSCRIPTIONS', array('0' => $langs->trans("NoVatOnSubscription"), 'defaultforfoundationcountry' => $langs->trans("Default")), getDolGlobalString('ADHERENT_VAT_FOR_SUBSCRIPTIONS', '0'), 0); - print ''; - print $langs->trans("WarningModuleNotActive", $langs->transnoentities("Module85Name")); - print '
'.$langs->trans("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS").''; - $selected = getDolGlobalString('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS'); - print img_picto('', 'product', 'class="pictofixedwidth"'); - $form->select_produits($selected, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', '', 0); - print '
'; -print '
'; - -print '
'; -print ''; -print '
'; - -print '
'; - - -print '
'; // Document templates for documents generated from member record @@ -591,6 +467,137 @@ print ''; print ''; +print '
'; + + +print '
'; +print ''; +print ''; +print ''; + + +// Main options + +print load_fiche_titre($langs->trans("MemberMainOptions"), '', ''); + +print '
'; +print ''; +print ''; +print ''; +print ''; +print "\n"; + +// Start date of new membership +$startpoint = array(); +$startpoint[0] = $langs->trans("SubscriptionPayment"); +$startpoint["m"] = $langs->trans("Month"); +$startpoint["Y"] = $langs->trans("Year"); +print '\n"; + +// Delay to start the new membership ([+/-][0-99][Y/m/d], for instance, with "+4m", the subscription will start in 4 month.) +print '\n"; + +// Mail required for members +print '\n"; + +// Login/Pass required for members +print '\n"; + +// Send mail information is on by default +print '\n"; + +// Create an external user login for each new member subscription validated +print '\n"; + +// Create an external user login for each new member subscription validated +$linkofpubliclist = DOL_MAIN_URL_ROOT.'/public/members/public_list.php'.((isModEnabled('multicompany')) ? '?entity='.((int) $conf->entity) : ''); +print '\n"; + +// Allow members to change type on renewal forms +/* To test during next beta +print '\n"; +*/ + +// Insert subscription into bank account +print ''; +$arraychoices = array('0' => $langs->trans("None")); +if (isModEnabled("bank")) { + $arraychoices['bankdirect'] = $langs->trans("MoreActionBankDirect"); +} +if (isModEnabled("bank") && isModEnabled("societe") && isModEnabled('invoice')) { + $arraychoices['invoiceonly'] = $langs->trans("MoreActionInvoiceOnly"); +} +if (isModEnabled("bank") && isModEnabled("societe") && isModEnabled('invoice')) { + $arraychoices['bankviainvoice'] = $langs->trans("MoreActionBankViaInvoice"); +} +print ''; +print "\n"; + +// Use vat for invoice creation +if (isModEnabled('invoice')) { + print ''; + if (isModEnabled("bank")) { + print ''; + } else { + print ''; + } + print "\n"; + + if (isModEnabled("product") || isModEnabled("service")) { + print ''; + print ''; + } + print "\n"; +} + +print '
'.$langs->trans("Description").''.$langs->trans("Value").'
'; +print $langs->trans("MemberSubscriptionStartFirstDayOf"); +print ''; +$startfirstdayof = !getDolGlobalString('MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF') ? 0 : getDolGlobalString('MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF'); +print $form->selectarray("MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF", $startpoint, $startfirstdayof, 0); +print "
'; +print $langs->trans("MemberSubscriptionStartAfter"); +print ''; +print ''; +print "
'.$langs->trans("AdherentMailRequired").''; +print $form->selectyesno('ADHERENT_MAIL_REQUIRED', getDolGlobalInt('ADHERENT_MAIL_REQUIRED'), 1); +print "
'; +print $form->textwithpicto($langs->trans("AdherentLoginRequired"), $langs->trans("AdherentLoginRequiredDesc")); +print ''; +print $form->selectyesno('ADHERENT_LOGIN_NOT_REQUIRED', (getDolGlobalString('ADHERENT_LOGIN_NOT_REQUIRED') ? 0 : 1), 1); +print "
'.$langs->trans("MemberSendInformationByMailByDefault").''; +print $form->selectyesno('ADHERENT_DEFAULT_SENDINFOBYMAIL', getDolGlobalInt('ADHERENT_DEFAULT_SENDINFOBYMAIL', 0), 1); +print "
'.$langs->trans("MemberCreateAnExternalUserForSubscriptionValidated").''; +print $form->selectyesno('ADHERENT_CREATE_EXTERNAL_USER_LOGIN', getDolGlobalInt('ADHERENT_CREATE_EXTERNAL_USER_LOGIN', 0), 1); +print "
'.$langs->trans("Public", getDolGlobalString('MAIN_INFO_SOCIETE_NOM'), $linkofpubliclist).''; +print $form->selectyesno('MEMBER_PUBLIC_ENABLED', getDolGlobalInt('MEMBER_PUBLIC_ENABLED', 0), 1); +print "
'.$langs->trans("MemberAllowchangeOfType").''; +print $form->selectyesno('MEMBER_ALLOW_CHANGE_OF_TYPE', (getDolGlobalInt('MEMBER_ALLOW_CHANGE_OF_TYPE') ? 0 : 1), 1); +print "
'.$langs->trans("MoreActionsOnSubscription").''; +print $form->selectarray('ADHERENT_BANK_USE', $arraychoices, getDolGlobalString('ADHERENT_BANK_USE'), 0); +if (getDolGlobalString('ADHERENT_BANK_USE') == 'bankdirect' || getDolGlobalString('ADHERENT_BANK_USE') == 'bankviainvoice') { + print '
'.$langs->trans("ABankAccountMustBeDefinedOnPaymentModeSetup").'
'; +} +print '
'.$langs->trans("VATToUseForSubscriptions").''; + print $form->selectarray('ADHERENT_VAT_FOR_SUBSCRIPTIONS', array('0' => $langs->trans("NoVatOnSubscription"), 'defaultforfoundationcountry' => $langs->trans("Default")), getDolGlobalString('ADHERENT_VAT_FOR_SUBSCRIPTIONS', '0'), 0); + print ''; + print $langs->trans("WarningModuleNotActive", $langs->transnoentities("Module85Name")); + print '
'.$langs->trans("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS").''; + $selected = getDolGlobalString('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS'); + print img_picto('', 'product', 'class="pictofixedwidth"'); + $form->select_produits($selected, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', '', 0); + print '
'; +print '
'; + +print '
'; +print ''; +print '
'; + +print '
'; + + +print '
'; + // Generation of cards for members @@ -598,6 +605,7 @@ print ''; print '
'; print ''; print ''; +print ''; print load_fiche_titre($langs->trans("MembersCards"), '', ''); @@ -610,7 +618,7 @@ print '
'; print ''; print ''; print ''; -print ''; +print ''; print "\n"; // Format of cards page @@ -653,7 +661,7 @@ print '
'.$langs->trans("Description").''.$form->textwithpicto($langs->trans("Value"), $helptext, 1, 'help', '', 0, 2, 'idhelptext').''.$form->textwithpicto($langs->trans("Value"), $helptext, 1, 'help', '', 0, 2, 'idhelptext').'
'; print '
'; print '
'; -print ''; +print ''; print '
'; print '
'; @@ -665,6 +673,7 @@ print '
'; print '
'; print ''; print ''; +print ''; print load_fiche_titre($langs->trans("MembersTickets"), '', ''); @@ -677,7 +686,7 @@ print '
'; print ''; print ''; print ''; -print ''; +print ''; print "\n"; // Format of labels page @@ -703,7 +712,7 @@ print '
'.$langs->trans("Description").''.$form->textwithpicto($langs->trans("Value"), $helptext, 1, 'help', '', 0, 2, 'idhelptext').''.$form->textwithpicto($langs->trans("Value"), $helptext, 1, 'help', '', 0, 2, 'idhelptext').'
'; print '
'; print '
'; -print ''; +print ''; print '
'; print '
'; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 711024650db..26293ecc5f5 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7467,7 +7467,7 @@ function get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart = ' // In a future, we may distribute directories on several levels depending on setup and object. // Here, $object->id, $object->ref and $modulepart are required. //var_dump($modulepart); - $path = dol_sanitizeFileName(empty($object->ref) ? (string) $object->id : $object->ref); + $path = dol_sanitizeFileName(empty($object->ref) ? (string) (property_exists($object, 'id') ? $object->id : '') : $object->ref); } if (empty($withoutslash) && !empty($path)) { diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 30dd4048d6a..174716bbd49 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1936,7 +1936,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr } // LEAFLET AND GEOMAN - if (!getDolGlobalString('MAIN_ALLOW_GEOPHP')) { + if (getDolGlobalString('MAIN_USE_GEOPHP')) { print '\n"; print '\n"; } @@ -2096,7 +2096,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr print ''."\n"; // Leaflet TODO use dolibarr files - if (!getDolGlobalString('MAIN_ALLOW_GEOPHP')) { + if (getDolGlobalString('MAIN_USE_GEOPHP')) { print ''."\n"; print ''."\n"; } diff --git a/htdocs/public/members/public_list.php b/htdocs/public/members/public_list.php index 1f2fcf4bac7..e8d692ec846 100644 --- a/htdocs/public/members/public_list.php +++ b/htdocs/public/members/public_list.php @@ -126,10 +126,36 @@ if (getDolGlobalString('MEMBER_PUBLIC_CSS')) { llxHeaderVierge($langs->trans("ListOfValidatedPublicMembers"), $morehead); $sql = "SELECT rowid, firstname, lastname, societe, zip, town, email, birth, photo"; + +$sqlfields = $sql; + $sql .= " FROM ".MAIN_DB_PREFIX."adherent"; $sql .= " WHERE entity = ".((int) $entity); $sql .= " AND statut = 1"; $sql .= " AND public = 1"; + +// Count total nb of records +$nbtotalofrecords = ''; +if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { + /* The fast and low memory method to get and count full list converts the sql into a sql count */ + $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql); + $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount); + + $resql = $db->query($sqlforcount); + if ($resql) { + $objforcount = $db->fetch_object($resql); + $nbtotalofrecords = $objforcount->nbtotalofrecords; + } else { + dol_print_error($db); + } + + if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0 + $page = 0; + $offset = 0; + } + $db->free($resql); +} + $sql .= $db->order($sortfield, $sortorder); $sql .= $db->plimit($conf->liste_limit + 1, $offset); //$sql = "SELECT d.rowid, d.firstname, d.lastname, d.societe, zip, town, d.email, t.libelle as type, d.morphy, d.statut, t.subscription"; @@ -137,13 +163,14 @@ $sql .= $db->plimit($conf->liste_limit + 1, $offset); //$sql .= " WHERE d.fk_adherent_type = t.rowid AND d.statut = $statut"; //$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit, $offset); + $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); $i = 0; $param = "&statut=$statut&sortorder=$sortorder&sortfield=$sortfield"; - print_barre_liste($langs->trans("ListOfValidatedPublicMembers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, 0, ''); + print_barre_liste($langs->trans("ListOfValidatedPublicMembers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, ''); print ''; print '';