diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index c5e142ca7ca..69ad435c64c 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -47,6 +47,11 @@ $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm'); $projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0); +$dateech = dol_mktime(GETPOST('echhour'), GETPOST('echmin'), GETPOST('echsec'), GETPOST('echmonth'), GETPOST('echday'), GETPOST('echyear')); +$dateperiod = dol_mktime(GETPOST('periodhour'), GETPOST('periodmin'), GETPOST('periodsec'), GETPOST('periodmonth'), GETPOST('periodday'), GETPOST('periodyear')); +$label = GETPOST('label', 'alpha'); +$actioncode = GETPOST('actioncode'); + // Security check $socid = GETPOST('socid', 'int'); if ($user->socid) $socid = $user->socid; @@ -134,10 +139,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // Add social contribution if ($action == 'add' && $user->rights->tax->charges->creer) { - $dateech = dol_mktime(GETPOST('echhour'), GETPOST('echmin'), GETPOST('echsec'), GETPOST('echmonth'), GETPOST('echday'), GETPOST('echyear')); - $dateperiod = dol_mktime(GETPOST('periodhour'), GETPOST('periodmin'), GETPOST('periodsec'), GETPOST('periodmonth'), GETPOST('periodday'), GETPOST('periodyear')); $amount = price2num(GETPOST('amount')); - $actioncode = GETPOST('actioncode'); if (!$dateech) { @@ -187,8 +189,6 @@ if ($action == 'add' && $user->rights->tax->charges->creer) if ($action == 'update' && !$_POST["cancel"] && $user->rights->tax->charges->creer) { - $dateech = dol_mktime(GETPOST('echhour'), GETPOST('echmin'), GETPOST('echsec'), GETPOST('echmonth'), GETPOST('echday'), GETPOST('echyear')); - $dateperiod = dol_mktime(GETPOST('periodhour'), GETPOST('periodmin'), GETPOST('periodsec'), GETPOST('periodmonth'), GETPOST('periodday'), GETPOST('periodyear')); $amount = price2num(GETPOST('amount')); if (!$dateech) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 11f2f6b84c7..fde048346eb 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6625,7 +6625,12 @@ abstract class CommonObject if (is_array($params) && array_key_exists('onlykey', $params) && $key != $params['onlykey']) continue; // @todo Add test also on 'enabled' (different than 'list' that is 'visibility') - //$enabled = 1; + $enabled = 1; + if ($enabled && isset($extrafields->attributes[$this->table_element]['enabled'][$key])) + { + $enabled = dol_eval($extrafields->attributes[$this->table_element]['enabled'][$key], 1); + } + if (empty($enabled)) continue; $visibility = 1; if ($visibility && isset($extrafields->attributes[$this->table_element]['list'][$key])) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 8a208e9e51e..04bcc74c618 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3502,6 +3502,7 @@ class Form // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of payment methods + * Constant MAIN_DEFAULT_PAYMENT_TYPE_ID can used to set default value but scope is all application, probably not what you want. * * @param string $selected Id du mode de paiement pre-selectionne * @param string $htmlname Nom de la zone select @@ -3517,7 +3518,7 @@ class Form public function select_types_paiements($selected = '', $htmlname = 'paiementtype', $filtertype = '', $format = 0, $empty = 1, $noadmininfo = 0, $maxlength = 0, $active = 1, $morecss = '') { // phpcs:enable - global $langs, $user; + global $langs, $user, $conf; dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG); @@ -3527,6 +3528,9 @@ class Form elseif ($filtertype != '' && $filtertype != '-1') $filterarray = explode(',', $filtertype); $this->load_cache_types_paiements(); + + // Set default value if not already set by caller + if (empty($selected) && !empty($conf->global->MAIN_DEFAULT_PAYMENT_TYPE_ID)) $selected = $conf->global->MAIN_DEFAULT_PAYMENT_TYPE_ID; print '