28 require
'../../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/donation.lib.php';
31 require_once DOL_DOCUMENT_ROOT.
'/don/class/don.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
33 if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
36 $langs->loadLangs(array(
'admin',
'donations',
'accountancy',
'other'));
40 $action =
GETPOST(
'action',
'aZ09');
42 $label =
GETPOST(
'label',
'alpha');
43 $scandir =
GETPOST(
'scan_dir',
'alpha');
52 if ($action ==
'specimen')
54 $modele =
GETPOST(
'module',
'alpha');
57 $don->initAsSpecimen();
60 $dir = DOL_DOCUMENT_ROOT.
"/core/modules/dons/";
61 $file = $modele.
".modules.php";
62 if (file_exists($dir.$file))
65 require_once $dir.$file;
67 $obj =
new $classname($db);
69 if ($obj->write_file($don, $langs) > 0)
71 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=donation&file=SPECIMEN.html");
79 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
84 elseif ($action ==
'setdoc')
86 if (
dolibarr_set_const($db,
"DON_ADDON_MODEL", $value,
'chaine', 0,
'', $conf->entity))
90 $conf->global->DON_ADDON_MODEL = $value;
102 elseif ($action ==
'set')
105 } elseif ($action ==
'del')
110 if ($conf->global->DON_ADDON_MODEL ==
"$value")
dolibarr_del_const($db,
'DON_ADDON_MODEL', $conf->entity);
115 if ($action ==
'set_DONATION_ACCOUNTINGACCOUNT')
117 $account =
GETPOST(
'DONATION_ACCOUNTINGACCOUNT',
'alpha');
119 $res =
dolibarr_set_const($db,
"DONATION_ACCOUNTINGACCOUNT", $account,
'chaine', 0,
'', $conf->entity);
121 if (!($res > 0)) $error++;
131 if ($action ==
'set_DONATION_MESSAGE')
133 $freemessage =
GETPOST(
'DONATION_MESSAGE',
'restricthtml');
135 $res =
dolibarr_set_const($db,
"DONATION_MESSAGE", $freemessage,
'chaine', 0,
'', $conf->entity);
137 if (!($res > 0)) $error++;
150 if (preg_match(
'/set_([a-z0-9_\-]+)/i', $action, $reg))
155 header(
"Location: ".
$_SERVER[
"PHP_SELF"]);
162 if (preg_match(
'/del_([a-z0-9_\-]+)/i', $action, $reg))
167 header(
"Location: ".
$_SERVER[
"PHP_SELF"]);
178 $dir =
"../../core/modules/dons/";
179 $form =
new Form($db);
180 if (!empty($conf->accounting->enabled)) $formaccounting =
new FormAccounting($db);
182 llxHeader(
'', $langs->trans(
"DonationsSetup"),
'DonConfiguration');
183 $linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
198 $sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
199 $sql .=
" WHERE type = '".$db->escape($type).
"'";
200 $resql = $db->query($sql);
204 $num_rows = $db->num_rows(
$resql);
205 while ($i < $num_rows)
207 $array = $db->fetch_array(
$resql);
208 array_push($def, $array[0]);
215 print '<table class="noborder centpercent">';
216 print '<tr class="liste_titre">';
217 print '<td>'.$langs->trans(
"Name").
'</td>';
218 print '<td>'.$langs->trans(
"Description").
'</td>';
219 print '<td class="center" width="60">'.$langs->trans(
"Activated").
'</td>';
220 print '<td class="center" width="60">'.$langs->trans(
"Default").
'</td>';
221 print '<td class="center" width="80">'.$langs->trans(
"ShortInfo").
'</td>';
222 print '<td class="center" width="80">'.$langs->trans(
"Preview").
'</td>';
227 $handle = opendir($dir);
229 if (is_resource($handle))
231 while (($file = readdir($handle)) !==
false)
233 if (preg_match(
'/\.modules\.php$/i', $file))
235 $name = substr($file, 0,
dol_strlen($file) - 12);
236 $classname = substr($file, 0,
dol_strlen($file) - 12);
238 require_once $dir.
'/'.$file;
239 $module =
new $classname($db);
242 if ($module->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2)
continue;
243 if ($module->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1)
continue;
245 if ($module->isEnabled())
247 print '<tr class="oddeven"><td width=\"100\">';
251 print $module->description;
255 if (in_array($name, $def))
257 if ($conf->global->DON_ADDON_MODEL == $name)
259 print "<td class=\"center\">\n";
263 print "<td class=\"center\">\n";
264 print '<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setdoc&token='.
newToken().
'&value='.$name.
'&scan_dir='.$module->scandir.
'&label='.urlencode($module->name).
'">'.
img_picto($langs->trans(
"Enabled"),
'switch_on').
'</a>';
268 print "<td class=\"center\">\n";
269 print '<a href="'.$_SERVER[
"PHP_SELF"].
'?action=set&token='.
newToken().
'&value='.$name.
'&scan_dir='.$module->scandir.
'&label='.urlencode($module->name).
'">'.
img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
274 if ($conf->global->DON_ADDON_MODEL ==
"$name")
276 print "<td class=\"center\">";
280 print "<td class=\"center\">";
281 print '<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setdoc&token='.
newToken().
'&value='.$name.
'&scan_dir='.$module->scandir.
'&label='.urlencode($module->name).
'" alt="'.$langs->trans(
"Default").
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
286 $htmltooltip =
''.$langs->trans(
"Name").
': '.$module->name;
287 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.($module->type ? $module->type : $langs->trans(
"Unknown"));
288 if ($module->type ==
'pdf')
290 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.$module->page_largeur.
'/'.$module->page_hauteur;
292 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
293 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.
yn($module->option_logo, 1, 1);
294 $htmltooltip .=
'<br>'.$langs->trans(
"MultiLanguage").
': '.
yn($module->option_multilang, 1, 1);
295 print '<td class="center">';
296 print $form->textwithpicto(
'', $htmltooltip, -1, 0);
300 print '<td class="center">';
301 print '<a href="'.$_SERVER[
"PHP_SELF"].
'?action=specimen&module='.$name.
'" target="specimen">'.
img_object($langs->trans(
"Preview"),
'generic').
'</a>';
311 print '</table><br>';
318 print '<table class="noborder centpercent">';
319 print
'<tr class="liste_titre">';
320 print
'<td>'.$langs->trans(
"Parameters").
'</td>';
321 print
'<td width="60" class="center">'.$langs->trans(
"Value").
"</td>\n";
325 if (!empty($conf->societe->enabled)) {
326 print
'<tr class="oddeven">';
327 print
'<td colspan="2">';
328 print $langs->trans(
"DonationUseThirdparties");
330 print
'<td class="center">';
331 if ($conf->use_javascript_ajax) {
334 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
335 print $form->selectarray(
"DONATION_USE_THIRDPARTIES", $arrval, $conf->global->DONATION_USE_THIRDPARTIES);
341 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
342 print
'<input type="hidden" name="token" value="'.newToken().
'" />';
343 print
'<input type="hidden" name="action" value="set_DONATION_ACCOUNTINGACCOUNT" />';
345 print
'<tr class="oddeven">';
347 $label = $langs->trans(
"AccountAccounting");
348 print
'<label for="DONATION_ACCOUNTINGACCOUNT">'.$label.
'</label></td>';
349 print
'<td class="center">';
350 if (!empty($conf->accounting->enabled))
352 print $formaccounting->select_account($conf->global->DONATION_ACCOUNTINGACCOUNT,
'DONATION_ACCOUNTINGACCOUNT', 1,
'', 1, 1);
354 print
'<input type="text" size="10" id="DONATION_ACCOUNTINGACCOUNT" name="DONATION_ACCOUNTINGACCOUNT" value="'.$conf->global->DONATION_ACCOUNTINGACCOUNT.
'">';
356 print
'</td><td class="center">';
357 print
'<input type="submit" class="button" value="'.$langs->trans(
"Modify").
'" />';
358 print
"</td></tr>\n";
361 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
362 print
'<input type="hidden" name="token" value="'.newToken().
'" />';
363 print
'<input type="hidden" name="action" value="set_DONATION_MESSAGE" />';
365 print
'<tr class="oddeven"><td colspan="2">';
366 print $langs->trans(
"FreeTextOnDonations").
' '.
img_info($langs->trans(
"AddCRIfTooLong")).
'<br>';
367 print
'<textarea name="DONATION_MESSAGE" class="flat" cols="80">'.$conf->global->DONATION_MESSAGE.
'</textarea>';
368 print
'</td><td class="center">';
369 print
'<input type="submit" class="button" value="'.$langs->trans(
"Modify").
'" />';
370 print
"</td></tr>\n";
378 if (preg_match(
'/fr/i', $conf->global->MAIN_INFO_SOCIETE_COUNTRY))
383 print
'<table class="noborder centpercent">';
384 print
'<tr class="liste_titre">';
385 print
'<td>'.$langs->trans(
"Parameters").
'</td>'.
"\n";
386 print
'<td class="center">'.$langs->trans(
"Status").
'</td>'.
"\n";
389 print
'<tr class="oddeven">';
390 print
'<td width="80%">'.$langs->trans(
"DONATION_ART200").
'</td>';
391 print
'<td class="center">';
392 if ($conf->use_javascript_ajax) {
395 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
396 print $form->selectarray(
"DONATION_ART200", $arrval, $conf->global->DONATION_ART200);
400 print
'<tr class="oddeven">';
401 print
'<td width="80%">'.$langs->trans(
"DONATION_ART238").
'</td>';
402 print
'<td class="center">';
403 if ($conf->use_javascript_ajax) {
406 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
407 print $form->selectarray(
"DONATION_ART238", $arrval, $conf->global->DONATION_ART238);
411 print
'<tr class="oddeven">';
412 print
'<td width="80%">'.$langs->trans(
"DONATION_ART978").
'</td>';
413 print
'<td class="center">';
414 if ($conf->use_javascript_ajax) {
417 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
418 print $form->selectarray(
"DONATION_ART978", $arrval, $conf->global->DONATION_ART978);
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.
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.
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)
ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0, $strict=0, $forcereload=0, $marginleftonlyshort=2, $forcenoajax=0)
On/off button for constant.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
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.
Class to manage donations.
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...
img_info($titlealt= 'default')
Show info logo.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
donation_admin_prepare_head()
Prepare array with list of admin tabs.