diff --git a/htdocs/don/admin/donation.php b/htdocs/don/admin/donation.php index 600a98b8f4f..385f63a4473 100644 --- a/htdocs/don/admin/donation.php +++ b/htdocs/don/admin/donation.php @@ -36,8 +36,6 @@ $langs->loadLangs(array('admin', 'donations', 'accountancy', 'other')); if (!$user->admin) accessforbidden(); -$typeconst=array('yesno','texte','chaine'); - $action = GETPOST('action','alpha'); $value = GETPOST('value'); $label = GETPOST('label','alpha'); @@ -155,44 +153,6 @@ if ($action == 'set_DONATION_MESSAGE') } } -// Activate an article -else if ($action == 'setart200') { - $setart200 = GETPOST('value', 'int'); - $res = dolibarr_set_const($db, "DONATION_ART200", $setart200, 'yesno', 0, '', $conf->entity); - if (! $res > 0) - $error ++; - - if (! $error) { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } else { - setEventMessages($langs->trans("Error"), null, 'mesgs'); - } -} -else if ($action == 'setart238') { - $setart238 = GETPOST('value', 'int'); - $res = dolibarr_set_const($db, "DONATION_ART238", $setart238, 'yesno', 0, '', $conf->entity); - if (! $res > 0) - $error ++; - - if (! $error) { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } else { - setEventMessages($langs->trans("Error"), null, 'mesgs'); - } -} -else if ($action == 'setart885') { - $setart885 = GETPOST('value', 'int'); - $res = dolibarr_set_const($db, "DONATION_ART885", $setart885, 'yesno', 0, '', $conf->entity); - if (! $res > 0) - $error ++; - - if (! $error) { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } else { - setEventMessages($langs->trans("Error"), null, 'mesgs'); - } -} - /* * View */ @@ -399,47 +359,42 @@ if (preg_match('/fr/i',$conf->global->MAIN_INFO_SOCIETE_COUNTRY)) print '
| ' . $langs->trans('Parameters') . ' | '; + print ''.$langs->trans("Parameters").' | '."\n"; + print ''.$langs->trans("Status").' | '."\n"; print "||
| ' . $langs->trans("DONATION_ART200") . ' | '; - if (! empty($conf->global->DONATION_ART200)) { - print ''; - print img_picto($langs->trans("Activated"), 'switch_on'); - print ' | '; - } else { - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); - print ' | '; - } - print ''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('DONATION_ART200'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("DONATION_ART200", $arrval, $conf->global->DONATION_ART200); +} + print ' | '; print '|
| ' . $langs->trans("DONATION_ART238") . ' | '; - if (! empty($conf->global->DONATION_ART238)) { - print ''; - print img_picto($langs->trans("Activated"), 'switch_on'); - print ' | '; - } else { - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); - print ' | '; - } - print ''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('DONATION_ART238'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("DONATION_ART238", $arrval, $conf->global->DONATION_ART238); +} + print ' | '; print '|
| ' . $langs->trans("DONATION_ART885") . ' | '; - if (! empty($conf->global->DONATION_ART885)) { - print ''; - print img_picto($langs->trans("Activated"), 'switch_on'); - print ' | '; - } else { - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); - print ' | '; - } - print ''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('DONATION_ART885'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("DONATION_ART885", $arrval, $conf->global->DONATION_ART885); +} + print ' | '; print "|