diff --git a/html/admin/setup.php b/html/admin/setup.php index e33f4fcde..d7dd58c36 100644 --- a/html/admin/setup.php +++ b/html/admin/setup.php @@ -470,6 +470,11 @@ if ( DEBUG=='false' ) ob_start(); if ( GetVersion($db) == 16 ) { ExecuteScript($db,'sql/patch/upgrade16.sql'); } // version + if ( GetVersion($db) == 17 ) { + ExecuteScript($db,'sql/patch/upgrade17.sql'); + $max=getDbValue($db,'select last_value from s_jnt_fic_att_value'); + AlterSequence($db,'s_jnt_fic_att_value',$max+1); + } // version if ( DEBUG == 'false') ob_end_clean(); }//for @@ -553,6 +558,11 @@ if (DEBUG == 'false' ) ob_start(); if ( GetVersion($db) == 16 ) { ExecuteScript($db,'sql/patch/upgrade16.sql'); } // version + if ( GetVersion($db) == 17 ) { + ExecuteScript($db,'sql/patch/upgrade17.sql'); + $max=getDbValue($db,'select last_value from s_jnt_fic_att_value'); + AlterSequence($db,'s_jnt_fic_att_value',$max+1); + } // version if ( DEBUG == 'false') ob_end_clean(); } diff --git a/html/admin/sql/patch/upgrade17.sql b/html/admin/sql/patch/upgrade17.sql new file mode 100644 index 000000000..4bac8b27b --- /dev/null +++ b/html/admin/sql/patch/upgrade17.sql @@ -0,0 +1,14 @@ +begin; +-- add quick code for contact +insert into attr_min (frd_id,ad_id) values (16,23); + + + +insert into jnt_fic_attr select fd_id,23 from fiche_Def where frd_id=16; +insert into jnt_fic_att_value(jft_id,f_id,ad_id) select nextval('s_jnt_fic_att_value')+200,f_id,23 from fiche + where fd_id in (select fd_id from fiche_Def where frd_id=16); +insert into attr_value select jft_id,'FID'||f_id from jnt_fic_att_value join fiche using(f_id) where ad_id=23 and + fd_id in (select fd_id from fiche_Def where frd_id=16); + +update version set val=18; +commit; \ No newline at end of file diff --git a/include/fiche_inc.php b/include/fiche_inc.php index 833474575..ed7ea5760 100644 --- a/include/fiche_inc.php +++ b/include/fiche_inc.php @@ -430,12 +430,10 @@ function ViewFiche($p_cn,$p_type) { // Get all name the cards of the select category // 1 for attr_def.ad_id is always the name - $Res=ExecSql($p_cn,"select f_id,av_text,j_qcode from - fiche join jnt_fic_att_value using (f_id) - join attr_value using (jft_id) - left outer join vw_poste_qcode using(f_id) - where fd_id='".$p_type. - "' and ad_id=".ATTR_DEF_NAME." order by f_id $sql_offset $sql_limit "); + $Res=ExecSql($p_cn,"select f_id,vw_name,quick_code from ". + " vw_fiche_attr ". + " where fd_id='".$p_type. + "' order by f_id $sql_offset $sql_limit "); $Max=pg_NumRows($Res); echo $bar; @@ -447,12 +445,12 @@ function ViewFiche($p_cn,$p_type) { else echo '