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[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[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[34]= "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PREFIX."c_hrm_function";
|
||||
|
||||
@ -644,7 +644,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
$ok=0;
|
||||
setEventMessages($langs->transnoentities("ErrorFieldMustBeANumeric",$langs->transnoentities("Code")), null, 'errors');
|
||||
}
|
||||
|
||||
|
||||
// Clean some parameters
|
||||
if (isset($_POST["localtax1"]) && empty($_POST["localtax1"])) $_POST["localtax1"]='0'; // If empty, we force to 0
|
||||
if (isset($_POST["localtax2"]) && empty($_POST["localtax2"])) $_POST["localtax2"]='0'; // If empty, we force to 0
|
||||
@ -1064,7 +1064,7 @@ if ($id)
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>";
|
||||
|
||||
|
||||
if ($tabname[$id] == MAIN_DB_PREFIX.'c_email_templates')
|
||||
{
|
||||
print '<tr><td colspan="8">* '.$langs->trans("AvailableVariables").": ";
|
||||
@ -1407,7 +1407,7 @@ if ($id)
|
||||
if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO')) || in_array($obj->type, array('systemauto'))) { $canbedisabled=0; $canbedisabled = 0; }
|
||||
$canbemodified=$iserasable;
|
||||
if ($obj->code == 'RECEP') $canbemodified=1;
|
||||
|
||||
|
||||
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'').'&id='.$id.'&';
|
||||
|
||||
// Favorite
|
||||
|
||||
@ -64,7 +64,7 @@ class FormAccounting
|
||||
|
||||
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.= " WHERE c.active = 1";
|
||||
$sql.= " AND c.fk_country = ".$mysoc->country_id;
|
||||
@ -72,14 +72,14 @@ class FormAccounting
|
||||
}
|
||||
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.= " WHERE c.active = 1 AND c.fk_country = co.rowid";
|
||||
$sql.= " AND co.code = '".$mysoc->country_code."'";
|
||||
$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);
|
||||
if ($resql)
|
||||
{
|
||||
@ -96,7 +96,7 @@ class FormAccounting
|
||||
print '<option value="'.$obj->rowid.'"';
|
||||
if ($obj->rowid == $selected) print ' selected';
|
||||
print '>'.dol_trunc($obj->type,$maxlen);
|
||||
print ' ('.$obj->range.')';
|
||||
print ' ('.$obj->ranges.')';
|
||||
$i++;
|
||||
}
|
||||
print '</select>';
|
||||
|
||||
@ -335,7 +335,7 @@ CREATE TABLE llx_c_accounting_category (
|
||||
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
code varchar(16) NOT NULL,
|
||||
label varchar(255) NOT NULL,
|
||||
range varchar(255) NOT NULL,
|
||||
ranges varchar(255) NOT NULL,
|
||||
position integer DEFAULT 0,
|
||||
fk_country integer DEFAULT NULL, -- This category is dedicated to a country
|
||||
active integer DEFAULT 1
|
||||
|
||||
@ -21,7 +21,7 @@ CREATE TABLE llx_c_accounting_category (
|
||||
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
code varchar(16) NOT NULL,
|
||||
label varchar(255) NOT NULL,
|
||||
range varchar(255) NOT NULL,
|
||||
ranges varchar(255) NOT NULL,
|
||||
position integer DEFAULT 0,
|
||||
fk_country integer DEFAULT NULL, -- This category is dedicated to a country
|
||||
active integer DEFAULT 1
|
||||
|
||||
Loading…
Reference in New Issue
Block a user