28require
'../../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/donation.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/don/class/don.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
33if (isModEnabled(
'accounting')) {
34 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
38$langs->loadLangs(array(
'admin',
'donations',
'accountancy',
'other'));
44$action =
GETPOST(
'action',
'aZ09');
46$label =
GETPOST(
'label',
'alpha');
47$scandir =
GETPOST(
'scan_dir',
'alpha');
56if ($action ==
'specimen') {
57 $modele =
GETPOST(
'module',
'alpha');
60 $don->initAsSpecimen();
63 $dir = DOL_DOCUMENT_ROOT.
"/core/modules/dons/";
64 $file = $modele.
".modules.php";
65 if (file_exists($dir.$file)) {
67 require_once $dir.$file;
69 $obj =
new $classname($db);
71 if ($obj->write_file($don, $langs) > 0) {
72 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=donation&file=SPECIMEN.html");
80 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
82} elseif ($action ==
'setdoc') {
84 if (
dolibarr_set_const($db,
"DON_ADDON_MODEL", $value,
'chaine', 0,
'', $conf->entity)) {
87 $conf->global->DON_ADDON_MODEL = $value;
95} elseif ($action ==
'set') {
98} elseif ($action ==
'del') {
101 if ($conf->global->DON_ADDON_MODEL ==
"$value") {
108if ($action ==
'set_DONATION_ACCOUNTINGACCOUNT') {
109 $account =
GETPOST(
'DONATION_ACCOUNTINGACCOUNT',
'alpha');
111 $res =
dolibarr_set_const($db,
"DONATION_ACCOUNTINGACCOUNT", $account,
'chaine', 0,
'', $conf->entity);
126if ($action ==
'set_DONATION_MESSAGE') {
127 $freemessage =
GETPOST(
'DONATION_MESSAGE',
'restricthtml');
129 $res =
dolibarr_set_const($db,
"DONATION_MESSAGE", $freemessage,
'chaine', 0,
'', $conf->entity);
146if (preg_match(
'/set_([a-z0-9_\-]+)/i', $action, $reg)) {
149 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
156if (preg_match(
'/del_([a-z0-9_\-]+)/i', $action, $reg)) {
159 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
170$dir =
"../../core/modules/dons/";
171$form =
new Form($db);
172if (isModEnabled(
'accounting')) {
176llxHeader(
'', $langs->trans(
"DonationsSetup"),
'DonConfiguration');
177$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
178print
load_fiche_titre($langs->trans(
"DonationsSetup"), $linkback,
'title_setup');
192$sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
193$sql .=
" WHERE type = '".$db->escape($type).
"'";
194$resql = $db->query($sql);
197 $num_rows = $db->num_rows($resql);
198 while ($i < $num_rows) {
199 $array = $db->fetch_array($resql);
200 array_push($def, $array[0]);
207print
'<table class="noborder centpercent">';
208print
'<tr class="liste_titre">';
209print
'<td>'.$langs->trans(
"Name").
'</td>';
210print
'<td>'.$langs->trans(
"Description").
'</td>';
211print
'<td class="center" width="60">'.$langs->trans(
"Activated").
'</td>';
212print
'<td class="center" width="60">'.$langs->trans(
"Default").
'</td>';
213print
'<td class="center" width="80">'.$langs->trans(
"ShortInfo").
'</td>';
214print
'<td class="center" width="80">'.$langs->trans(
"Preview").
'</td>';
219$handle = opendir($dir);
221if (is_resource($handle)) {
222 while (($file = readdir($handle)) !==
false) {
223 if (preg_match(
'/\.modules\.php$/i', $file)) {
224 $name = substr($file, 0,
dol_strlen($file) - 12);
225 $classname = substr($file, 0,
dol_strlen($file) - 12);
227 require_once $dir.
'/'.$file;
228 $module =
new $classname($db);
231 if ($module->version ==
'development' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2) {
234 if ($module->version ==
'experimental' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1) {
238 if ($module->isEnabled()) {
239 print
'<tr class="oddeven"><td width=\"100\">';
243 print $module->description;
247 if (in_array($name, $def)) {
248 if ($conf->global->DON_ADDON_MODEL == $name) {
249 print
"<td class=\"center\">\n";
250 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
253 print
"<td class=\"center\">\n";
254 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setdoc&token='.newToken().
'&value='.urlencode($name).
'&scan_dir='.urlencode($module->scandir).
'&label='.urlencode($module->name).
'">'.
img_picto($langs->trans(
"Enabled"),
'switch_on').
'</a>';
258 print
"<td class=\"center\">\n";
259 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=set&token='.newToken().
'&value='.urlencode($name).
'&scan_dir='.urlencode($module->scandir).
'&label='.urlencode($module->name).
'">'.
img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
264 if ($conf->global->DON_ADDON_MODEL ==
"$name") {
265 print
"<td class=\"center\">";
266 print
img_picto($langs->trans(
"Default"),
'on');
269 print
"<td class=\"center\">";
270 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setdoc&token='.newToken().
'&value='.urlencode($name).
'&scan_dir='.urlencode($module->scandir).
'&label='.urlencode($module->name).
'" alt="'.$langs->trans(
"Default").
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
275 $htmltooltip =
''.$langs->trans(
"Name").
': '.$module->name;
276 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.($module->type ? $module->type : $langs->trans(
"Unknown"));
277 if ($module->type ==
'pdf') {
278 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.$module->page_largeur.
'/'.$module->page_hauteur;
280 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
281 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.
yn($module->option_logo, 1, 1);
282 $htmltooltip .=
'<br>'.$langs->trans(
"MultiLanguage").
': '.
yn($module->option_multilang, 1, 1);
283 print
'<td class="center">';
284 print $form->textwithpicto(
'', $htmltooltip, -1, 0);
288 print
'<td class="center">';
289 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=specimen&module='.$name.
'" target="specimen">'.
img_object($langs->trans(
"Preview"),
'generic').
'</a>';
306print
'<table class="noborder centpercent">';
307print
'<tr class="liste_titre">';
308print
'<td>'.$langs->trans(
"Parameters").
'</td>';
309print
'<td width="60" class="center">'.$langs->trans(
"Value").
"</td>\n";
313if (isModEnabled(
"societe")) {
314 print
'<tr class="oddeven">';
315 print
'<td colspan="2">';
316 print $langs->trans(
"DonationUseThirdparties");
318 print
'<td class="center">';
319 if ($conf->use_javascript_ajax) {
320 print ajax_constantonoff(
'DONATION_USE_THIRDPARTIES');
322 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
323 print $form->selectarray(
"DONATION_USE_THIRDPARTIES", $arrval, $conf->global->DONATION_USE_THIRDPARTIES);
329print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
330print
'<input type="hidden" name="token" value="'.newToken().
'" />';
331print
'<input type="hidden" name="action" value="set_DONATION_ACCOUNTINGACCOUNT" />';
333print
'<tr class="oddeven">';
335$label = $langs->trans(
"AccountAccounting");
336print
'<label for="DONATION_ACCOUNTINGACCOUNT">'.$label.
'</label></td>';
337print
'<td class="center">';
338if (isModEnabled(
'accounting')) {
339 print $formaccounting->select_account($conf->global->DONATION_ACCOUNTINGACCOUNT,
'DONATION_ACCOUNTINGACCOUNT', 1,
'', 1, 1);
341 print
'<input type="text" size="10" id="DONATION_ACCOUNTINGACCOUNT" name="DONATION_ACCOUNTINGACCOUNT" value="' .
getDolGlobalString(
'DONATION_ACCOUNTINGACCOUNT').
'">';
343print
'</td><td class="center">';
344print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'" />';
348print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
349print
'<input type="hidden" name="token" value="'.newToken().
'" />';
350print
'<input type="hidden" name="action" value="set_DONATION_MESSAGE" />';
352print
'<tr class="oddeven"><td colspan="2">';
353print $langs->trans(
"FreeTextOnDonations").
' '.
img_info($langs->trans(
"AddCRIfTooLong")).
'<br>';
354print
'<textarea name="DONATION_MESSAGE" class="flat" cols="80">' .
getDolGlobalString(
'DONATION_MESSAGE').
'</textarea>';
355print
'</td><td class="center">';
356print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'" />';
365if (preg_match(
'/fr/i', $conf->global->MAIN_INFO_SOCIETE_COUNTRY)) {
369 print
'<table class="noborder centpercent">';
370 print
'<tr class="liste_titre">';
371 print
'<td>'.$langs->trans(
"Parameters").
'</td>'.
"\n";
372 print
'<td class="center">'.$langs->trans(
"Status").
'</td>'.
"\n";
375 print
'<tr class="oddeven">';
376 print
'<td width="80%">'.$langs->trans(
"DONATION_ART200").
'</td>';
377 print
'<td class="center">';
378 if ($conf->use_javascript_ajax) {
379 print ajax_constantonoff(
'DONATION_ART200');
381 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
382 print $form->selectarray(
"DONATION_ART200", $arrval, $conf->global->DONATION_ART200);
386 print
'<tr class="oddeven">';
387 print
'<td width="80%">'.$langs->trans(
"DONATION_ART238").
'</td>';
388 print
'<td class="center">';
389 if ($conf->use_javascript_ajax) {
390 print ajax_constantonoff(
'DONATION_ART238');
392 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
393 print $form->selectarray(
"DONATION_ART238", $arrval, $conf->global->DONATION_ART238);
397 print
'<tr class="oddeven">';
398 print
'<td width="80%">'.$langs->trans(
"DONATION_ART978").
'</td>';
399 print
'<td class="center">';
400 if ($conf->use_javascript_ajax) {
401 print ajax_constantonoff(
'DONATION_ART978');
403 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
404 print $form->selectarray(
"DONATION_ART978", $arrval, $conf->global->DONATION_ART978);
addDocumentModel($name, $type, $label='', $description='')
Add document model used by doc generator.
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).
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
delDocumentModel($name, $type)
Delete document model used by doc generator.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage donations.
donation_admin_prepare_head()
Prepare array with list of admin tabs.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
img_info($titlealt='default')
Show info logo.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.