30require
'../../main.inc.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/donation.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/don/class/don.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
44 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
48$langs->loadLangs(array(
'admin',
'donations',
'accountancy',
'other'));
54$action =
GETPOST(
'action',
'aZ09');
56$label =
GETPOST(
'label',
'alpha');
57$scandir =
GETPOST(
'scan_dir',
'alpha');
67if ($action ==
'specimen') {
68 $modele =
GETPOST(
'module',
'alpha');
71 $don->initAsSpecimen();
74 $dir = DOL_DOCUMENT_ROOT.
"/core/modules/dons/";
75 $file = $modele.
".modules.php";
76 if ($modele !==
'' && file_exists($dir.$file)) {
77 require_once $dir.$file;
79 $classname = (
string) $modele;
80 $obj =
new $classname(
$db);
81 '@phan-var-force ModeleDon $obj';
84 if ($obj->write_file($don, $langs) > 0) {
85 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=donation&file=SPECIMEN.html");
93 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
95} elseif ($action ==
'setdoc') {
100 $conf->global->DON_ADDON_MODEL = $value;
108} elseif ($action ==
'set') {
111} elseif ($action ==
'del') {
121if ($action ==
'set_DONATION_ACCOUNTINGACCOUNT') {
122 $account =
GETPOST(
'DONATION_ACCOUNTINGACCOUNT',
'alpha');
139if ($action ==
'set_DONATION_MESSAGE') {
140 $freemessage =
GETPOST(
'DONATION_MESSAGE',
'restricthtml');
159if (preg_match(
'/set_([a-z0-9_\-]+)/i', $action, $reg)) {
162 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
169if (preg_match(
'/del_([a-z0-9_\-]+)/i', $action, $reg)) {
172 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
183$dir =
"../../core/modules/dons/";
190llxHeader(
'', $langs->trans(
"DonationsSetup"), $help_url,
'', 0, 0,
'',
'',
'',
'mod-donation page-admin');
192$linkback =
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/admin/modules.php', [
'restore_lastsearch_values' => 1]).
'">'.
img_picto($langs->trans(
"BackToModuleList"),
'back',
'class="pictofixedwidth"').
'<span class="hideonsmartphone">'.$langs->trans(
"BackToModuleList").
'</span></a>';
193print
load_fiche_titre($langs->trans(
"DonationsSetup"), $linkback,
'title_setup');
207$sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
208$sql .=
" WHERE type = '".$db->escape($type).
"'";
209$resql =
$db->query($sql);
212 $num_rows =
$db->num_rows($resql);
213 while ($i < $num_rows) {
214 $array =
$db->fetch_array($resql);
215 if (is_array($array)) {
216 array_push($def, $array[0]);
224print
'<table class="noborder centpercent">';
225print
'<tr class="liste_titre">';
226print
'<td>'.$langs->trans(
"Name").
'</td>';
227print
'<td>'.$langs->trans(
"Description").
'</td>';
228print
'<td class="center" width="60">'.$langs->trans(
"Activated").
'</td>';
229print
'<td class="center" width="60">'.$langs->trans(
"Default").
'</td>';
230print
'<td class="center" width="80">'.$langs->trans(
"ShortInfo").
'</td>';
231print
'<td class="center" width="80">'.$langs->trans(
"Preview").
'</td>';
236$handle = opendir($dir);
238if (is_resource($handle)) {
239 while (($file = readdir($handle)) !==
false) {
240 if (preg_match(
'/\.modules\.php$/i', $file)) {
241 $name = substr($file, 0,
dol_strlen($file) - 12);
242 $classname = substr($file, 0,
dol_strlen($file) - 12);
244 require_once $dir.
'/'.$file;
245 $module =
new $classname(
$db);
246 '@phan-var-force ModeleDon $module';
250 if ($module->version ==
'development' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2) {
253 if ($module->version ==
'experimental' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1) {
257 if ($module->isEnabled()) {
258 print
'<tr class="oddeven"><td width=\"100\">';
262 print $module->description;
266 if (in_array($name, $def)) {
268 print
"<td class=\"center\">\n";
269 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
272 print
"<td class=\"center\">\n";
273 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=del&token='.newToken().
'&value='.urlencode($name).
'&scan_dir='.urlencode($module->scandir).
'&label='.urlencode($module->name).
'">'.
img_picto($langs->trans(
"Enabled"),
'switch_on').
'</a>';
277 print
"<td class=\"center\">\n";
278 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>';
284 print
"<td class=\"center\">";
285 print
img_picto($langs->trans(
"Default"),
'on');
288 print
"<td class=\"center\">";
289 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>';
294 $htmltooltip =
''.$langs->trans(
"Name").
': '.$module->name;
295 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.($module->type ? $module->type : $langs->trans(
"Unknown"));
296 if ($module->type ==
'pdf') {
297 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.$module->page_largeur.
'/'.$module->page_hauteur;
299 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
300 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.
yn($module->option_logo, 1, 1);
301 $htmltooltip .=
'<br>'.$langs->trans(
"MultiLanguage").
': '.
yn($module->option_multilang, 1, 1);
302 print
'<td class="center">';
303 print $form->textwithpicto(
'', $htmltooltip, -1,
'info');
307 print
'<td class="center">';
308 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=specimen&module='.$name.
'" target="specimen">'.
img_object($langs->trans(
"Preview"),
'generic').
'</a>';
325print
'<table class="noborder centpercent">';
326print
'<tr class="liste_titre">';
327print
'<td>'.$langs->trans(
"Parameters").
'</td>';
328print
'<td width="60" class="center">'.$langs->trans(
"Value").
"</td>\n";
333 print
'<tr class="oddeven">';
334 print
'<td colspan="2">';
335 print $langs->trans(
"DonationUseThirdparties");
337 print
'<td class="center">';
338 if (
$conf->use_javascript_ajax) {
339 print ajax_constantonoff(
'DONATION_USE_THIRDPARTIES');
341 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
342 print $form->selectarray(
"DONATION_USE_THIRDPARTIES", $arrval,
getDolGlobalString(
'DONATION_USE_THIRDPARTIES'));
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_ACCOUNTINGACCOUNT" />';
352print
'<tr class="oddeven">';
354$label = $langs->trans(
"AccountAccounting");
355print
'<label for="DONATION_ACCOUNTINGACCOUNT">'.$label.
'</label></td>';
356print
'<td class="center">';
359 print $formaccounting->select_account(
getDolGlobalString(
'DONATION_ACCOUNTINGACCOUNT'),
'DONATION_ACCOUNTINGACCOUNT', 1, array(), 1, 1);
361 print
'<input type="text" size="10" id="DONATION_ACCOUNTINGACCOUNT" name="DONATION_ACCOUNTINGACCOUNT" value="' .
getDolGlobalString(
'DONATION_ACCOUNTINGACCOUNT').
'">';
363print
'</td><td class="center">';
364print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'" />';
368print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
369print
'<input type="hidden" name="token" value="'.newToken().
'" />';
370print
'<input type="hidden" name="action" value="set_DONATION_MESSAGE" />';
372print
'<tr class="oddeven"><td colspan="2">';
373print $langs->trans(
"FreeTextOnDonations").
' '.
img_info($langs->trans(
"AddCRIfTooLong")).
'<br>';
374print
'<textarea name="DONATION_MESSAGE" class="flat" cols="80">' .
getDolGlobalString(
'DONATION_MESSAGE').
'</textarea>';
375print
'</td><td class="center">';
376print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'" />';
385if (preg_match(
'/fr/i',
$mysoc->country_code)) {
389 print
'<table class="noborder centpercent">';
390 print
'<tr class="liste_titre">';
391 print
'<td>'.$langs->trans(
"Parameters").
'</td>'.
"\n";
392 print
'<td class="center">'.$langs->trans(
"Status").
'</td>'.
"\n";
395 print
'<tr class="oddeven">';
396 print
'<td width="80%">'.$langs->trans(
"DONATION_ART200").
'</td>';
397 print
'<td class="center">';
398 if (
$conf->use_javascript_ajax) {
399 print ajax_constantonoff(
'DONATION_ART200');
401 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
402 print $form->selectarray(
"DONATION_ART200", $arrval,
getDolGlobalString(
'DONATION_ART200'));
406 print
'<tr class="oddeven">';
407 print
'<td width="80%">'.$langs->trans(
"DONATION_ART238").
'</td>';
408 print
'<td class="center">';
409 if (
$conf->use_javascript_ajax) {
410 print ajax_constantonoff(
'DONATION_ART238');
412 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
413 print $form->selectarray(
"DONATION_ART238", $arrval,
getDolGlobalString(
'DONATION_ART238'));
417 print
'<tr class="oddeven">';
418 print
'<td width="80%">'.$langs->trans(
"DONATION_ART978").
'</td>';
419 print
'<td class="center">';
420 if (
$conf->use_javascript_ajax) {
421 print ajax_constantonoff(
'DONATION_ART978');
423 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
424 print $form->selectarray(
"DONATION_ART978", $arrval,
getDolGlobalString(
'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.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage donations.
donation_admin_prepare_head()
Prepare array with list of admin tabs.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
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.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
img_info($titlealt='default')
Show info logo.
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.