diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 329d177a33d..64f442633de 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -488,6 +488,7 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof global $conf, $langs, $user; $entity = ((isset($entity) && is_numeric($entity) && $entity >= 0) ? $entity : $conf->entity); + if (! isset($input)) $input = array(); if (empty($conf->use_javascript_ajax)) { diff --git a/htdocs/projet/admin/project.php b/htdocs/projet/admin/project.php index 19b68ddd9ea..cfd10d2c1fa 100644 --- a/htdocs/projet/admin/project.php +++ b/htdocs/projet/admin/project.php @@ -51,17 +51,7 @@ $type = 'project'; include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; -if ($action == 'setmainoptions') -{ - if (GETPOST('PROJECT_USE_OPPORTUNITIES')) dolibarr_set_const($db, "PROJECT_USE_OPPORTUNITIES", GETPOST('PROJECT_USE_OPPORTUNITIES'), 'chaine', 0, '', $conf->entity); - else dolibarr_del_const($db, "PROJECT_USE_OPPORTUNITIES", $conf->entity); - - // Warning, the constant saved and used in code is PROJECT_HIDE_TASKS - if (GETPOST('PROJECT_USE_TASKS')) dolibarr_del_const($db, "PROJECT_HIDE_TASKS", $conf->entity); - else dolibarr_set_const($db, "PROJECT_HIDE_TASKS", 1, 'chaine', 0, '', $conf->entity); -} - -elseif ($action == 'updateMask') +if ($action == 'updateMask') { $maskconstproject = GETPOST('maskconstproject', 'alpha'); $maskproject = GETPOST('maskproject', 'alpha'); @@ -315,12 +305,8 @@ print ' '."\n"; print ''; print ''.$langs->trans("ManageOpportunitiesStatus").''; print ''; -$arrval = array('0'=>$langs->trans("No"), - '1'=>$langs->trans("Yes"), -); -print $form->selectyesno('PROJECT_USE_OPPORTUNITIES', $conf->global->PROJECT_USE_OPPORTUNITIES, 1); +print ajax_constantonoff("PROJECT_USE_OPPORTUNITIES"); print ''; -print ''; print ""; print ''; @@ -328,12 +314,8 @@ print ''; print ''; print ''.$langs->trans("ManageTasks").''; print ''; -$arrval = array('0'=>$langs->trans("No"), - '1'=>$langs->trans("Yes"), -); -print $form->selectyesno('PROJECT_USE_TASKS', empty($conf->global->PROJECT_HIDE_TASKS) ? 1 : 0, 1); +print ajax_constantonoff("PROJECT_HIDE_TASKS", array(), null, 1); print ''; -print ''; print ""; print '';