From 5c497d5092a5b9f7bebd161f066d6872ff5977c8 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Fri, 28 Oct 2011 20:59:25 +0000 Subject: [PATCH] Merged revisions 4209,4229-4232,4234,4237-4249 via svnmerge from svn+ssh://ns352270.ovh.net/svn/phpcompta/branches/rel600-dynamic-menu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ........ r4209 | danydb | 2011-10-13 22:06:13 +0200 (Thu, 13 Oct 2011) | 1 line Add new files ........ r4229 | danydb | 2011-10-23 20:51:09 +0200 (Sun, 23 Oct 2011) | 1 line Dynamic menu: impress works ........ r4230 | danydb | 2011-10-24 22:38:15 +0200 (Mon, 24 Oct 2011) | 2 lines #241 : modularity for SALE ledger ........ r4231 | danydb | 2011-10-24 22:47:02 +0200 (Mon, 24 Oct 2011) | 2 lines #241 : modularity for PURCHASE ledger ........ r4232 | danydb | 2011-10-25 23:03:53 +0200 (Tue, 25 Oct 2011) | 2 lines #241 : modularity for FINANCIAL ledger ........ r4234 | danydb | 2011-10-26 01:09:02 +0200 (Wed, 26 Oct 2011) | 2 lines #241 : modularity for CARD ledger + alphanum prob ........ r4237 | danydb | 2011-10-27 20:59:39 +0200 (Thu, 27 Oct 2011) | 2 lines #241 : modularity for lettering ........ r4238 | danydb | 2011-10-27 21:10:19 +0200 (Thu, 27 Oct 2011) | 3 lines #241 :adapt width submenu ........ r4239 | danydb | 2011-10-27 21:40:42 +0200 (Thu, 27 Oct 2011) | 3 lines #241 : modularity : old user_advanced.php ........ r4240 | danydb | 2011-10-27 21:44:27 +0200 (Thu, 27 Oct 2011) | 3 lines #241 : modularity : deprecated function ........ r4241 | danydb | 2011-10-27 21:46:26 +0200 (Thu, 27 Oct 2011) | 3 lines #241 : modularity : remove obsolete files ........ r4242 | danydb | 2011-10-27 21:54:39 +0200 (Thu, 27 Oct 2011) | 3 lines #241 : modularity : gestion card + gestion IMP ........ r4243 | danydb | 2011-10-27 22:28:36 +0200 (Thu, 27 Oct 2011) | 3 lines #241 : modularity : gestion customer + supplier + forecast + follow up ........ r4244 | danydb | 2011-10-28 00:47:55 +0200 (Fri, 28 Oct 2011) | 5 lines #241 : modularity : parameter company periode misc : tva , card attr, middle of payment, accounting,cat of doc, cat of card ........ r4245 | danydb | 2011-10-28 00:51:43 +0200 (Fri, 28 Oct 2011) | 1 line update menu_ref, profile_menu ........ r4246 | danydb | 2011-10-28 00:52:13 +0200 (Fri, 28 Oct 2011) | 1 line rewriting : change ShowMenuPcmn by menu_acc_plan ........ r4247 | danydb | 2011-10-28 20:04:01 +0200 (Fri, 28 Oct 2011) | 1 line #241 : modularity : parameter Document ........ r4248 | danydb | 2011-10-28 22:00:42 +0200 (Fri, 28 Oct 2011) | 1 line #241 : modularity : préférence ........ r4249 | danydb | 2011-10-28 22:16:44 +0200 (Fri, 28 Oct 2011) | 1 line last fix ........ --- html/compta.php | 108 ---- include/letter.inc.php => html/do.php | 59 +-- html/parametre.php | 2 +- html/user_advanced.php | 123 ----- include/ac_common.php | 77 ++- include/action.inc.php | 10 +- include/adm.inc.php | 16 +- include/anc_imp.inc.php | 19 +- include/anc_od.inc.php | 17 +- include/anc_pa.inc.php | 26 +- include/balance.inc.php | 29 +- include/balance_card.inc.php | 9 +- include/class_acc_account_ledger.php | 64 ++- include/class_acc_ledger.php | 147 ++++-- include/class_anc_print.php | 7 +- include/class_document_modele.php | 24 +- include/class_fiche.php | 2 +- include/class_fiche_def.php | 35 +- include/class_periode.php | 14 +- include/class_pre_operation.php | 3 +- include/client.inc.php | 176 ++++--- include/company.inc.php | 102 ++++ include/compta_ach.inc.php | 25 +- include/compta_fin.inc.php | 20 +- include/compta_ven.inc.php | 27 +- include/dashboard.inc.php | 39 ++ include/document_modele.inc.php | 2 +- include/fiche.inc.php | 55 +- include/fiche_def.inc.php | 8 +- include/forecast.inc.php | 515 ++++++++++--------- include/impress_bilan.inc.php | 6 +- include/impress_fiche.inc.php | 9 +- include/impress_gl_comptes.inc.php | 18 +- include/impress_jrn.inc.php | 19 +- include/impress_poste.inc.php | 16 +- include/impress_rapport.inc.php | 16 +- include/impress_rec.inc.php | 12 +- include/lettering.account.inc.php | 4 +- include/lettering.card.inc.php | 4 +- include/lettering.gestion.inc.php | 5 +- include/opening.inc.php | 26 +- include/param_pcmn.inc.php | 4 +- include/payment_middle.inc.php | 8 +- include/periode.inc.php | 18 +- include/pref.inc.php | 313 ++++++------ include/preod.inc.php | 4 +- include/stock.inc.php | 35 +- include/suivi_adm.inc.php | 2 +- include/suivi_supplier.inc.php | 2 +- include/supplier.inc.php | 11 +- include/template/list_category_document.php | 3 +- include/template/menu.php | 57 +++ include/template/modele_document.php | 6 +- include/template/module.php | 40 ++ include/template/periode_add_exercice.php | 6 +- include/user_action_gl.php | 7 +- include/user_menu.php | 30 +- sql/backup-new-object.sh | 1 + sql/object-6.0.sql | 530 ++++++++++++++++++++ 59 files changed, 1834 insertions(+), 1138 deletions(-) delete mode 100644 html/compta.php rename include/letter.inc.php => html/do.php (53%) delete mode 100644 html/user_advanced.php create mode 100644 include/company.inc.php create mode 100644 include/dashboard.inc.php create mode 100644 include/template/menu.php create mode 100644 include/template/module.php create mode 100755 sql/backup-new-object.sh create mode 100644 sql/object-6.0.sql diff --git a/html/compta.php b/html/compta.php deleted file mode 100644 index 7d1d91210..000000000 --- a/html/compta.php +++ /dev/null @@ -1,108 +0,0 @@ -'._(' Vous êtes déconnecté').''; - redirect('index.php',1); - exit(); -} -//---------------------------------------------------------------------- - -require_once('class_database.php'); -/* Admin. Dossier */ -$cn=new Database($gDossier); - - -require_once ('class_user.php'); -$User=new User($cn); -$User->Check(); -if ($User->check_dossier($gDossier)=='P') -{ - redirect("extension.php?".dossier::get(),0); - exit(); -} -require_once ('function_javascript.php'); -html_page_start($_SESSION['g_theme']); -echo load_all_script(); -include_once ("user_menu.php"); -echo '
'; - -echo ShowMenuCompta("user_advanced.php?".dossier::get()); -echo js_include('anc_script.js'); -echo '
'; -// Get action - -// call impress sub-menu -if ( $action == 'impress' ) -{ - require_once('impress.inc.php'); -} - -if ( $action == 'fiche') -{ - - require_once('fiche.inc.php'); -} - -if ( $action == 'stock') -{ - require_once('stock.inc.php'); -} -if ( $action=='quick_writing') -{ - require_once ('compta_ods.inc.php'); -} -if ( $action == 'gl' ) -{ - require_once ('user_action_gl.php'); -} -if ( $action == 'ven' || - $action == 'client') -{ - require_once ('compta_ven.inc.php'); -} -if ( $action == 'ach' || - $action == 'fournisseur') -{ - require_once ('compta_ach.inc.php'); -} -if ( $action == 'fin') -{ - require_once ('compta_fin.inc.php'); -} -if ($action == 'let') -{ - require_once('letter.inc.php'); -} -html_page_stop(); -?> diff --git a/include/letter.inc.php b/html/do.php similarity index 53% rename from include/letter.inc.php rename to html/do.php index 62ea5586a..0666a2dea 100644 --- a/include/letter.inc.php +++ b/html/do.php @@ -1,4 +1,5 @@ '; -echo ShowItem($array,'H','mtitle','mtitle',$subdef); -echo ''; -if ($sa == 'poste') +else { - require_once('lettering.account.inc.php'); - exit; + show_module(-1); } -if ($sa=='qc') -{ - require_once('lettering.card.inc.php'); - exit; -} + diff --git a/html/parametre.php b/html/parametre.php index d15c57a39..6f4ece330 100644 --- a/html/parametre.php +++ b/html/parametre.php @@ -410,7 +410,7 @@ if ( $p_action == 'jrn' ) $sa=(isset($_REQUEST['sa']))?$_REQUEST['sa']:""; // echo '
'; if ( $sa == "add") - require_once ('param_jrn_add.inc.php'); + require_once 'param_jrn_add.inc.php'; elseif ($sa=='detail') require_once ('param_jrn_detail.inc.php'); else diff --git a/html/user_advanced.php b/html/user_advanced.php deleted file mode 100644 index 911e0b938..000000000 --- a/html/user_advanced.php +++ /dev/null @@ -1,123 +0,0 @@ -Check(); -$User->check_dossier(dossier::id()); -$cn=new Database(dossier::id()); -$User->db=$cn; - -require_once('class_database.php'); -require_once('class_ipopup.php'); -load_all_script(); -echo ICard::ipopup('ipopcard'); -echo IPoste::ipopup('ipop_account'); -$search_card=new IPopup('ipop_card'); -$search_card->title=_('Recherche de fiche'); -$search_card->value=''; -echo $search_card->input(); - - - -// We don't check permissions here in fact, permission are tested in the -// functions - -// Show the top menus -include_once ("user_menu.php"); -echo '
'; - - -echo ShowMenuCompta(7); -echo '
'; -$p_action=""; - - -$p_action=(isset($_REQUEST['p_action']))?$_REQUEST['p_action']:""; -switch ($p_action) -{ -case 'preod': - $high=9; - break; -case 'periode'; - $high=2; - break; -case 'verif'; - $high=10; - break; -case 'defreport': - $high=6; - break; -case 'ouv': - $high=8; - break; -default: - $high=0; - -} -echo ShowMenuAdvanced($high); - - -//-------------------------------------------------- -// Predefined operation -//-------------------------------------------------- - -if ($p_action=="preod") -{ - require_once('preod.inc.php'); - - exit(); -} -//---------------------------------------------------------------------- -// Verification solde -//---------------------------------------------------------------------- -if ( $p_action=='verif' ) -{ - require_once ('verif_bilan.inc.php'); - exit(); -} - -if ($p_action=='defreport') -{ - require_once('report.inc.php'); -} -/* -------------------------------------------------- -Import writing (opening exercice) --------------------------------------------------- */ -if ( $p_action == 'ouv') -{ - require_once('opening.inc.php'); -} -html_page_stop(); -?> diff --git a/include/ac_common.php b/include/ac_common.php index 08a8b60e7..4ae1d1418 100644 --- a/include/ac_common.php +++ b/include/ac_common.php @@ -602,7 +602,7 @@ function set_language() /** *@brief try to determine on what os you are running the pĥpcompte *server - *@return + *@return * 0 it is a windows * 1 it is a Unix like */ @@ -687,4 +687,79 @@ EOF; exit(); } } +/** + * + * @param int $selected module selected + */ +function show_module($selected) +{ + global $g_user; + $cn=Dossier::connect(); + $amodule=$cn->get_array("select + me_code,me_menu,me_url + from v_all_menu + where + user_name=$1 + and p_type_display='M' + order by p_order",array($g_user->login)); + require_once('template/module.php'); + if ( $selected != -1 ) + { + $file=$cn->get_value("select me_file from v_all_menu where me_code=$1",array($selected)); + if ($file != '') + require_once $file; + } + +} +/** + * show default module + */ +function show_default() +{ + $cn=Dossier::connect(); + $file=$cn->get_array('SELECT m_code FROM module where m_default=1'); + if (! empty ($file) ) + { + $selected=$file[0]['m_code']; + show_module($selected); + } +} +/** + * + */ +function show_menu($module,$idx) +{ + global $g_user; + $cn=Dossier::connect(); + $amenu=$cn->get_array("select + me_menu,me_code + from v_all_menu + where + me_code_dep=$1 order by p_order",array($module[$idx])); + + if (! empty ($amenu)) + { + require 'template/menu.php'; + } + else + { +/** + * @todo add security + * check if user can access this module + */ + $file=$cn->get_value("select me_file + from menu_ref + where + me_code=$1 and + (me_file is not null or trim(me_file) <>'')", + array($module[$idx])); + + if ( $file != "" ) + { + echo '
'; + require_once "$file"; + echo '
'; + } + } +} ?> diff --git a/include/action.inc.php b/include/action.inc.php index 609f1ecc8..d1f33d91f 100644 --- a/include/action.inc.php +++ b/include/action.inc.php @@ -22,10 +22,10 @@ * \brief Page who manage the different actions (meeting, letter) */ require_once('class_ipopup.php'); +global $g_user; +$g_user->can_request(GECOUR); -$User->can_request(GECOUR); - -$retour=HtmlInput::button_anchor(_('Retour'),'?p_action=suivi_courrier&my_action&'.dossier::get()); +$retour=HtmlInput::button_anchor(_('Retour'),'?ac='.$_REQUEST['ac'].'&my_action&'.dossier::get()); //----------------------------------------------------- // Action //----------------------------------------------------- @@ -53,8 +53,8 @@ $sub_action=(isset($_REQUEST['sa']))?$_REQUEST['sa']:""; * with the generation of document */ $ag_id=(isset($_REQUEST['ag_id']))?$_REQUEST['ag_id']:0; -$p_action=$_REQUEST['p_action']; -$base='p_action='.$p_action; +$ac=$_REQUEST['ac']; +$base='ac='.$ac; require_once('action.common.inc.php'); echo "
"; diff --git a/include/adm.inc.php b/include/adm.inc.php index c559e0014..d7e1de478 100644 --- a/include/adm.inc.php +++ b/include/adm.inc.php @@ -31,18 +31,14 @@ require_once('class_iaction.php'); require_once('class_fiche_def.php'); require_once('class_ipopup.php'); require_once('class_admin.php'); -echo js_include('accounting_item.js'); -echo js_include('prototype.js'); -echo js_include('scriptaculous.js'); -echo js_include('effects.js'); -echo js_include('controls.js'); -echo js_include('dragdrop.js'); + +global $g_user; $low_action=(isset($_REQUEST['sb']))?$_REQUEST['sb']:"list"; /*! \file * \brief Called from the module "Gestion" to manage the customer */ -$User->can_request(GECUST); +$g_user->can_request(GECUST); $href=basename($_SERVER['PHP_SELF']); // by default open liste @@ -55,7 +51,7 @@ if ( $low_action == "" ) //----------------------------------------------------- if ( isset($_POST['delete_card'] ) ) { - if ( $User->check_action(FICADD) == 0 ) + if ( $g_user->check_action(FICADD) == 0 ) { alert('Vous ne pouvez pas enlever de fiche'); return; @@ -136,7 +132,7 @@ if ( $low_action == "list" ) } /*---------------------------------------------------------------------- * Detail for a card, Suivi, Contact, Operation,... * - * cc stands for customer card + * cc stands for customer card *----------------------------------------------------------------------*/ if ( $low_action == 'detail') { @@ -148,7 +144,7 @@ if ( $low_action == 'detail') if ( $low_action=="insert" ) { /* security : check if user can add card */ - if ( $User->check_action(FICADD) == 0 ) + if ( $g_user->check_action(FICADD) == 0 ) { alert('Vous ne pouvez pas ajouter de fiche'); return; diff --git a/include/anc_imp.inc.php b/include/anc_imp.inc.php index 8e177de6b..2c2d689d1 100644 --- a/include/anc_imp.inc.php +++ b/include/anc_imp.inc.php @@ -31,15 +31,16 @@ require_once("class_ihidden.php"); require_once('class_anc_operation.php'); require_once('class_anc_plan.php'); require_once('ac_common.php'); +$str_dossier=Dossier::get(); //-- the menu -$menu=array(array("?p_action=ca_imp&sub=listing&$str_dossier",_("Historique"),_("Historique des opérations"),"listing"), - array("?p_action=ca_imp&sub=ancgl&$str_dossier",_("grand livre"),_("Grand livre d' plan analytique"),"ancgl"), - array("?p_action=ca_imp&sub=bs&$str_dossier",_("Balance simple"),_("Balance simple d'un plan analytique"),"bs"), - array("?p_action=ca_imp&sub=bc2&$str_dossier",_("Balance croisée"),_("Balance croisée de 2 plans analytiques"),"bc2"), - array("?p_action=ca_imp&sub=tab&$str_dossier",_("Tableau"),_("Tableau lié à la comptabilité"),'tab'), - array("?p_action=ca_imp&sub=lico&$str_dossier",_("Balance comptabilité"),_("Lien entre comptabilité et Comptabilité analytique"),'lico'), - array("?p_action=ca_imp&sub=group&$str_dossier",_("Groupe"),_("Balance par groupe"),'group'), +$menu=array(array("?ac=".$_REQUEST['ac']."&sub=listing&$str_dossier",_("Historique"),_("Historique des opérations"),"listing"), + array("?ac=".$_REQUEST['ac']."&sub=ancgl&$str_dossier",_("grand livre"),_("Grand livre d' plan analytique"),"ancgl"), + array("?ac=".$_REQUEST['ac']."&sub=bs&$str_dossier",_("Balance simple"),_("Balance simple d'un plan analytique"),"bs"), + array("?ac=".$_REQUEST['ac']."&sub=bc2&$str_dossier",_("Balance croisée"),_("Balance croisée de 2 plans analytiques"),"bc2"), + array("?ac=".$_REQUEST['ac']."&sub=tab&$str_dossier",_("Tableau"),_("Tableau lié à la comptabilité"),'tab'), + array("?ac=".$_REQUEST['ac']."&sub=lico&$str_dossier",_("Balance comptabilité"),_("Lien entre comptabilité et Comptabilité analytique"),'lico'), + array("?ac=".$_REQUEST['ac']."&sub=group&$str_dossier",_("Groupe"),_("Balance par groupe"),'group'), ); $sub=(isset($_GET['sub']))?$_GET['sub']:'no'; @@ -170,7 +171,7 @@ if ( $sub == 'ancgl') //--------------------------------------------------------------------------- // Balance by group //--------------------------------------------------------------------------- -if ( $sub == 'group') +if ( $sub == 'group') { require_once('class_anc_group.php'); $gr=new Anc_Group($cn); @@ -182,7 +183,7 @@ if ( $sub == 'group') if ( isset($_GET['result'])) { echo $gr->show_button($str_hidden); - + echo $gr->display_html(); } } diff --git a/include/anc_od.inc.php b/include/anc_od.inc.php index 694f3f66e..a415367db 100644 --- a/include/anc_od.inc.php +++ b/include/anc_od.inc.php @@ -32,8 +32,9 @@ require_once("class_anc_account.php"); require_once ("class_anc_operation.php"); require_once ("class_anc_plan.php"); require_once ("class_anc_group_operation.php"); +global $g_user; - +$str_dossier=Dossier::get(); $pa=new Anc_Plan($cn); $m=$pa->get_list(); if ( ! $m ) @@ -54,10 +55,10 @@ echo '
- '._('Nouveau').' + '._('Nouveau').' -'._('Liste opérations').' '._('Liste opérations').'
@@ -86,8 +87,8 @@ if ( isset($_GET['see'])) echo dossier::hidden(); $hid=new IHidden(); - $hid->name="p_action"; - $hid->value="ca_od"; + $hid->name="ac"; + $hid->value=$_REQUEST['ac']; echo $hid->input(); $hid->name="see"; @@ -97,11 +98,11 @@ if ( isset($_GET['see'])) $w=new ISelect(); $w->name="p_periode"; // filter on the current year - $filter_year=" where p_exercice='".$User->get_exercice()."'"; + $filter_year=" where p_exercice='".$g_user->get_exercice()."'"; $periode_start=$cn->make_array("select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_start,p_end",1); - $User=new User($cn); - $current=(isset($_GET['p_periode']))?$_GET['p_periode']:$User->get_periode(); + $g_user=new User($cn); + $current=(isset($_GET['p_periode']))?$_GET['p_periode']:$g_user->get_periode(); $w->value=$periode_start; $w->selected=$current; echo $w->input(); diff --git a/include/anc_pa.inc.php b/include/anc_pa.inc.php index bca801aa7..96b180d66 100644 --- a/include/anc_pa.inc.php +++ b/include/anc_pa.inc.php @@ -28,7 +28,7 @@ require_once("class_anc_plan.php"); require_once("class_anc_account.php"); $ret=""; - +$str_dossier=Dossier::get(); //--------------------------------------------------------------------------- // action // Compute the u_redcontent div @@ -49,8 +49,6 @@ if ( isset($_REQUEST['sa'])) $ret.=dossier::hidden(); $ret.= $new->form(); $ret.= HtmlInput::hidden("sa","pa_write"); - $ret.=HtmlInput::hidden("p_action","ca_pa"); - ; $ret.=HtmlInput::submit("submit","Enregistre"); $ret.= ''; $ret.= ''; @@ -87,7 +85,6 @@ if ( isset($_REQUEST['sa'])) if ( $sa == "pa_detail" ) { $new=new Anc_Plan($cn,$_GET['pa_id']); - $wAction=HtmlInput::hidden("p_action","ca_pa"); $wSa=HtmlInput::hidden("sa","pa_update"); $new->get(); @@ -99,13 +96,8 @@ if ( isset($_REQUEST['sa'])) $ret.= $new->form(); $ret.= $wSa; - $ret.= $wAction; $ret.=HtmlInput::submit("submit","Enregistre"); - /* $ret.=sprintf(''. - '', - "?p_action=ca_pa&pa_id=".$_GET['pa_id']."&sa=pa_delete&$str_dossier"); - */ - $ret.=HtmlInput::button_anchor('Efface',"?p_action=ca_pa&pa_id=".$_GET['pa_id']."&sa=pa_delete&$str_dossier",'Efface','onclick="return confirm(\'Effacer ?\')"'); + $ret.=HtmlInput::button_anchor('Efface',"?ac=".$_REQUEST['ac']."&pa_id=".$_GET['pa_id']."&sa=pa_delete&$str_dossier",'Efface','onclick="return confirm(\'Effacer ?\')"'); $ret.= ''; $ret.= ''; @@ -166,7 +158,7 @@ if ( isset($_REQUEST['sa'])) $ret.=$po->form(); $ret.=HtmlInput::hidden('sa','po_update'); $ret.=HtmlInput::submit('Correction','Correction'); - $ret.=sprintf(''. + $ret.=sprintf(''. '', $po->id, $_REQUEST['pa_id'] @@ -216,7 +208,7 @@ if ( isset($_REQUEST['sa'])) $ret.=""; $ret.="". - ''. h($obj->name). ''; @@ -230,7 +222,7 @@ if ( isset($_REQUEST['sa'])) } $ret.=""; - $ret.=HtmlInput::button_anchor('Ajout',"?p_action=ca_pa&sa=po_add&pa_id=".$_GET['pa_id']."&".$str_dossier); + $ret.=HtmlInput::button_anchor('Ajout',"?ac=".$_REQUEST['ac']."&sa=po_add&pa_id=".$_GET['pa_id']."&".$str_dossier); $ret.=''; } @@ -253,7 +245,7 @@ if ( empty($list) ) echo '