Fix 20 missing entity filter (#30466)

* FIX missing entity filter for holiday types dict

* FIX wrong table name for field name

* FIX wrong table name (travis error)
This commit is contained in:
Regis Houssin 2024-07-25 14:30:07 +02:00 committed by GitHub
parent 862befbed5
commit a1ed02fa6d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 6 additions and 5 deletions

View file

@ -256,7 +256,7 @@ class modHoliday extends DolibarrModules
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'holiday as d';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'holiday_extrafields as extra on d.rowid = extra.fk_object';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_holiday_types as t ON t.rowid = d.fk_type';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_holiday_types as t ON t.rowid = d.fk_type AND t.entity IN ('.getEntity('c_holiday_types').')';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as ua ON ua.rowid = d.fk_validator,';
$this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'user as u';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user_extrafields as extrau ON u.rowid = extrau.fk_object';

View file

@ -755,7 +755,7 @@ class Holiday extends CommonObject
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$error = 0;
$checkBalance = getDictionaryValue('c_holiday_types', 'block_if_negative', $this->fk_type);
$checkBalance = getDictionaryValue('c_holiday_types', 'block_if_negative', $this->fk_type, true);
if ($checkBalance > 0) {
$balance = $this->getCPforUser($this->fk_user, $this->fk_type);
@ -878,7 +878,7 @@ class Holiday extends CommonObject
{
$error = 0;
$checkBalance = getDictionaryValue('c_holiday_types', 'block_if_negative', $this->fk_type);
$checkBalance = getDictionaryValue('c_holiday_types', 'block_if_negative', $this->fk_type, true);
if ($checkBalance > 0) {
$balance = $this->getCPforUser($this->fk_user, $this->fk_type);
@ -1006,7 +1006,7 @@ class Holiday extends CommonObject
global $conf, $langs;
$error = 0;
$checkBalance = getDictionaryValue('c_holiday_types', 'block_if_negative', $this->fk_type);
$checkBalance = getDictionaryValue('c_holiday_types', 'block_if_negative', $this->fk_type, true);
if ($checkBalance > 0 && $this->status != self::STATUS_DRAFT) {
$balance = $this->getCPforUser($this->fk_user, $this->fk_type);
@ -2277,6 +2277,7 @@ class Holiday extends CommonObject
$sql = "SELECT rowid, code, label, affect, delay, newbymonth";
$sql .= " FROM ".MAIN_DB_PREFIX."c_holiday_types";
$sql .= " WHERE (fk_country IS NULL OR fk_country = ".((int) $mysoc->country_id).')';
$sql .= " AND entity IN (".getEntity('c_holiday_types').")";
if ($active >= 0) {
$sql .= " AND active = ".((int) $active);
}

View file

@ -407,6 +407,6 @@ UPDATE llx_c_units SET short_label = 'mn' WHERE short_label = 'i' AND code = 'MI
-- missing entity field
ALTER TABLE llx_c_holiday_types DROP INDEX uk_c_holiday_types;
ALTER TABLE llx_socpeople ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER rowid;
ALTER TABLE llx_c_holiday_types ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER rowid;
ALTER TABLE llx_c_holiday_types ADD UNIQUE INDEX uk_c_holiday_types (entity, code);