check(); $g_user->check_dossier(dossier::id()); set_language(); if ( $d == 'all') { $filter_card=''; } else if (strpos($d,'sql]')==true) { $filter_card= str_replace('[sql]', " and ", $d); } else $filter_card="and fd_id in ($d)"; if ( $jrn != -1 ) { switch ($d) { case 'cred': $filter_jrn=$cn->make_list("select jrn_def_fiche_cred from jrn_def where jrn_def_id=$1",array($jrn)); $filter_card=($filter_jrn != "")?" and fd_id in ($filter_jrn)":' and false '; break; case 'deb': $filter_jrn=$cn->make_list("select jrn_def_fiche_deb from jrn_def where jrn_def_id=$1",array($jrn)); $filter_card=($filter_jrn != "")?" and fd_id in ($filter_jrn)":' and false '; break; case 'filter': $get_cred='jrn_def_fiche_cred'; $get_deb='jrn_def_fiche_deb'; $deb=$cn->get_value("select $get_deb from jrn_def where jrn_def_id=$1",array($jrn)); $cred=$cn->get_value("select $get_cred from jrn_def where jrn_def_id=$1",array($jrn)); $filter_jrn=""; if ($deb!=='' && $cred!='') $filter_jrn =$deb.','.$cred; elseif($deb != '') $filter_jrn=$deb; elseif($cred != '') $filter_jrn=$cred; $filter_card=($filter_jrn != "")?" and fd_id in ($filter_jrn)":' and false '; break; } } else { if (isset($_REQUEST['type'])) { if ($_REQUEST['type']=='gl' || $_REQUEST['type']=='') $filter_card=''; else { $get_cred='jrn_def_fiche_cred'; $get_deb='jrn_def_fiche_deb'; $filter_jrn=$cn->make_list("select $get_cred||','||$get_deb as fiche from jrn_def where jrn_def_type=$1",array($_REQUEST['type'])); $filter_card=($filter_jrn != "")?" and fd_id in ($filter_jrn)":' and false '; } } } /* create a filter based on j */ /*$sql_str="select f_id, vw_name,quick_code,vw_description ". " from vw_fiche_attr where ". " ( vw_name ilike '%'||$1||'%' or quick_code ilike $2||'%' or vw_description ilike '%'||$3||'%') ". $filter_card; */ $sql_str="select distinct f_id from fiche join fiche_detail using (f_id) where ad_id in (9,1,23) and ad_value ilike '%'||$1||'%' ".$filter_card.' limit 12'; $sql=$cn->get_array($sql_str ,array($_REQUEST['FID'])); if (sizeof($sql) != 0 ) { echo "'; if (count($sql) > 12) { printf ('...'._('Résultat limité à 12').' ...'); } } else { echo ""; } ?>