33 require
'../../main.inc.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/lib/member.lib.php';
38 $langs->loadLangs(array(
"admin",
"members"));
43 $choices = array(
'yesno',
'texte',
'chaine');
45 $value =
GETPOST(
'value',
'alpha');
46 $label =
GETPOST(
'label',
'alpha');
47 $scandir =
GETPOST(
'scandir',
'alpha');
50 $action =
GETPOST(
'action',
'aZ09');
57 include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
59 if ($action ==
'set_default') {
62 } elseif ($action ==
'del_default') {
65 if ($conf->global->MEMBER_ADDON_PDF_ODT ==
"$value") {
70 } elseif ($action ==
'setdoc') {
72 if (
dolibarr_set_const($db,
"MEMBER_ADDON_PDF_ODT", $value,
'chaine', 0,
'', $conf->entity)) {
75 $conf->global->MEMBER_ADDON_PDF_ODT = $value;
84 } elseif (preg_match(
'/set_([a-z0-9_\-]+)/i', $action, $reg)) {
87 header(
"Location: ".
$_SERVER[
"PHP_SELF"]);
92 } elseif (preg_match(
'/del_([a-z0-9_\-]+)/i', $action, $reg)) {
95 header(
"Location: ".
$_SERVER[
"PHP_SELF"]);
100 } elseif ($action ==
'updateall') {
102 $res1 = $res2 = $res3 = $res4 = $res5 = $res6 = 0;
103 $res1 =
dolibarr_set_const($db,
'ADHERENT_LOGIN_NOT_REQUIRED',
GETPOST(
'ADHERENT_LOGIN_NOT_REQUIRED',
'alpha') ? 0 : 1,
'chaine', 0,
'', $conf->entity);
104 $res2 =
dolibarr_set_const($db,
'ADHERENT_MAIL_REQUIRED',
GETPOST(
'ADHERENT_MAIL_REQUIRED',
'alpha'),
'chaine', 0,
'', $conf->entity);
105 $res3 =
dolibarr_set_const($db,
'ADHERENT_DEFAULT_SENDINFOBYMAIL',
GETPOST(
'ADHERENT_DEFAULT_SENDINFOBYMAIL',
'alpha'),
'chaine', 0,
'', $conf->entity);
106 $res4 =
dolibarr_set_const($db,
'ADHERENT_BANK_USE',
GETPOST(
'ADHERENT_BANK_USE',
'alpha'),
'chaine', 0,
'', $conf->entity);
108 if ($conf->facture->enabled) {
109 $res4 =
dolibarr_set_const($db,
'ADHERENT_VAT_FOR_SUBSCRIPTIONS',
GETPOST(
'ADHERENT_VAT_FOR_SUBSCRIPTIONS',
'alpha'),
'chaine', 0,
'', $conf->entity);
110 $res5 =
dolibarr_set_const($db,
'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS',
GETPOST(
'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS',
'alpha'),
'chaine', 0,
'', $conf->entity);
111 if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
112 $res6 =
dolibarr_set_const($db,
'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS',
GETPOST(
'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS',
'alpha'),
'chaine', 0,
'', $conf->entity);
115 if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0) {
125 if ($action ==
'update' || $action ==
'add') {
126 $constname =
GETPOST(
'constname',
'alpha');
127 $constvalue = (
GETPOST(
'constvalue_'.$constname) ?
GETPOST(
'constvalue_'.$constname) :
GETPOST(
'constvalue'));
129 if (($constname ==
'ADHERENT_CARD_TYPE' || $constname ==
'ADHERENT_ETIQUETTE_TYPE' || $constname ==
'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS') && $constvalue == -1) $constvalue =
'';
130 if ($constname ==
'ADHERENT_LOGIN_NOT_REQUIRED') {
131 if ($constvalue) $constvalue = 0;
132 else $constvalue = 1;
135 $consttype =
GETPOST(
'consttype',
'alpha');
136 $constnote =
GETPOST(
'constnote');
137 $res =
dolibarr_set_const($db, $constname, $constvalue, $choices[$consttype], 0, $constnote, $conf->entity);
139 if (!($res > 0)) $error++;
149 if ($action ==
'set') {
157 if ($action ==
'unset') {
170 $form =
new Form($db);
172 $help_url =
'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros';
174 llxHeader(
'', $langs->trans(
"MembersSetup"), $help_url);
177 $linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
185 print '<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
186 print '<input type="hidden" name="token" value="'.newToken().
'">';
187 print '<input type="hidden" name="action" value="updateall">';
190 print '<table class="noborder centpercent">';
191 print
'<tr class="liste_titre">';
192 print
'<td>'.$langs->trans(
"Description").
'</td>';
193 print
'<td>'.$langs->trans(
"Value").
'</td>';
197 print
'<tr class="oddeven"><td>'.$langs->trans(
"AdherentLoginRequired").
'</td><td>';
198 print $form->selectyesno(
'ADHERENT_LOGIN_NOT_REQUIRED', (!empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED) ? 0 : 1), 1);
199 print
"</td></tr>\n";
202 print
'<tr class="oddeven"><td>'.$langs->trans(
"AdherentMailRequired").
'</td><td>';
203 print $form->selectyesno(
'ADHERENT_MAIL_REQUIRED', (!empty($conf->global->ADHERENT_MAIL_REQUIRED) ? $conf->global->ADHERENT_MAIL_REQUIRED : 0), 1);
204 print
"</td></tr>\n";
207 print
'<tr class="oddeven"><td>'.$langs->trans(
"MemberSendInformationByMailByDefault").
'</td><td>';
208 print $form->selectyesno(
'ADHERENT_DEFAULT_SENDINFOBYMAIL', (!empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL) ? $conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL : 0), 1);
209 print
"</td></tr>\n";
212 print
'<tr class="oddeven"><td>'.$langs->trans(
"MoreActionsOnSubscription").
'</td>';
213 $arraychoices = array(
'0'=>$langs->trans(
"None"));
214 if (!empty($conf->banque->enabled)) $arraychoices[
'bankdirect'] = $langs->trans(
"MoreActionBankDirect");
215 if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) $arraychoices[
'invoiceonly'] = $langs->trans(
"MoreActionInvoiceOnly");
216 if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) $arraychoices[
'bankviainvoice'] = $langs->trans(
"MoreActionBankViaInvoice");
218 print $form->selectarray(
'ADHERENT_BANK_USE', $arraychoices, $conf->global->ADHERENT_BANK_USE, 0);
219 if ($conf->global->ADHERENT_BANK_USE ==
'bankdirect' || $conf->global->ADHERENT_BANK_USE ==
'bankviainvoice') {
220 print
'<br><div style="padding-top: 5px;"><span class="opacitymedium">'.$langs->trans(
"ABankAccountMustBeDefinedOnPaymentModeSetup").
'</span></div>';
226 if ($conf->facture->enabled) {
227 print
'<tr class="oddeven"><td>'.$langs->trans(
"VATToUseForSubscriptions").
'</td>';
228 if (!empty($conf->banque->enabled)) {
230 print $form->selectarray(
'ADHERENT_VAT_FOR_SUBSCRIPTIONS', array(
'0'=>$langs->trans(
"NoVatOnSubscription"),
'defaultforfoundationcountry'=>$langs->trans(
"Default")), (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) ?
'0' : $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS), 0);
233 print
'<td class="right">';
234 print $langs->trans(
"WarningModuleNotActive", $langs->transnoentities(
"Module85Name"));
239 if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
240 print
'<tr class="oddeven"><td>'.$langs->trans(
"ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS").
'</td>';
242 $form->select_produits($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS,
'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS',
'', 0);
250 print
'<div class="center">';
251 print
'<input type="submit" class="button" value="'.$langs->trans(
"Update").
'" name="Button">';
263 'ADHERENT_CARD_TYPE',
265 'ADHERENT_CARD_HEADER_TEXT',
266 'ADHERENT_CARD_TEXT',
267 'ADHERENT_CARD_TEXT_RIGHT',
268 'ADHERENT_CARD_FOOTER_TEXT'
273 $helptext =
'*'.$langs->trans(
"FollowingConstantsWillBeSubstituted").
'<br>';
274 $helptext .=
'__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
275 $helptext .=
'__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
276 $helptext .=
'__YEAR__, __MONTH__, __DAY__';
286 $constantes = array(
'ADHERENT_ETIQUETTE_TYPE',
'ADHERENT_ETIQUETTE_TEXT');
290 $helptext =
'*'.$langs->trans(
"FollowingConstantsWillBeSubstituted").
'<br>';
291 $helptext .=
'__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
292 $helptext .=
'__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
293 $helptext .=
'__YEAR__, __MONTH__, __DAY__';
296 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
301 $sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
302 $sql .=
" WHERE type = '".$db->escape($type).
"'";
303 $sql .=
" AND entity = ".$conf->entity;
304 $resql = $db->query($sql);
307 $num_rows = $db->num_rows(
$resql);
308 while ($i < $num_rows) {
309 $array = $db->fetch_array(
$resql);
310 array_push($def, $array[0]);
319 print
'<table class="noborder centpercent">';
320 print
'<tr class="liste_titre">';
321 print
'<td>'.$langs->trans(
"Name").
'</td>';
322 print
'<td>'.$langs->trans(
"Description").
'</td>';
323 print
'<td align="center" width="60">'.$langs->trans(
"Status").
"</td>\n";
324 print
'<td align="center" width="60">'.$langs->trans(
"Default").
"</td>\n";
325 print
'<td align="center" width="80">'.$langs->trans(
"ShortInfo").
'</td>';
326 print
'<td align="center" width="80">'.$langs->trans(
"Preview").
'</td>';
331 foreach ($dirmodels as $reldir) {
332 foreach (array(
'',
'/doc') as $valdir) {
335 $handle = opendir($dir);
336 if (is_resource($handle)) {
337 while (($file = readdir($handle)) !==
false) {
342 foreach ($filelist as $file) {
343 if (preg_match(
'/\.class\.php$/i', $file) && preg_match(
'/^(pdf_|doc_)/', $file)) {
344 if (file_exists($dir.
'/'.$file)) {
345 $name = substr($file, 4,
dol_strlen($file) - 14);
346 $classname = substr($file, 0,
dol_strlen($file) - 10);
348 require_once $dir.
'/'.$file;
349 $module =
new $classname($db);
351 $modulequalified = 1;
352 if ($module->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
353 if ($module->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
354 $modulequalified = 0;
357 if ($modulequalified) {
358 print
'<tr class="oddeven"><td width="100">';
359 print (empty($module->name) ? $name : $module->name);
361 if (method_exists($module,
'info')) {
362 print $module->info($langs);
364 print $module->description;
369 if (in_array($name, $def)) {
370 print
'<td class="center">'.
"\n";
371 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=del_default&token='.
newToken().
'&value='.$name.
'">';
372 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
376 print
'<td class="center">'.
"\n";
377 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=set_default&token='.
newToken().
'&value='.$name.
'&scandir='.$module->scandir.
'&label='.urlencode($module->name).
'">'.
img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
382 print
'<td class="center">';
383 if ($conf->global->MEMBER_ADDON_PDF == $name) {
384 print
img_picto($langs->trans(
"Default"),
'on');
386 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setdoc&token='.
newToken().
'&value='.$name.
'&scandir='.$module->scandir.
'&label='.urlencode($module->name).
'" alt="'.$langs->trans(
"Default").
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
391 $htmltooltip =
''.$langs->trans(
"Name").
': '.$module->name;
392 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.($module->type ? $module->type : $langs->trans(
"Unknown"));
393 if ($module->type ==
'pdf') {
394 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.$module->page_largeur.
'/'.$module->page_hauteur;
396 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
397 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.
yn($module->option_logo, 1, 1);
398 $htmltooltip .=
'<br>'.$langs->trans(
"MultiLanguage").
': '.
yn($module->option_multilang, 1, 1);
401 print
'<td class="center">';
402 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
406 print
'<td class="center">';
407 if ($module->type ==
'pdf')
409 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=specimen&module='.$name.
'">'.
img_object($langs->trans(
"Preview"),
'contract').
'</a>';
411 print
img_object($langs->trans(
"PreviewNotAvailable"),
'generic');
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
delDocumentModel($name, $type)
Delete document model used by doc generator.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
member_admin_prepare_head()
Return array head with list of tabs to view object informations.
dolibarr_set_const($db, $name, $value, $type= 'chaine', $visible=0, $note= '', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
addDocumentModel($name, $type, $label= '', $description= '')
Add document model used by doc generator.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
dol_strlen($string, $stringencoding= 'UTF-8')
Make a strlen call.
dolibarr_del_const($db, $name, $entity=1)
Effacement d'une constante dans la base de donnees.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
form_constantes($tableau, $strictw3c=0, $helptext= '')
Show array with constants to edit.
img_object($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_get_fiche_end($notab=0)
Return tab footer of a card.