FIX backport from sql upgrade of v23 #37874 (#37875)

* FIX backport from sql upgrade of v23 #37874

* FIX drop foreign key before index

* FIX missing sql install file

* FIX travis error

* FIX wrong checking value

* FIX phan error

* Update categorie.class.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
Regis Houssin 2026-04-15 21:04:05 +02:00 committed by GitHub
parent 0734c9e03a
commit 70979b77b9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 2 deletions

View file

@ -806,7 +806,7 @@ class Categorie extends CommonObject
}
$sql = "DELETE FROM ".$this->db->sanitize(MAIN_DB_PREFIX.$key);
$sql .= " WHERE ".$sanitizedvalue." = ".((int) $this->id);
$sql .= " WHERE ".$this->db->sanitize($sanitizedvalue)." = ".((int) $this->id);
if (!$this->db->query($sql)) {
$this->errors[] = $this->db->lasterror();
dol_syslog("Error sql=".$sql." ".$this->error, LOG_ERR);

View file

@ -35,6 +35,11 @@
-- V23 forgotten
ALTER TABLE llx_categorie_project_task DROP FOREIGN KEY fk_categorie_project_task_rowid;
-- VMYSQL4.1 DROP INDEX idx_categorie_project_fk_task ON llx_categorie_project_task;
-- VPGSQL8.2 DROP INDEX idx_categorie_project_fk_task;
ALTER TABLE llx_categorie_project_task ADD INDEX idx_categorie_project_fk_task (fk_project_task);
ALTER TABLE llx_categorie_project_task ADD CONSTRAINT fk_categorie_project_task_rowid FOREIGN KEY (fk_project_task) REFERENCES llx_projet_task (rowid);
-- V24 migration

View file

@ -22,4 +22,4 @@ ALTER TABLE llx_categorie_project_task ADD INDEX idx_categorie_project_fk_catego
ALTER TABLE llx_categorie_project_task ADD INDEX idx_categorie_project_fk_task (fk_project_task);
ALTER TABLE llx_categorie_project_task ADD CONSTRAINT fk_categorie_project_task_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid);
ALTER TABLE llx_categorie_project_task ADD CONSTRAINT fk_categorie_project_task_rowid FOREIGN KEY (fk_project_task) REFERENCES llx_projet (rowid);
ALTER TABLE llx_categorie_project_task ADD CONSTRAINT fk_categorie_project_task_rowid FOREIGN KEY (fk_project_task) REFERENCES llx_projet_task (rowid);