From e503e7e6985604519db8b49447da6d651c1e3389 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 30 Dec 2018 17:34:44 +0100 Subject: [PATCH 1/2] Fix ajax toogle in donation.php --- htdocs/don/admin/donation.php | 97 ++++++++++------------------------- 1 file changed, 26 insertions(+), 71 deletions(-) diff --git a/htdocs/don/admin/donation.php b/htdocs/don/admin/donation.php index 600a98b8f4f..cfaa781fd0d 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 ''; print ''; - print ''; +print ''."\n"; +print ''."\n"; print "\n"; print ''; print ''; - if (! empty($conf->global->DONATION_ART200)) { - print ''; - } else { - print ''; - } - print ''; + print ''; print ''; print ''; - if (! empty($conf->global->DONATION_ART238)) { - print ''; - } else { - print ''; - } - print ''; + print ''; print ''; print ''; - if (! empty($conf->global->DONATION_ART885)) { - print ''; - } else { - print ''; - } - print ''; + print ''; print "
' . $langs->trans('Parameters') . ''.$langs->trans("Parameters").''.$langs->trans("Status").'
' . $langs->trans("DONATION_ART200") . ''; - print img_picto($langs->trans("Activated"), 'switch_on'); - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); - 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 '
' . $langs->trans("DONATION_ART238") . ''; - print img_picto($langs->trans("Activated"), 'switch_on'); - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); - 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 '
' . $langs->trans("DONATION_ART885") . ''; - print img_picto($langs->trans("Activated"), 'switch_on'); - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); - 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 '
\n"; } From 4b1ea18e322c943db178421e9dbef031ad8b7d0c Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 30 Dec 2018 17:35:50 +0100 Subject: [PATCH 2/2] Update donation.php --- htdocs/don/admin/donation.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/don/admin/donation.php b/htdocs/don/admin/donation.php index cfaa781fd0d..385f63a4473 100644 --- a/htdocs/don/admin/donation.php +++ b/htdocs/don/admin/donation.php @@ -359,13 +359,13 @@ if (preg_match('/fr/i',$conf->global->MAIN_INFO_SOCIETE_COUNTRY)) print ''; print ''; -print ''."\n"; -print ''."\n"; + print ''."\n"; + print ''."\n"; print "\n"; print ''; print ''; - print ''; print ''; - print ''; print ''; - print '
'.$langs->trans("Parameters").''.$langs->trans("Status").''.$langs->trans("Parameters").''.$langs->trans("Status").'
' . $langs->trans("DONATION_ART200") . ''; + print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('DONATION_ART200'); } else { @@ -376,7 +376,7 @@ if ($conf->use_javascript_ajax) { print '
' . $langs->trans("DONATION_ART238") . ''; + print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('DONATION_ART238'); } else { @@ -387,7 +387,7 @@ if ($conf->use_javascript_ajax) { print '
' . $langs->trans("DONATION_ART885") . ''; + print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('DONATION_ART885'); } else {