Database::make_array ajoute un paramètre dans le cas où le
SQL admet une condition
This commit is contained in:
parent
bc630ba4e7
commit
59e76cb5d3
6 changed files with 29 additions and 27 deletions
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
/*!\file
|
||||
* \brief Html Input
|
||||
* @see Database::make_array
|
||||
*/
|
||||
require_once('class_html_input.php');
|
||||
class ISelect extends HtmlInput
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue