From 84d326e03612cae4c36e95bae38e48de3829892d Mon Sep 17 00:00:00 2001 From: aspangaro Date: Fri, 1 Apr 2016 06:41:49 +0200 Subject: [PATCH 1/4] FIX: Problem with dolibarr installation/migration script. Range is a reserved name. --- htdocs/admin/dict.php | 47 ++----------------- .../core/class/html.formaccounting.class.php | 6 +-- .../install/mysql/migration/3.9.0-4.0.0.sql | 2 +- .../tables/llx_c_accounting_category.sql | 2 +- 4 files changed, 10 insertions(+), 47 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index d88df512b8c..a872f5b92ce 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -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.range_account, 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"; @@ -263,44 +263,7 @@ $tabfield[28]= "code,label,affect,delay,newbymonth,country_id,country"; $tabfield[29]= "code,label,percent,position"; $tabfield[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y"; $tabfield[31]= "pcg_version,country_id,country,label"; -$tabfield[32]= "code,label,range,position,country_id,country"; -$tabfield[33]= "code,label"; -$tabfield[34]= "code,label"; - -// Nom des champs d'edition pour modification d'un enregistrement -$tabfieldvalue=array(); -$tabfieldvalue[1] = "code,libelle,country"; -$tabfieldvalue[2] = "code,libelle,region"; // "code,libelle,region" -$tabfieldvalue[3] = "code,libelle,country"; -$tabfieldvalue[4] = "code,label"; -$tabfieldvalue[5] = "code,label"; -$tabfieldvalue[6] = "code,libelle,type,color,position"; -$tabfieldvalue[7] = "code,libelle,country,accountancy_code,deductible"; -$tabfieldvalue[8] = "code,libelle,country".(! empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?',position':''); -$tabfieldvalue[9] = "code,label,unicode"; -$tabfieldvalue[10]= "country,code,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note"; -$tabfieldvalue[11]= "element,source,code,libelle,position"; -$tabfieldvalue[12]= "code,libelle,libelle_facture,nbjour,fdm,decalage,sortorder"; -$tabfieldvalue[13]= "code,libelle,type,accountancy_code"; -$tabfieldvalue[14]= "code,libelle,price,organization,country"; -$tabfieldvalue[15]= "code,libelle,width,height,unit"; -$tabfieldvalue[16]= "code,libelle,sortorder"; -$tabfieldvalue[17]= "code,label,accountancy_code"; -$tabfieldvalue[18]= "code,libelle,tracking"; -$tabfieldvalue[19]= "code,libelle"; -$tabfieldvalue[20]= "code,libelle"; -$tabfieldvalue[21]= "code,label"; -$tabfieldvalue[22]= "code,label"; -$tabfieldvalue[23]= "country,taux,accountancy_code_sell,accountancy_code_buy,note"; -$tabfieldvalue[24]= "code,label"; -$tabfieldvalue[25]= "label,type_template,position,topic,content"; -$tabfieldvalue[26]= "code,label,short_label"; -$tabfieldvalue[27]= "code,libelle"; -$tabfieldvalue[28]= "code,label,affect,delay,newbymonth,country"; -$tabfieldvalue[29]= "code,label,percent,position"; -$tabfieldvalue[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y"; -$tabfieldvalue[31]= "pcg_version,country,label"; -$tabfieldvalue[32]= "code,label,range,position,country"; +$tabfield[32]= "code,label,range_account,position,country"; $tabfieldvalue[33]= "code,label"; $tabfieldvalue[34]= "code,label"; @@ -337,7 +300,7 @@ $tabfieldinsert[28]= "code,label,affect,delay,newbymonth,fk_country"; $tabfieldinsert[29]= "code,label,percent,position"; $tabfieldinsert[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y"; $tabfieldinsert[31]= "pcg_version,fk_pays,label"; -$tabfieldinsert[32]= "code,label,range,position,fk_country"; +$tabfieldinsert[32]= "code,label,range_account,position,fk_country"; $tabfieldinsert[33]= "code,label"; $tabfieldinsert[34]= "code,label"; @@ -998,7 +961,7 @@ if ($id) if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); } if ($fieldlist[$field]=='short_label') { $valuetoshow=$langs->trans("ShortLabel"); } if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); } - if ($fieldlist[$field]=='range') { $valuetoshow=$langs->trans("Range"); } + if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); } if ($id == 2) // Special cas for state page { @@ -1166,7 +1129,7 @@ if ($id) if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); } if ($fieldlist[$field]=='short_label') { $valuetoshow=$langs->trans("ShortLabel"); } if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); } - if ($fieldlist[$field]=='range') { $valuetoshow=$langs->trans("Range"); } + if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); } // Affiche nom du champ if ($showfield) diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index e8664e3166d..4a76cca81d6 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -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.range_account"; $sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c"; $sql.= " WHERE c.active = 1"; $sql.= " AND c.fk_country = ".$mysoc->country_id; @@ -72,7 +72,7 @@ class FormAccounting } else { - $sql = "SELECT c.rowid, c.label as type, c.range"; + $sql = "SELECT c.rowid, c.label as type, c.range_account"; $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."'"; @@ -96,7 +96,7 @@ class FormAccounting print '