30require
'../../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/donation.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/don/class/don.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
35if (isModEnabled(
'accounting')) {
36 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';
83 if ($obj->write_file($don, $langs) > 0) {
84 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=donation&file=SPECIMEN.html");
92 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
94} elseif ($action ==
'setdoc') {
99 $conf->global->DON_ADDON_MODEL = $value;
107} elseif ($action ==
'set') {
110} elseif ($action ==
'del') {
113 if (
$conf->global->DON_ADDON_MODEL ==
"$value") {
120if ($action ==
'set_DONATION_ACCOUNTINGACCOUNT') {
121 $account =
GETPOST(
'DONATION_ACCOUNTINGACCOUNT',
'alpha');
138if ($action ==
'set_DONATION_MESSAGE') {
139 $freemessage =
GETPOST(
'DONATION_MESSAGE',
'restricthtml');
158if (preg_match(
'/set_([a-z0-9_\-]+)/i', $action, $reg)) {
161 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
168if (preg_match(
'/del_([a-z0-9_\-]+)/i', $action, $reg)) {
171 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
182$dir =
"../../core/modules/dons/";
183$form =
new Form($db);
184if (isModEnabled(
'accounting')) {
189llxHeader(
'', $langs->trans(
"DonationsSetup"), $help_url,
'', 0, 0,
'',
'',
'',
'mod-donation page-admin');
191$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
192print
load_fiche_titre($langs->trans(
"DonationsSetup"), $linkback,
'title_setup');
206$sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
207$sql .=
" WHERE type = '".$db->escape($type).
"'";
208$resql = $db->query($sql);
211 $num_rows = $db->num_rows($resql);
212 while ($i < $num_rows) {
213 $array = $db->fetch_array($resql);
214 if (is_array($array)) {
215 array_push($def, $array[0]);
223print
'<table class="noborder centpercent">';
224print
'<tr class="liste_titre">';
225print
'<td>'.$langs->trans(
"Name").
'</td>';
226print
'<td>'.$langs->trans(
"Description").
'</td>';
227print
'<td class="center" width="60">'.$langs->trans(
"Activated").
'</td>';
228print
'<td class="center" width="60">'.$langs->trans(
"Default").
'</td>';
229print
'<td class="center" width="80">'.$langs->trans(
"ShortInfo").
'</td>';
230print
'<td class="center" width="80">'.$langs->trans(
"Preview").
'</td>';
235$handle = opendir($dir);
237if (is_resource($handle)) {
238 while (($file = readdir($handle)) !==
false) {
239 if (preg_match(
'/\.modules\.php$/i', $file)) {
240 $name = substr($file, 0,
dol_strlen($file) - 12);
241 $classname = substr($file, 0,
dol_strlen($file) - 12);
243 require_once $dir.
'/'.$file;
244 $module =
new $classname($db);
245 '@phan-var-force ModeleDon $module';
248 if ($module->version ==
'development' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2) {
251 if ($module->version ==
'experimental' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1) {
255 if ($module->isEnabled()) {
256 print
'<tr class="oddeven"><td width=\"100\">';
260 print $module->description;
264 if (in_array($name, $def)) {
265 if (
$conf->global->DON_ADDON_MODEL == $name) {
266 print
"<td class=\"center\">\n";
267 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
270 print
"<td class=\"center\">\n";
271 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>';
275 print
"<td class=\"center\">\n";
276 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>';
281 if (
$conf->global->DON_ADDON_MODEL ==
"$name") {
282 print
"<td class=\"center\">";
283 print
img_picto($langs->trans(
"Default"),
'on');
286 print
"<td class=\"center\">";
287 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>';
292 $htmltooltip =
''.$langs->trans(
"Name").
': '.$module->name;
293 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.($module->type ? $module->type : $langs->trans(
"Unknown"));
294 if ($module->type ==
'pdf') {
295 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.$module->page_largeur.
'/'.$module->page_hauteur;
297 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
298 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.
yn($module->option_logo, 1, 1);
299 $htmltooltip .=
'<br>'.$langs->trans(
"MultiLanguage").
': '.
yn($module->option_multilang, 1, 1);
300 print
'<td class="center">';
301 print $form->textwithpicto(
'', $htmltooltip, -1, 0);
305 print
'<td class="center">';
306 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=specimen&module='.$name.
'" target="specimen">'.
img_object($langs->trans(
"Preview"),
'generic').
'</a>';
323print
'<table class="noborder centpercent">';
324print
'<tr class="liste_titre">';
325print
'<td>'.$langs->trans(
"Parameters").
'</td>';
326print
'<td width="60" class="center">'.$langs->trans(
"Value").
"</td>\n";
330if (isModEnabled(
"societe")) {
331 print
'<tr class="oddeven">';
332 print
'<td colspan="2">';
333 print $langs->trans(
"DonationUseThirdparties");
335 print
'<td class="center">';
336 if (
$conf->use_javascript_ajax) {
337 print ajax_constantonoff(
'DONATION_USE_THIRDPARTIES');
339 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
340 print $form->selectarray(
"DONATION_USE_THIRDPARTIES", $arrval,
$conf->global->DONATION_USE_THIRDPARTIES);
346print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
347print
'<input type="hidden" name="token" value="'.newToken().
'" />';
348print
'<input type="hidden" name="action" value="set_DONATION_ACCOUNTINGACCOUNT" />';
350print
'<tr class="oddeven">';
352$label = $langs->trans(
"AccountAccounting");
353print
'<label for="DONATION_ACCOUNTINGACCOUNT">'.$label.
'</label></td>';
354print
'<td class="center">';
355if (isModEnabled(
'accounting')) {
357 print $formaccounting->select_account(
$conf->global->DONATION_ACCOUNTINGACCOUNT,
'DONATION_ACCOUNTINGACCOUNT', 1, array(), 1, 1);
359 print
'<input type="text" size="10" id="DONATION_ACCOUNTINGACCOUNT" name="DONATION_ACCOUNTINGACCOUNT" value="' .
getDolGlobalString(
'DONATION_ACCOUNTINGACCOUNT').
'">';
361print
'</td><td class="center">';
362print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'" />';
366print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
367print
'<input type="hidden" name="token" value="'.newToken().
'" />';
368print
'<input type="hidden" name="action" value="set_DONATION_MESSAGE" />';
370print
'<tr class="oddeven"><td colspan="2">';
371print $langs->trans(
"FreeTextOnDonations").
' '.
img_info($langs->trans(
"AddCRIfTooLong")).
'<br>';
372print
'<textarea name="DONATION_MESSAGE" class="flat" cols="80">' .
getDolGlobalString(
'DONATION_MESSAGE').
'</textarea>';
373print
'</td><td class="center">';
374print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'" />';
383if (preg_match(
'/fr/i',
$conf->global->MAIN_INFO_SOCIETE_COUNTRY)) {
387 print
'<table class="noborder centpercent">';
388 print
'<tr class="liste_titre">';
389 print
'<td>'.$langs->trans(
"Parameters").
'</td>'.
"\n";
390 print
'<td class="center">'.$langs->trans(
"Status").
'</td>'.
"\n";
393 print
'<tr class="oddeven">';
394 print
'<td width="80%">'.$langs->trans(
"DONATION_ART200").
'</td>';
395 print
'<td class="center">';
396 if (
$conf->use_javascript_ajax) {
397 print ajax_constantonoff(
'DONATION_ART200');
399 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
400 print $form->selectarray(
"DONATION_ART200", $arrval,
$conf->global->DONATION_ART200);
404 print
'<tr class="oddeven">';
405 print
'<td width="80%">'.$langs->trans(
"DONATION_ART238").
'</td>';
406 print
'<td class="center">';
407 if (
$conf->use_javascript_ajax) {
408 print ajax_constantonoff(
'DONATION_ART238');
410 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
411 print $form->selectarray(
"DONATION_ART238", $arrval,
$conf->global->DONATION_ART238);
415 print
'<tr class="oddeven">';
416 print
'<td width="80%">'.$langs->trans(
"DONATION_ART978").
'</td>';
417 print
'<td class="center">';
418 if (
$conf->use_javascript_ajax) {
419 print ajax_constantonoff(
'DONATION_ART978');
421 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
422 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($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.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
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)
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)
Show tabs of a record.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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...
getDolGlobalString($key, $default='')
Return a 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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.