"; for ($i=0;$i"; $result.=""; $result.=""; $result.=$id." ".h($name).""; $result.=""; $result.=""; $desc=($desc=="")?"Aucune description":h($desc); $desc="".$desc.""; $result.="".$desc; $result.=""; $result.=""; } $result.=""; return $result; } /*! * \brief Get all the available folders * for the users, checked with the security * * \param $p_user user login * \param $p_admin 1 if admin * \return array containing * - ac_dossier.dos_id * - ac_dossier.dos_name * - ac_dossier.dos_description * */ function GetAvailableFolder($p_user,$p_admin,$p_filter="") { $filter=""; if ($p_admin==0) { // show only available folders // if user is not an admin $sql="select distinct dos_id,dos_name,dos_description from ac_users natural join jnt_use_dos natural join ac_dossier join priv_user on ( priv_jnt=jnt_id) where use_active=1 and use_login='$p_user' and priv_priv != 'X' and dos_name ilike '%$p_filter%' order by dos_name"; } else { $sql="select distinct dos_id,dos_name,dos_description from ac_dossier where dos_name ilike '%$p_filter%' order by dos_name"; } include_once("postgres.php"); $cn=DbConnect(); $Res=ExecSql($cn,$sql); $max=pg_numRows($Res); if ( $max == 0 ) return 0; for ($i=0;$i<$max;$i++) { $array[]=pg_fetch_array($Res,$i); } return $array; } /*! * \brief show the top menu for the user profile * and highight the selected one * \param p_high what to hightlight, by default it is autodetected * but sometimes it must be given. Default value="" * * \return string * */ function ShowMenuCompta($p_high="") { include_once("postgres.php"); // find our current menu $default=basename($_SERVER['PHP_SELF']); switch ($default) { case "user_jrn.php": $default.="?show&".dossier::get(); break; case "recherche.php": $default.="?".dossier::get(); break; case "fiche.php": $default.="?".dossier::get(); break; } if ( $p_high !== "" ) $default=$p_high; if ( isset($_REQUEST['p_action'])) { switch ($_REQUEST['p_action'] ) { case 'impress': $default=5; break; case 'fiche': $default=6; break; case 'quick_writing': $default=4; break; case 'gl': $default=0; break; case 'ven': $default=1; break; case 'client': $default=1; break; case 'ach': case 'fournisseur': $default=2; break; case 'bank': $default=3; break; } } echo_debug('user_menu.php',__LINE__,'defaut is '.$default); $str_dossier=dossier::get(); $p_array=array( array("compta.php?p_action=gl&".$str_dossier ,"Grand Livre","Grand livre : toutes les opérations",0), array("compta.php?p_action=ven&".$str_dossier ,"Vente","Journal de vente / produit",1), array("compta.php?p_action=ach&".$str_dossier,"Dépense","Journaux de dépense, d'achat",2 ), array("compta.php?p_action=bank&".$str_dossier,"Financier","Journaux financiers: les banques, la caisse",3), array('compta.php?p_action=quick_writing&'.$str_dossier,'Ecriture directe','Ecriture directe dans les journaux',4), array("compta.php?p_action=impress&".$str_dossier,"Impression","Impression",5), array("compta.php?p_action=fiche&".$str_dossier,"Fiche","Ajouter, modifier ou effacer des fiches",6), array("user_advanced.php?".$str_dossier,"Avancé","Opérations délicates",7), ); $result=ShowItem($p_array,'H',"mtitle","mtitle",$default,' width="100%"'); $str_dossier=dossier::get(); $r=""; $r.=menu_tool("user_compta.php"); $r.='
'; $r.=$result; $r.='
'; // $r.=''; return $r; } /*! * \brief Open the first legder automaticaly * \param $p_dossier dossier::id * \param $p_type type of the ledger (VEN,ACH,FIN,ODS) * * * * \return the first jrn_def_id */ function GetFirstJrnIdForJrnType($p_dossier,$p_type) { include_once("postgres.php"); //get db connection $Cn=DbConnect($p_dossier); //execute query $Ret=ExecSql($Cn,"select min(jrn_def_id) from jrn_def ". "where jrn_def_type='".$p_type."';"); $l_line=pg_fetch_array($Ret,0); return $l_line[0]; //return 0; } /*! * \brief Returns the form for the search (module accountancy) * * \param : * \param $p_cn database connection * \param $p_jrn jrn id * \param $p_array=null previous search * * * \return HTML Code * * */ function u_ShowMenuRecherche($p_cn,$p_jrn,$p_sessid,$p_array=null) { echo_debug('user_menu.php',__LINE__,"u_ShowMenuRecherche($p_cn,$p_array)"); if ( $p_array != null ) { foreach ( $p_array as $key=> $element) { ${"p_$key"}=$element; echo_debug('user_menu.php',__LINE__,"p_$key =$element;"); } } // Find the journal property /* $opt='