diff --git a/include/adm.inc.php b/include/adm.inc.php index ca7fe66a4..6829fe4d7 100644 --- a/include/adm.inc.php +++ b/include/adm.inc.php @@ -83,8 +83,8 @@ if ( $low_action == "list" ) echo HtmlInput::request_to_hidden(array('ac')); $sel_card=new ISelect('cat'); $sel_card->value=$cn->make_array('select fd_id, fd_label from fiche_def '. - ' where frd_id='.FICHE_TYPE_ADM_TAX. - ' order by fd_label ',1); + ' where frd_id=$1 '. + ' order by fd_label ',1,array(FICHE_TYPE_ADM_TAX)); $sel_card->selected=(isset($_GET['cat']))?$_GET['cat']:-1; $sel_card->javascript=' onchange="submit(this);"'; echo _('Catégorie :').$sel_card->input(); diff --git a/include/ajax_add_menu.php b/include/ajax_add_menu.php index 5b22fc2bb..9a73ab4fc 100644 --- a/include/ajax_add_menu.php +++ b/include/ajax_add_menu.php @@ -33,13 +33,13 @@ $ame_code_dep=$cn->make_array(" menu_ref where me_file is null and me_javascript is null and me_url is null and me_type<>'PR' and me_type <> 'SP' - and me_code in (select me_code from profile_menu where p_id=".sql_string($p_id).")". + and me_code in (select me_code from profile_menu where p_id=$1)". " UNION ALL select me_code,me_code||' '||me_menu||' '||coalesce(me_description,'') from menu_ref where me_code='EXT' order by 1 - ",1); + ",1,array($p_id)); $ame_code=$cn->make_array(" select me_code,me_code||' '||coalesce(me_menu,'')||' '||coalesce(me_description,'') ||'('|| case when me_type='SP' then 'Special' @@ -109,9 +109,9 @@ select me_code,me_code||' '||coalesce(me_menu,'')||' '||coalesce(me_description, from menu_ref where me_type='PR' - and me_code not in (select me_code from profile_menu where p_id=".sql_string($p_id).") + and me_code not in (select me_code from profile_menu where p_id=$1) order by 1 - "); + ",0,array($p_id)); $me_code=new ISelect('me_code'); $me_code->value=$ame_code; diff --git a/include/ajax_get_menu_detail.php b/include/ajax_get_menu_detail.php index c3e9100fd..b8f256221 100644 --- a/include/ajax_get_menu_detail.php +++ b/include/ajax_get_menu_detail.php @@ -34,13 +34,13 @@ $ame_code_dep=$cn->make_array(" menu_ref where me_file is null and me_javascript is null and me_url is null and me_type<>'PR' and me_type <> 'SP' - and me_code in (select me_code from profile_menu where p_id=".sql_string($profile).")". + and me_code in (select me_code from profile_menu where p_id=$1)". " UNION ALL select me_code,me_code||' '||me_menu||' '||coalesce(me_description,'') from menu_ref where me_code='EXT' order by 1 - ",1); + ",1,array($profile)); $a_type=$cn->make_array("select pm_type,pm_desc from profile_menu_type",1); $array=$cn->get_array("select p_id,pm_id,me_code,me_code_dep,p_order,p_type_display,pm_default diff --git a/include/bank.inc.php b/include/bank.inc.php index c76d7459e..643c1e90e 100644 --- a/include/bank.inc.php +++ b/include/bank.inc.php @@ -76,8 +76,8 @@ if ( $low_action == "list" ) $a); $sel_card=new ISelect('cat'); $sel_card->value=$cn->make_array('select fd_id, fd_label from fiche_def '. - ' where frd_id='.FICHE_TYPE_FIN. - ' order by fd_label ',1); + ' where frd_id=$1'. + ' order by fd_label ',1,array(FICHE_TYPE_FIN)); $sel_card->selected=(isset($_GET['cat']))?$_GET['cat']:-1; $sel_card->javascript=' onchange="submit(this);"'; echo _('Catégorie :').$sel_card->input(); diff --git a/include/class_database.php b/include/class_database.php index 48707174e..0c4c9b64e 100644 --- a/include/class_database.php +++ b/include/class_database.php @@ -711,42 +711,43 @@ class Database } /** - * \brief make a array with the sql + * \brief make a array with the sql. * * \param $p_sql sql statement, only the first two column will be returned in * an array. The first col. is the label and the second the value * \param $p_null if the array start with a null value + * \param $p_array is the array with the bind value * \note this function is used with ISelect when it is needed to have a list of - * options + * options. * \return: a double array like \verbatim Array ( - [0] => Array - ( - [value] => 1 - [label] => Marchandise A - ) + [0] => Array + ( + [value] => 1 + [label] => Marchandise A + ) [1] => Array - ( - [value] => 2 - [label] => Marchandise B - ) + ( + [value] => 2 + [label] => Marchandise B + ) [2] => Array - ( - [value] => 3 - [label] => Marchandise C - ) + ( + [value] => 3 + [label] => Marchandise C + ) ) \endverbatim * \see ISelect */ - function make_array($p_sql, $p_null=0) + function make_array($p_sql, $p_null=0,$p_array=null) { - $a=$this->exec_sql($p_sql); + $a=$this->exec_sql($p_sql,$p_array); $max=pg_NumRows($a); if ($max==0&&$p_null==0) return null; diff --git a/include/class_iselect.php b/include/class_iselect.php index ae1d11d24..054861213 100644 --- a/include/class_iselect.php +++ b/include/class_iselect.php @@ -21,6 +21,7 @@ /*!\file * \brief Html Input + * @see Database::make_array */ require_once('class_html_input.php'); class ISelect extends HtmlInput