Fix regression

This commit is contained in:
Laurent Destailleur 2022-05-09 15:57:10 +02:00
parent 86a8ae8c3d
commit 720a09dacb
8 changed files with 15 additions and 13 deletions

View File

@ -266,11 +266,11 @@ foreach ($rules as $rule) {
if ($rule->fk_c_type_fees == -1) { if ($rule->fk_c_type_fees == -1) {
echo $langs->trans('AllExpenseReport'); echo $langs->trans('AllExpenseReport');
} else { } else {
$key = getDictionaryValue(MAIN_DB_PREFIX . 'c_type_fees', 'code', $rule->fk_c_type_fees, false, 'id'); $key = getDictionaryValue('c_type_fees', 'code', $rule->fk_c_type_fees, false, 'id');
if ($key && $key != $langs->trans($key)) { if ($key && $key != $langs->trans($key)) {
echo $langs->trans($key); echo $langs->trans($key);
} else { } else {
$value = getDictionaryValue(MAIN_DB_PREFIX . 'c_type_fees', 'label', $rule->fk_c_type_fees, false, 'id'); $value = getDictionaryValue('c_type_fees', 'label', $rule->fk_c_type_fees, false, 'id');
echo $langs->trans($value ? $value : 'Undefined'); // TODO check to return trans of 'code' echo $langs->trans($value ? $value : 'Undefined'); // TODO check to return trans of 'code'
} }
} }

View File

@ -692,7 +692,7 @@ if (empty($reshook)) {
$deposit = null; $deposit = null;
$locationTarget = ''; $locationTarget = '';
$deposit_percent_from_payment_terms = getDictionaryValue(MAIN_DB_PREFIX . 'c_payment_term', 'deposit_percent', $object->cond_reglement_id); $deposit_percent_from_payment_terms = getDictionaryValue('c_payment_term', 'deposit_percent', $object->cond_reglement_id);
if ( if (
!$error && GETPOST('statut', 'int') == $object::STATUS_SIGNED && GETPOST('generate_deposit', 'alpha') == 'on' !$error && GETPOST('statut', 'int') == $object::STATUS_SIGNED && GETPOST('generate_deposit', 'alpha') == 'on'
@ -1999,7 +1999,7 @@ if ($action == 'create') {
array('type' => 'text', 'name' => 'note_private', 'label' => $langs->trans("Note"), 'value' => '') // Field to complete private note (not replace) array('type' => 'text', 'name' => 'note_private', 'label' => $langs->trans("Note"), 'value' => '') // Field to complete private note (not replace)
); );
$deposit_percent_from_payment_terms = getDictionaryValue(MAIN_DB_PREFIX . 'c_payment_term', 'deposit_percent', $object->cond_reglement_id); $deposit_percent_from_payment_terms = getDictionaryValue('c_payment_term', 'deposit_percent', $object->cond_reglement_id);
if (! empty($deposit_percent_from_payment_terms) && ! empty($conf->facture->enabled) && ! empty($user->rights->facture->creer)) { if (! empty($deposit_percent_from_payment_terms) && ! empty($conf->facture->enabled) && ! empty($user->rights->facture->creer)) {
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';

View File

@ -1184,7 +1184,7 @@ if (empty($reshook)) {
$error = 0; $error = 0;
$deposit = null; $deposit = null;
$deposit_percent_from_payment_terms = getDictionaryValue(MAIN_DB_PREFIX . 'c_payment_term', 'deposit_percent', $object->cond_reglement_id); $deposit_percent_from_payment_terms = getDictionaryValue('c_payment_term', 'deposit_percent', $object->cond_reglement_id);
if ( if (
GETPOST('generate_deposit', 'alpha') == 'on' && ! empty($deposit_percent_from_payment_terms) GETPOST('generate_deposit', 'alpha') == 'on' && ! empty($deposit_percent_from_payment_terms)
@ -2025,7 +2025,7 @@ if ($action == 'create' && $usercancreate) {
if ($nbMandated > 0 ) $text .= '<div><span class="clearboth nowraponall warning">'.$langs->trans("mandatoryPeriodNeedTobeSetMsgValidate").'</span></div>'; if ($nbMandated > 0 ) $text .= '<div><span class="clearboth nowraponall warning">'.$langs->trans("mandatoryPeriodNeedTobeSetMsgValidate").'</span></div>';
$deposit_percent_from_payment_terms = getDictionaryValue(MAIN_DB_PREFIX . 'c_payment_term', 'deposit_percent', $object->cond_reglement_id); $deposit_percent_from_payment_terms = getDictionaryValue('c_payment_term', 'deposit_percent', $object->cond_reglement_id);
if (! empty($deposit_percent_from_payment_terms) && ! empty($conf->facture->enabled) && ! empty($user->rights->facture->creer)) { if (! empty($deposit_percent_from_payment_terms) && ! empty($conf->facture->enabled) && ! empty($user->rights->facture->creer)) {
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';

View File

@ -3290,7 +3290,7 @@ if ($action == 'create') {
$typedeposit = GETPOST('typedeposit', 'aZ09'); $typedeposit = GETPOST('typedeposit', 'aZ09');
$valuedeposit = GETPOST('valuedeposit', 'int'); $valuedeposit = GETPOST('valuedeposit', 'int');
if (empty($typedeposit) && ! empty($objectsrc->deposit_percent)) { if (empty($typedeposit) && ! empty($objectsrc->deposit_percent)) {
$origin_payment_conditions_deposit_percent = getDictionaryValue(MAIN_DB_PREFIX . 'c_payment_term', 'deposit_percent', $objectsrc->cond_reglement_id); $origin_payment_conditions_deposit_percent = getDictionaryValue('c_payment_term', 'deposit_percent', $objectsrc->cond_reglement_id);
if (! empty($origin_payment_conditions_deposit_percent)) { if (! empty($origin_payment_conditions_deposit_percent)) {
$typedeposit = 'variable'; $typedeposit = 'variable';
} }

View File

@ -1501,7 +1501,7 @@ class Facture extends CommonInvoice
return null; return null;
} }
$payment_conditions_deposit_percent = getDictionaryValue(MAIN_DB_PREFIX . 'c_payment_term', 'deposit_percent', $origin->cond_reglement_id); $payment_conditions_deposit_percent = getDictionaryValue('c_payment_term', 'deposit_percent', $origin->cond_reglement_id);
if (empty($payment_conditions_deposit_percent)) { if (empty($payment_conditions_deposit_percent)) {
$origin->error = 'ErrorPaymentConditionsNotEligibleToDepositCreation'; $origin->error = 'ErrorPaymentConditionsNotEligibleToDepositCreation';

View File

@ -2606,7 +2606,7 @@ abstract class CommonObject
} }
if (empty($deposit_percent) || $deposit_percent < 0) { if (empty($deposit_percent) || $deposit_percent < 0) {
$deposit_percent = getDictionaryValue(MAIN_DB_PREFIX . 'c_payment_term', 'deposit_percent', $id); $deposit_percent = getDictionaryValue('c_payment_term', 'deposit_percent', $id);
} }
if ($deposit_percent > 100) { if ($deposit_percent > 100) {

View File

@ -9862,7 +9862,7 @@ function dol_mimetype($file, $default = 'application/octet-stream', $mode = 0)
* Return the value of a filed into a dictionary for the record $id. * Return the value of a filed into a dictionary for the record $id.
* This also set all the values into a cache for a next search. * This also set all the values into a cache for a next search.
* *
* @param string $tablename Name of dictionary * @param string $tablename Name of table dictionary (without the MAIN_DB_PREFIX, example: 'c_holiday_types')
* @param string $field The name of field where to find the value to return * @param string $field The name of field where to find the value to return
* @param int $id Id of line record * @param int $id Id of line record
* @param bool $checkentity Add filter on entity * @param bool $checkentity Add filter on entity
@ -9873,6 +9873,8 @@ function getDictionaryValue($tablename, $field, $id, $checkentity = false, $rowi
{ {
global $conf, $db; global $conf, $db;
$tablename = preg_replace('/^'.preg_quote(MAIN_DB_PREFIX, '/').'/', '', $tablename); // Clean name of table for backward compatibility.
$dictvalues = (isset($conf->cache['dictvalues_'.$tablename]) ? $conf->cache['dictvalues_'.$tablename] : null); $dictvalues = (isset($conf->cache['dictvalues_'.$tablename]) ? $conf->cache['dictvalues_'.$tablename] : null);
if (is_null($dictvalues)) { if (is_null($dictvalues)) {

View File

@ -704,7 +704,7 @@ class Holiday extends CommonObject
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$error = 0; $error = 0;
$checkBalance = getDictionaryValue(MAIN_DB_PREFIX.'c_holiday_types', 'block_if_negative', $this->fk_type); $checkBalance = getDictionaryValue('c_holiday_types', 'block_if_negative', $this->fk_type);
if ($checkBalance > 0) { if ($checkBalance > 0) {
$balance = $this->getCPforUser($this->fk_user, $this->fk_type); $balance = $this->getCPforUser($this->fk_user, $this->fk_type);
@ -817,7 +817,7 @@ class Holiday extends CommonObject
global $conf, $langs; global $conf, $langs;
$error = 0; $error = 0;
$checkBalance = getDictionaryValue(MAIN_DB_PREFIX.'c_holiday_types', 'block_if_negative', $this->fk_type); $checkBalance = getDictionaryValue('c_holiday_types', 'block_if_negative', $this->fk_type);
if ($checkBalance > 0) { if ($checkBalance > 0) {
$balance = $this->getCPforUser($this->fk_user, $this->fk_type); $balance = $this->getCPforUser($this->fk_user, $this->fk_type);
@ -936,7 +936,7 @@ class Holiday extends CommonObject
global $conf, $langs; global $conf, $langs;
$error = 0; $error = 0;
$checkBalance = getDictionaryValue(MAIN_DB_PREFIX.'c_holiday_types', 'block_if_negative', $this->fk_type); $checkBalance = getDictionaryValue('c_holiday_types', 'block_if_negative', $this->fk_type);
if ($checkBalance > 0 && $this->statut != self::STATUS_DRAFT) { if ($checkBalance > 0 && $this->statut != self::STATUS_DRAFT) {
$balance = $this->getCPforUser($this->fk_user, $this->fk_type); $balance = $this->getCPforUser($this->fk_user, $this->fk_type);