FIX : range is MySQL reserved word, cannot be used as column names
This commit is contained in:
parent
9c394b58b5
commit
081c7824d2
@ -189,7 +189,7 @@ $tabsql[28]= "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.new
|
|||||||
$tabsql[29]= "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status";
|
$tabsql[29]= "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status";
|
||||||
$tabsql[30]= "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX."c_format_cards";
|
$tabsql[30]= "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX."c_format_cards";
|
||||||
$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.fk_pays as country_id, c.code as country_code, c.label as country, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s, ".MAIN_DB_PREFIX."c_country as c WHERE s.fk_pays=c.rowid and c.active=1";
|
$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.fk_pays as country_id, c.code as country_code, c.label as country, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s, ".MAIN_DB_PREFIX."c_country as c WHERE s.fk_pays=c.rowid and c.active=1";
|
||||||
$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range, a.position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
|
$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.ranges, a.position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
|
||||||
$tabsql[33]= "SELECT rowid, pos, code, label, active FROM ".MAIN_DB_PREFIX."c_hrm_department";
|
$tabsql[33]= "SELECT rowid, pos, code, label, active FROM ".MAIN_DB_PREFIX."c_hrm_department";
|
||||||
$tabsql[34]= "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PREFIX."c_hrm_function";
|
$tabsql[34]= "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PREFIX."c_hrm_function";
|
||||||
|
|
||||||
|
|||||||
@ -64,7 +64,7 @@ class FormAccounting
|
|||||||
|
|
||||||
if (! empty($mysoc->country_id))
|
if (! empty($mysoc->country_id))
|
||||||
{
|
{
|
||||||
$sql = "SELECT c.rowid, c.label as type, c.range";
|
$sql = "SELECT c.rowid, c.label as type, c.ranges";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c";
|
||||||
$sql.= " WHERE c.active = 1";
|
$sql.= " WHERE c.active = 1";
|
||||||
$sql.= " AND c.fk_country = ".$mysoc->country_id;
|
$sql.= " AND c.fk_country = ".$mysoc->country_id;
|
||||||
@ -72,14 +72,14 @@ class FormAccounting
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql = "SELECT c.rowid, c.label as type, c.range";
|
$sql = "SELECT c.rowid, c.label as type, c.ranges";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c, ".MAIN_DB_PREFIX."c_country as co";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c, ".MAIN_DB_PREFIX."c_country as co";
|
||||||
$sql.= " WHERE c.active = 1 AND c.fk_country = co.rowid";
|
$sql.= " WHERE c.active = 1 AND c.fk_country = co.rowid";
|
||||||
$sql.= " AND co.code = '".$mysoc->country_code."'";
|
$sql.= " AND co.code = '".$mysoc->country_code."'";
|
||||||
$sql.= " ORDER BY c.label ASC";
|
$sql.= " ORDER BY c.label ASC";
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_syslog("Form::select_accounting_category", LOG_DEBUG);
|
dol_syslog(get_class($this).'::'.__METHOD__, LOG_DEBUG);
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -96,7 +96,7 @@ class FormAccounting
|
|||||||
print '<option value="'.$obj->rowid.'"';
|
print '<option value="'.$obj->rowid.'"';
|
||||||
if ($obj->rowid == $selected) print ' selected';
|
if ($obj->rowid == $selected) print ' selected';
|
||||||
print '>'.dol_trunc($obj->type,$maxlen);
|
print '>'.dol_trunc($obj->type,$maxlen);
|
||||||
print ' ('.$obj->range.')';
|
print ' ('.$obj->ranges.')';
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
print '</select>';
|
print '</select>';
|
||||||
|
|||||||
@ -335,7 +335,7 @@ CREATE TABLE llx_c_accounting_category (
|
|||||||
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
code varchar(16) NOT NULL,
|
code varchar(16) NOT NULL,
|
||||||
label varchar(255) NOT NULL,
|
label varchar(255) NOT NULL,
|
||||||
range varchar(255) NOT NULL,
|
ranges varchar(255) NOT NULL,
|
||||||
position integer DEFAULT 0,
|
position integer DEFAULT 0,
|
||||||
fk_country integer DEFAULT NULL, -- This category is dedicated to a country
|
fk_country integer DEFAULT NULL, -- This category is dedicated to a country
|
||||||
active integer DEFAULT 1
|
active integer DEFAULT 1
|
||||||
|
|||||||
@ -21,7 +21,7 @@ CREATE TABLE llx_c_accounting_category (
|
|||||||
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
code varchar(16) NOT NULL,
|
code varchar(16) NOT NULL,
|
||||||
label varchar(255) NOT NULL,
|
label varchar(255) NOT NULL,
|
||||||
range varchar(255) NOT NULL,
|
ranges varchar(255) NOT NULL,
|
||||||
position integer DEFAULT 0,
|
position integer DEFAULT 0,
|
||||||
fk_country integer DEFAULT NULL, -- This category is dedicated to a country
|
fk_country integer DEFAULT NULL, -- This category is dedicated to a country
|
||||||
active integer DEFAULT 1
|
active integer DEFAULT 1
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user