2
0
forked from Wavyzz/dolibarr

QUAL bankline category table name (#30419)

* FIX bankline category table name

* remove bad space

---------

Co-authored-by: Hystepik <lmarcouiller@nltechno.com>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
Lucas Marcouiller
2024-07-28 17:43:46 +02:00
committed by GitHub
parent 6b80e2000b
commit a671c91d3e
12 changed files with 17 additions and 16 deletions

View File

@@ -673,7 +673,7 @@ class Categorie extends CommonObject
'categorie_ticket' => array('field' => 'fk_categorie', 'enabled' => isModEnabled('ticket')),
'categorie_warehouse' => 'fk_categorie',
'categorie_website_page' => array('field' => 'fk_categorie', 'enabled' => isModEnabled('website')),
'bank_class' => 'fk_categ',
'category_bankline' => 'fk_categ',
'categorie_lang' => 'fk_category',
'categorie' => 'rowid',
);
@@ -1535,7 +1535,7 @@ class Categorie extends CommonObject
if ($type === Categorie::TYPE_BANK_LINE) { // TODO Remove this with standard category code after migration of llx_category_bank into llx_categorie
// Load bank categories
$sql = "SELECT c.label, c.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."bank_class as a, ".MAIN_DB_PREFIX."category_bank as c";
$sql .= " FROM ".MAIN_DB_PREFIX."category_bankline as a, ".MAIN_DB_PREFIX."category_bank as c";
$sql .= " WHERE a.lineid=".((int) $id)." AND a.fk_categ = c.rowid";
$sql .= " AND c.entity IN (".getEntity('category').")";
$sql .= " ORDER BY c.label";

View File

@@ -607,7 +607,7 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $obje
$sql .= $hookmanager->resPrint;
$sql .= " FROM ";
if ($search_bid > 0) {
$sql .= MAIN_DB_PREFIX."bank_class as l,";
$sql .= MAIN_DB_PREFIX."category_bankline as l,";
}
$sql .= " ".MAIN_DB_PREFIX."bank_account as ba,";
$sql .= " ".MAIN_DB_PREFIX."bank as b";

View File

@@ -63,7 +63,7 @@ print "</tr>\n";
$sql = "SELECT sum(d.amount) as somme, count(*) as nombre, c.label, c.rowid ";
$sql .= " FROM ".MAIN_DB_PREFIX."category_bank as c";
$sql .= ", ".MAIN_DB_PREFIX."bank_class as l";
$sql .= ", ".MAIN_DB_PREFIX."category_bankline as l";
$sql .= ", ".MAIN_DB_PREFIX."bank as d";
$sql .= " WHERE c.entity = ".$conf->entity;
$sql .= " AND c.rowid = l.fk_categ";

View File

@@ -676,7 +676,7 @@ class Account extends CommonObject
if ($accline->insert() > 0) {
if ($categorie > 0) {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class(";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."category_bankline(";
$sql .= "lineid, fk_categ";
$sql .= ") VALUES (";
$sql .= ((int) $accline->id).", '".$this->db->escape($categorie)."'";
@@ -2350,7 +2350,7 @@ class AccountLine extends CommonObjectLine
$nbko++;
}
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid=".(int) $this->rowid;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."category_bankline WHERE lineid=".(int) $this->rowid;
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$result = $this->db->query($sql);
if (!$result) {
@@ -2509,7 +2509,7 @@ class AccountLine extends CommonObjectLine
$resql = $this->db->query($sql);
if ($resql) {
if (!empty($cat) && $cat > 0) {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class (";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."category_bankline (";
$sql .= "lineid";
$sql .= ", fk_categ";
$sql .= ") VALUES (";

View File

@@ -245,7 +245,7 @@ class BankCateg // extends CommonObject
// Delete link between tag and bank lines
if (!$error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class";
$sql = "DELETE FROM ".MAIN_DB_PREFIX."category_bankline";
$sql .= " WHERE fk_categ = ".((int) $this->id);
$resql = $this->db->query($sql);

View File

@@ -118,7 +118,7 @@ if ($user->hasRight('banque', 'consolidate') && $action == 'donext') {
if ($action == 'confirm_delete_categ' && $confirm == "yes" && $user->hasRight('banque', 'modifier')) {
$cat1 = GETPOSTINT("cat1");
if (!empty($rowid) && !empty($cat1)) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid = ".((int) $rowid)." AND fk_categ = ".((int) $cat1);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."category_bankline WHERE lineid = ".((int) $rowid)." AND fk_categ = ".((int) $cat1);
if (!$db->query($sql)) {
dol_print_error($db);
}
@@ -201,14 +201,14 @@ if ($user->hasRight('banque', 'modifier') && $action == "update") {
if (!$error) {
$arrayofcategs = GETPOST('custcats', 'array');
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid = ".((int) $rowid);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."category_bankline WHERE lineid = ".((int) $rowid);
if (!$db->query($sql)) {
$error++;
dol_print_error($db);
}
if (count($arrayofcategs)) {
foreach ($arrayofcategs as $val) {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class (lineid, fk_categ) VALUES (".((int) $rowid).", ".((int) $val).")";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."category_bankline (lineid, fk_categ) VALUES (".((int) $rowid).", ".((int) $val).")";
if (!$db->query($sql)) {
$error++;
dol_print_error($db);

View File

@@ -664,7 +664,7 @@ if (empty($numref)) {
if ($ve) {
$sql = "SELECT label";
$sql .= " FROM ".MAIN_DB_PREFIX."category_bank as ct";
$sql .= ", ".MAIN_DB_PREFIX."bank_class as cl";
$sql .= ", ".MAIN_DB_PREFIX."category_bankline as cl";
$sql .= " WHERE ct.rowid = cl.fk_categ";
$sql .= " AND ct.entity = ".((int) $conf->entity);
$sql .= " AND cl.lineid = ".((int) $objp->rowid);

View File

@@ -107,7 +107,7 @@ $sql.= " ba.rowid as bankid, ba.ref as bankref,";
$sql.= " bu.url_id,";
$sql.= " f.module_source, f.ref as ref";
$sql.= " FROM ";
//if ($bid) $sql.= MAIN_DB_PREFIX."bank_class as l,";
//if ($bid) $sql.= MAIN_DB_PREFIX."category_bankline as l,";
$sql.= " ".MAIN_DB_PREFIX."bank_account as ba,";
$sql.= " ".MAIN_DB_PREFIX."bank as b";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu ON bu.fk_bank = b.rowid AND type = 'payment'";

View File

@@ -90,3 +90,4 @@ ALTER TABLE llx_societe_account ADD COLUMN date_last_reset_password datetime aft
-- Rename of bank table
ALTER TABLE llx_bank_categ RENAME TO llx_category_bank;
ALTER TABLE llx_bank_class RENAME TO llx_category_bankline;

View File

@@ -16,4 +16,4 @@
--
-- ===================================================================
ALTER TABLE llx_bank_class ADD UNIQUE INDEX uk_bank_class_lineid (lineid, fk_categ);
ALTER TABLE llx_category_bankline ADD UNIQUE INDEX uk_category_bankline_lineid (lineid, fk_categ);

View File

@@ -17,7 +17,7 @@
-- Table to link bank tag/categories with bank lines
-- ===================================================================
create table llx_bank_class
create table llx_category_bankline
(
lineid integer NOT NULL,
fk_categ integer NOT NULL

View File

@@ -259,7 +259,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
// Les contraintes indesirables ont un nom qui commence par 0_ ou se determine par ibfk_999
$listtables = array(
MAIN_DB_PREFIX.'adherent_options',
MAIN_DB_PREFIX.'bank_class',
MAIN_DB_PREFIX.'category_bankline',
MAIN_DB_PREFIX.'c_ecotaxe',
MAIN_DB_PREFIX.'c_methode_commande_fournisseur', // table renamed
MAIN_DB_PREFIX.'c_input_method'