Merged revisions 4209,4229-4232,4234,4237-4249 via svnmerge from

svn+ssh://ns352270.ovh.net/svn/phpcompta/branches/rel600-dynamic-menu

........
  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
........
This commit is contained in:
Dany De Bontridder 2011-10-28 20:59:25 +00:00
parent 4c2e3c34b6
commit 5c497d5092
59 changed files with 1834 additions and 1138 deletions

View file

@ -1,108 +0,0 @@
<?php
/*
* This file is part of PhpCompta.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
/* $Revision$ */
/*! \file
* \brief Main page for accountancy
*/
require_once('class_dossier.php');
require_once('user_common.php');
$gDossier=dossier::id();
include_once ("ac_common.php");
$action=(isset($_REQUEST['p_action']))?$_REQUEST['p_action']:'';
$use_html=1;
if ( ! isset ($_SESSION['g_theme']))
{
echo '<h2 class="error">'._(' Vous êtes déconnecté').'</h2>';
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 '<div class="u_tmenu">';
echo ShowMenuCompta("user_advanced.php?".dossier::get());
echo js_include('anc_script.js');
echo '</div>';
// 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();
?>

View file

@ -1,4 +1,5 @@
<?php
/*
* This file is part of PhpCompta.
*
@ -15,42 +16,44 @@
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
*/
/* $Revision$ */
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
/*!\file
* \brief file to include for the "lettrage" (lettering?)
/* !\file
* \brief Main file
*/
$array=array(
array('?'.dossier::get().'&p_action=let&sa=poste',_('Par poste'),
_('Lettrage par poste'), 1),
array('?'.dossier::get().'&p_action=let&sa=qc',_('Par fiche'),
_('Lettrage par fiche'), 2)
);
$sa=(isset($_REQUEST['sa']))?$_REQUEST['sa']:0;
switch($sa)
require_once ('class_dossier.php');
require_once('user_common.php');
require_once('ac_common.php');
require_once 'function_javascript.php';
html_page_start();
global $g_user,$cn;
$cn=new Database(Dossier::id());
$g_user=new User($cn);
// Display available menu in the right order
load_all_script();
$module_selected = -1;
if (isset($_REQUEST['ac']))
{
case 'poste':
$subdef=1;
break;
case 'qc':
$subdef=2;
break;
$all = explode('/', $_REQUEST['ac']);
$module_selected = $all[0];
// Show module and highligt selected one
show_module($module_selected);
for ( $i=0;$i != count($all);$i++)
{ // show the menu
show_menu($all,$i);
}
}
echo '<div class="lmenu">';
echo ShowItem($array,'H','mtitle','mtitle',$subdef);
echo '</div>';
if ($sa == 'poste')
else
{
require_once('lettering.account.inc.php');
exit;
show_module(-1);
}
if ($sa=='qc')
{
require_once('lettering.card.inc.php');
exit;
}

View file

@ -410,7 +410,7 @@ if ( $p_action == 'jrn' )
$sa=(isset($_REQUEST['sa']))?$_REQUEST['sa']:"";
// echo '<div class="content">';
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

View file

@ -1,123 +0,0 @@
<?php
/*
* This file is part of PHPCOMPTA
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PHPCOMPTA; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Auteur Dany De Bontridder ddebontridder@yahoo.fr
include_once ("ac_common.php");
require_once('class_dossier.php');
require_once ('class_pre_operation.php');
/* $Revision$ */
/*! \file
* \brief call the different advanced parameters as report creation, periode,
* ...
*/
$gDossier=dossier::id();
html_page_start($_SESSION['g_theme']);
require_once('class_database.php');
/* Admin. Dossier */
$rep=new Database();
include_once ("class_user.php");
$User=new User($rep);
$User->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 '<div class="u_tmenu">';
echo ShowMenuCompta(7);
echo '</div>';
$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();
?>

View file

@ -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 '<div class="content">';
require_once "$file";
echo '</div>';
}
}
}
?>

View file

@ -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 "</div>";

View file

@ -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;

View file

@ -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();
}
}

View file

@ -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 '
<table>
<tr>
<td class="mtitle" >
<A class="mtitle" HREF="?p_action=ca_od&new&'.$str_dossier.'"> '._('Nouveau').' </A>
<A class="mtitle" HREF="?ac='.$_REQUEST['ac'].'&new&'.$str_dossier.'"> '._('Nouveau').' </A>
</td>
<td class="mtitle" >
<A class="mtitle" HREF="?p_action=ca_od&see&'.$str_dossier.'">'._('Liste opérations').' </A
<A class="mtitle" HREF="?ac='.$_REQUEST['ac'].'&see&'.$str_dossier.'">'._('Liste opérations').' </A
</td>
</tr>
</table>
@ -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();

View file

@ -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.= '</form>';
$ret.= '</div>';
@ -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('<A class="button" HREF="%s" onclick="return confirm(\'Effacer ?\')">'.
'<input type="button" value="Efface"></A>',
"?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.= '</form>';
$ret.= '</div>';
@ -166,7 +158,7 @@ if ( isset($_REQUEST['sa']))
$ret.=$po->form();
$ret.=HtmlInput::hidden('sa','po_update');
$ret.=HtmlInput::submit('Correction','Correction');
$ret.=sprintf('<A class="mtitle" HREF="?p_action=ca_pa&sa=po_delete&po_id=%s&pa_id=%s&'.$str_dossier.'">'.
$ret.=sprintf('<A class="mtitle" HREF="?ac='.$_REQUEST['ac'].'&sa=po_delete&po_id=%s&pa_id=%s&'.$str_dossier.'">'.
'<input type="button" value="Efface" onClick="return confirm(\' Voulez-vous vraiment effacer cette activité\');"></A>',
$po->id,
$_REQUEST['pa_id']
@ -216,7 +208,7 @@ if ( isset($_REQUEST['sa']))
$ret.="<TR class=\"$class\">";
$ret.="<TD >".
'<a style="text-decoration:underline;" href="?p_action=ca_pa&sa=po_detail&po_id='.$obj->id.'&pa_id='.$_REQUEST['pa_id'].'&'.
'<a style="text-decoration:underline;" href="?ac='.$_REQUEST['ac'].'&sa=po_detail&po_id='.$obj->id.'&pa_id='.$_REQUEST['pa_id'].'&'.
$str_dossier.'">'.
h($obj->name).
'</a>';
@ -230,7 +222,7 @@ if ( isset($_REQUEST['sa']))
}
$ret.="</table>";
$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.='</div>';
}
@ -253,7 +245,7 @@ if ( empty($list) )
echo '<div class="lmenu">';
echo '<TABLE>';
echo '<TR><TD class="mtitle">';
echo '<a class="mtitle" href="?p_action=ca_pa&sa=add_pa&'.$str_dossier.'">Ajout d\'un plan comptable</a>';
echo '<a class="mtitle" href="?ac='.$_REQUEST['ac'].'&sa=add_pa&'.$str_dossier.'">Ajout d\'un plan comptable</a>';
echo '</TD></TR>';
echo '</TABLE>';
@ -273,11 +265,11 @@ else
{
echo '<TR>';
echo '<TD >'.
'<a class="mtitle" href="?p_action=ca_pa&sa=pa_detail&pa_id='.$line['id'].'&'.$str_dossier.'">'.
'<a class="mtitle" href="?ac='.$_REQUEST['ac'].'&sa=pa_detail&pa_id='.$line['id'].'&'.$str_dossier.'">'.
h($line['name']).
'</TD>';
echo '<td class="mtitle">'.
'<a class="mtitle" href="?p_action=ca_pa&sa=list&pa_id='.$line['id'].'&'.$str_dossier.'">'.
'<a class="mtitle" href="?ac='.$_REQUEST['ac'].'&sa=list&pa_id='.$line['id'].'&'.$str_dossier.'">'.
"Activités".
"</a>";
@ -288,7 +280,7 @@ else
{
echo '<TABLE>';
echo '<TR><TD class="mtitle">';
echo '<a class="mtitle" href="?p_action=ca_pa&sa=add_pa&'.$str_dossier.'">Ajout d\'un plan comptable</a>';
echo '<a class="mtitle" href="?ac='.$_REQUEST['ac'].'&sa=add_pa&'.$str_dossier.'">Ajout d\'un plan comptable</a>';
echo '</TD></TR>';
echo '</TABLE>';
}

View file

@ -22,7 +22,7 @@
* \brief Show the balance and let you print it or export to PDF
* file included by user_impress
*
* some variable are already defined ($cn, $User ...)
* some variable are already defined ($cn, $g_user ...)
*/
include_once ("ac_common.php");
@ -34,9 +34,10 @@ require_once("class_ihidden.php");
require_once('class_acc_ledger.php');
require_once('class_periode.php');
require_once('class_exercice.php');
$User->can_request(IMPBAL);
$exercice=(isset($_GET['exercice']))?$_GET['exercice']:$User->get_exercice();
global $g_user;
$gDossier=dossier::id();
$g_user->can_request(IMPBAL);
$exercice=(isset($_GET['exercice']))?$_GET['exercice']:$g_user->get_exercice();
echo '<div class="content">';
@ -50,14 +51,14 @@ $ex=new Exercice($cn);
$wex=$ex->select('exercice',$exercice,' onchange="submit(this)"');
echo $wex->input();
echo dossier::hidden();
echo HtmlInput::get_to_hidden(array('p_action','type'));
echo HtmlInput::get_to_hidden(array('ac','type'));
echo '</form>';
echo '</fieldset>';
// Show the form for period
echo '<FORM method="get">';
echo HtmlInput::hidden('p_action','impress');
echo HtmlInput::get_to_hidden(array('ac'));
echo HtmlInput::hidden('type','bal');
echo HtmlInput::get_to_hidden(array('exercice'));
echo dossier::hidden();
@ -71,7 +72,7 @@ $input_from->show_end_date=false;
$input_from->type=ALL;
$input_from->cn=$cn;
$input_from->filter_year=true;
$input_from->user=$User;
$input_from->user=$g_user;
echo 'Depuis :'.$input_from->input();
// filter on the current year
@ -81,7 +82,7 @@ $input_to->show_start_date=false;
$input_to->filter_year=true;
$input_to->type=ALL;
$input_to->cn=$cn;
$input_to->user=$User;
$input_to->user=$g_user;
echo ' jusque :'.$input_to->input();
//-------------------------------------------------
@ -90,7 +91,7 @@ echo ' jusque :'.$input_to->input();
/* add a all ledger choice */
echo 'Filtre ';
$rad=new IRadio();
$array_ledger=$User->get_ledger('ALL',3);
$array_ledger=$g_user->get_ledger('ALL',3);
$selected=(isset($_GET['r_jrn']))?$_GET['r_jrn']:null;
$select_cat=(isset($_GET['r_cat']))?$_GET['r_cat']:null;
$array_cat=Acc_Ledger::array_cat();
@ -177,7 +178,7 @@ if ( isset ($_GET['view'] ) )
echo '<TD><form method="GET" ACTION="export.php">'.
dossier::hidden().
HtmlInput::submit('bt_pdf',"Export PDF").
HtmlInput::hidden("p_action","impress").
HtmlInput::hidden("ac",$_REQUEST['ac']).
HtmlInput::hidden("act","PDF/balance").
HtmlInput::hidden("from_periode",$_GET['from_periode']).
@ -199,10 +200,10 @@ if ( isset ($_GET['view'] ) )
echo '<TD><form method="GET" ACTION="export.php">'.
HtmlInput::submit('bt_csv',"Export CSV").
dossier::hidden().
HtmlInput::hidden("p_action","impress").
HtmlInput::hidden("act","CSV/balance").
HtmlInput::hidden("from_periode",$_GET['from_periode']).
HtmlInput::hidden("to_periode",$_GET['to_periode']);
echo HtmlInput::get_to_hidden(array('ac'));
echo HtmlInput::hidden('p_filter',$_GET['p_filter']);
if (isset($_GET ['r_jrn']))
if (isset($selected[$e]))
@ -288,12 +289,12 @@ if ( isset($_GET['view'] ) )
* level x
*/
foreach (array(3,2,1) as $ind)
{
{
if ( ! isset($_GET['lvl'.$ind]))continue;
if (${'lvl'.$ind.'_old'} == '') ${'lvl'.$ind.'_old'}=substr($r['poste'],0,$ind);
if ( ${'lvl'.$ind.'_old'} != substr($r['poste'],0,$ind))
{
echo '<tr style="font-size:12px;font-height:bold">';
echo td("Total niveau ".$ind);
echo td(${'lvl'.$ind.'_old'});
@ -301,7 +302,7 @@ if ( isset($_GET['view'] ) )
echo td(nbm(${'lvl'.$ind}['sum_cred']),'style="text-align:right"');
echo td(nbm(${'lvl'.$ind}['solde_deb']),'style="text-align:right"');
echo td(nbm(${'lvl'.$ind}['solde_cred']),'style="text-align:right"');
echo '</tr>';
${'lvl'.$ind.'_old'}=substr($r['poste'],0,$ind);
foreach(array('sum_cred','sum_deb','solde_deb','solde_cred') as $a)

View file

@ -24,11 +24,12 @@
* \brief show the status of a card
*/
require_once('class_exercice.php');
global $g_user;
echo '<div class="content" style="width:80%;margin-left:10%">';
$exercice=new Exercice($cn);
$old='';
$fiche=new Fiche($cn,$_GET['f_id']);
$year=$User->get_exercice();
$year=$g_user->get_exercice();
if ( $year == 0 )
{
$html="erreur aucune période par défaut, allez dans préférence pour en choisir une";
@ -53,11 +54,11 @@ else
$default=(isset($_GET['ex']))?$_GET['ex']:$year;
$dossier=dossier::id();
$old='<form method="get" action="commercial.php">';
$old='<form method="get" action="do.php">';
$is=$exercice->select('ex',$default,'onchange = "submit(this)"');
$old.="Autre exercice ".$is->input();
$old.=HtmlInput::hidden('f_id',$_GET['f_id']);
$old.=HtmlInput::hidden('p_action',$_GET['p_action']);
$old.=HtmlInput::hidden('ac',$_GET['ac']);
$old.=HtmlInput::hidden('sb',$_GET['sb']);
$old.=HtmlInput::hidden('sc',$_GET['sc']);
$old.=dossier::hidden();
@ -70,5 +71,5 @@ else
echo $old;
}
echo '</div>';

View file

@ -142,23 +142,23 @@ class Acc_Account_Ledger
if ( $this->db->count() == 0 ) return array();
if ($r[0]['s_deb']==$r[0]['s_cred']) return array();
}
$Res=$this->db->exec_sql("select jr_id,to_char(j_date,'DDMMYYYY') as j_date_fmt,j_date,
case when j_debit='t' then j_montant else 0 end as deb_montant,
case when j_debit='f' then j_montant else 0 end as cred_montant,
jr_comment as description,jrn_def_name as jrn_name,
j_debit, jr_internal,jr_pj_number,
coalesce(get_letter_jnt(j_id),-1) as letter
,pcm_lib
,jr_tech_per,p_exercice
from jrnx left join jrn_def on (jrn_def_id=j_jrn_def )
left join jrn on (jr_grpt_id=j_grpt)
left join tmp_pcmn on (j_poste=pcm_val)
left join parm_periode on (p_id=jr_tech_per)
where j_poste=$1 and
( to_date($2,'DD.MM.YYYY') <= j_date and
to_date($3,'DD.MM.YYYY') >= j_date )
and $filter_sql $sql_let
order by j_date,substring(jr_pj_number,'\\\\d+$') asc",array($this->id,$p_from,$p_to));
$Res=$this->db->exec_sql("select jr_id,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,j_date,".
"case when j_debit='t' then j_montant else 0 end as deb_montant,".
"case when j_debit='f' then j_montant else 0 end as cred_montant,".
" jr_comment as description,jrn_def_name as jrn_name,".
"j_debit, jr_internal,jr_pj_number,
coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter ".
",pcm_lib ".
",jr_tech_per,p_exercice ".
" from jrnx left join jrn_def on (jrn_def_id=j_jrn_def )".
" left join jrn on (jr_grpt_id=j_grpt)".
" left join tmp_pcmn on (j_poste=pcm_val)".
" left join parm_periode on (p_id=jr_tech_per) ".
" where j_poste=$1 and ".
" ( to_date($2,'DD.MM.YYYY') <= j_date and ".
" to_date($3,'DD.MM.YYYY') >= j_date )".
" and $filter_sql $sql_let ".
" order by j_date,substring(jr_pj_number,'\\\\d+$') asc",array($this->id,$p_from,$p_to));
return $this->get_row_sql($Res);
}
@ -240,7 +240,7 @@ class Acc_Account_Ledger
if ($Max==0) return 0;
$r=Database::fetch_array($Res,0);
return abs(bcsub($r['sum_deb'],$r['sum_cred']));
return abs($r['sum_deb']-$r['sum_cred']);
}
/*!
* \brief give the balance of an account
@ -450,7 +450,7 @@ class Acc_Account_Ledger
echo '<TD><form method="GET" ACTION="">'.
dossier::hidden().
HtmlInput::submit('bt_other',"Autre poste").
$hid->input("type","poste").$hid->input('p_action','impress')."</form></TD>";
$hid->input("type","poste").$hid->input('ac',$_REQUEST['ac'])."</form></TD>";
}
@ -464,12 +464,18 @@ class Acc_Account_Ledger
$hid->input("to_periode",$_REQUEST['to_periode'])
;
echo HtmlInput::request_to_hidden(array('from_poste','to_poste',
'poste_id'));
if ( isset($_REQUEST['letter'] )) echo HtmlInput::hidden('letter','2');
if ( isset($_REQUEST['solded'] )) echo HtmlInput::hidden('solded','1');
if (isset($_REQUEST['from_poste']))
echo HtmlInput::hidden('from_poste',$_REQUEST['from_poste']);
if (isset($_REQUEST['to_poste']))
echo HtmlInput::hidden('to_poste',$_REQUEST['to_poste']);
if (isset($_REQUEST['poste_id']))
echo HtmlInput::hidden("poste_id",$_REQUEST['poste_id']);
if (isset($_REQUEST['poste_fille']))
echo $hid->input('poste_fille','on');
if (isset($_REQUEST['oper_detail']))
@ -486,8 +492,14 @@ class Acc_Account_Ledger
$hid->input("from_periode",$_REQUEST['from_periode']).
$hid->input("to_periode",$_REQUEST['to_periode']);
echo HtmlInput::request_to_hidden(array('from_poste','to_poste',
'poste_id'));
if (isset($_REQUEST['from_poste']))
echo HtmlInput::hidden('from_poste',$_REQUEST['from_poste']);
if (isset($_REQUEST['to_poste']))
echo HtmlInput::hidden('to_poste',$_REQUEST['to_poste']);
if (isset($_REQUEST['poste_id']))
echo HtmlInput::hidden("poste_id",$_REQUEST['poste_id']);
if ( isset($_REQUEST['letter'] )) echo HtmlInput::hidden('letter','2');
if ( isset($_REQUEST['solded'] )) echo HtmlInput::hidden('solded','1');
@ -511,9 +523,7 @@ class Acc_Account_Ledger
*/
function belong_ledger($p_jrn)
{
$filter=$this->db->get_value("select jrn_def_class_cred from jrn_def where jrn_def_id=$1",
array($p_jrn));
$filter=$this->db->get_value("select jrn_def_class_cred from jrn_def where jrn_def_id=$p_jrn");
if ( trim ($filter) == '')
return 0;

View file

@ -41,7 +41,7 @@ require_once ('class_acc_account.php');
require_once('ac_common.php');
require_once('class_inum.php');
require_once('class_lettering.php');
require_once 'class_sort_table.php';
/*!\file
* \brief Class for jrn, class acc_ledger for manipulating the ledger
*/
@ -594,40 +594,87 @@ class Acc_Ledger
$amount_unpaid=0.0;
$limit=($_SESSION['g_pagesize']!=-1)?" LIMIT ".$_SESSION['g_pagesize']:"";
$offset=($_SESSION['g_pagesize']!=-1)?" OFFSET ".Database::escape_string($offset):"";
$order=" order by jr_date_order asc,jr_internal asc";
// Sort
$url=basename($_SERVER['SCRIPT_NAME']).'?'.CleanUrl();
$url=CleanUrl();
$str_dossier=dossier::get();
$image_asc='<IMAGE SRC="image/down.gif" border="0" >';
$image_desc='<IMAGE SRC="image/up.gif" border="0">';
$image_sel_desc='<IMAGE SRC="image/select1.gif">';
$image_sel_asc='<IMAGE SRC="image/select2.gif">';
$sort=new Sort_Table();
$sort->add(_('Date'),
$url,
' order by jr_date_order asc,substring(jr_pj_number,\'\\\d+$\')::numeric asc ',
' order by jr_date_order desc,substring(jr_pj_number,\'\\\d+$\')::numeric desc ','da','dd');
$sort->add(_('Echéance'),
$url,
' order by jr_ech asc,substring(jr_pj_number,\'\\\d+$\')::numeric asc ',
' order by jr_ech desc,substring(jr_pj_number,\'\\\d+$\')::numeric desc ','ea','ed');
$sort->add(_('Pièce'),
$url,
' order by substring(jr_pj_number,\'\\\d+$\')::numeric asc ',
' order by substring(jr_pj_number,\'\\\d+$\')::numeric desc ','pa','pd');
$sort->add(_('Description'),
$url,
' order by jr_comment asc ',
' order by jr_comment desc ','dsa','dsd');
$sort->add(_('Montant'),
$url,
' order by jr_montant asc ',
' order by jr_montant desc ','ma','md');
$sort_date="<th> <A class=\"mtitle\" HREF=\"?$url&o=da\">$image_asc</A>"._('Date')."<A class=\"mtitle\" HREF=\"?$url&o=dd\">$image_desc</A></th>";
$sort_description="<th> <A class=\"mtitle\" HREF=\"?$url&o=ca\">$image_asc</A>"._('Description')."<A class=\"mtitle\" HREF=\"?$url&o=cd\">$image_desc</A></th>";
$sort_amount="<th style=\"text-align:right\"> <A class=\"mtitle\" HREF=\"?$url&o=ma\">$image_asc</A>"._('Montant')." <A class=\"mtitle\" HREF=\"?$url&o=md\">$image_desc</A></th>";
$sort_pj="<th> <A class=\"mtitle\" HREF=\"?$url&o=pja\">$image_asc</A>"._('PJ')."<A class=\"mtitle\" HREF=\"?$url&o=pjd\">$image_desc</A></th>";
$sort_echeance="<th> <A class=\"mtitle\" HREF=\"?$url&o=ea\">$image_asc</A>"._('Ech')." <A class=\"mtitle\" HREF=\"?$url&o=ed\">$image_desc</A> </th>";
$sort->add(_('Journal'),
$url,
' order by jrn_def_name asc ',
' order by jrn_def_name desc ','la','ld');
$own=new Own($this->db);
// if an order is asked
if ( isset ($_GET['o']) )
{
switch ($_GET['o'])
{
case 'pja':
// pj asc
$sort_pj="<th>$image_sel_asc PJ <A class=\"mtitle\" HREF=\"?$url&o=pjd\">$image_desc</A></th>";
$order=' order by substring(jr_pj_number,\'\\\d+$\')::numeric asc ';
break;
case 'pjd':
$sort_pj="<th> <A class=\"mtitle\" HREF=\"?$url&o=pja\">$image_asc</A> PJ $image_sel_desc</th>";
// pj desc
$order=' order by substring(jr_pj_number,\'\\\d+$\')::numeric desc ';
break;
$ord=(isset($_GET['ord']))?$_GET['ord']:'da';
case 'da':
// date asc
$sort_date="<th>$image_sel_asc Date <A class=\"mtitle\" HREF=\"?$url&o=dd\">$image_desc</A></th>";
$order=' order by jr_date_order asc,substring(jr_pj_number,\'\\\d+$\')::numeric asc ';
break;
case 'dd':
$sort_date="<th> <A class=\"mtitle\" HREF=\"?$url&o=da\">$image_asc</A> Date $image_sel_desc</th>";
// date desc
$order=' order by jr_date_order desc,substring(jr_pj_number,\'\\\d+$\')::numeric desc ';
break;
case 'ma':
// montant asc
$sort_amount="<th style=\"text-align:right\"> $image_sel_asc Montant <A class=\"mtitle\" HREF=\"?$url&o=md\">$image_desc</A></th>";
$order=" order by jr_montant asc ";
break;
case 'md':
// montant desc
$sort_amount="<th style=\"text-align:right\"> <A class=\"mtitle\" HREF=\"?$url&o=ma\">$image_asc</A>Montant $image_sel_desc</th>";
$order=" order by jr_montant desc ";
break;
case 'ca':
// jr_comment asc
$sort_description="<th> $image_sel_asc Description <A class=\"mtitle\" HREF=\"?$url&o=cd\">$image_desc</A></th>";
$order=" order by jr_comment asc ";
break;
case 'cd':
// jr_comment desc
$sort_description="<th> <A class=\"mtitle\" HREF=\"?$url&o=ca\">$image_asc</A>Description $image_sel_desc</th>";
$order=" order by jr_comment desc ";
break;
case 'ea':
// jr_comment asc
$sort_echeance="<th> $image_sel_asc Ech. <A class=\"mtitle\" HREF=\"?$url&o=ed\">$image_desc</A></th>";
$order=" order by jr_ech asc ";
break;
case 'ed':
// jr_comment desc
$sort_echeance="<th> <A class=\"mtitle\" HREF=\"?$url&o=ea\">$image_asc</A> Ech. $image_sel_desc</th>";
$order=" order by jr_ech desc ";
break;
$order=$sort->get_sql_order($ord);
}
}
else
{
// date asc
$sort_date="<th>$image_sel_asc Date <A class=\"mtitle\" HREF=\"?$url&o=dd\">$image_desc</A></th>";
$order=" order by jr_date_order asc,substring(jr_pj_number,'\\d+$')::numeric asc ";
}
// Count
$count=$this->db->count_sql($sql);
@ -654,16 +701,15 @@ class Acc_Ledger
$r.="<th>Internal</th>";
if ( $this->type=='')
{
$r.='<th>'.$sort->get_header(5).'</td>';
$r.=th('Journal');
}
$r.='<th>'.$sort->get_header(0).'</th>';
$r.='<th>'.$sort->get_header(1).'</th>';
$r.='<th>'.$sort->get_header(2).'</th>';
$r.=$sort_date;
$r.=$sort_echeance;
$r.=$sort_pj;
$r.=th('tiers');
$r.='<th>'.$sort->get_header(3).'</th>';
$r.=$sort_description;
$r.=th('Notes',' style="width:15%"');
$r.='<th>'.$sort->get_header(4).'</th>';
$r.=$sort_amount;
// if $p_paid is not equal to 0 then we have a paid column
if ( $p_paid != 0 )
{
@ -687,6 +733,27 @@ class Acc_Ledger
//internal code
// button modify
$r.="<TD>";
// If url contains
//
$href=basename($_SERVER['PHP_SELF']);
/* switch ($href)
{
// user_jrn.php
case 'compta.php':
$vue="S"; //Expert View
break;
case 'commercial.php':
$vue="S"; //Simple View
break;
case 'recherche.php':
$vue=(isset($_GET['expert']))?'E':'S';
break;
default:
echo_error('user_form_ach.php',__LINE__,'Erreur invalid request uri');
exit (-1);
}*/
//DEBUG
$r.=sprintf('<A class="detail" style="text-decoration:underline" HREF="javascript:modifyOperation(\'%s\',\'%s\')" >%s </A>',
$row['jr_id'], $gDossier, $row['jr_internal']);
@ -2156,6 +2223,7 @@ class Acc_Ledger
$r.=dossier::hidden();
$r.=HtmlInput::hidden('ledger_type',$this->type);
$r.=HtmlInput::hidden('ac',$_REQUEST['ac']);
ob_start();
require_once('template/ledger_search.php');
$r.=ob_get_contents();
@ -2254,11 +2322,12 @@ class Acc_Ledger
$and='';
$user=new User($this->db);
$p_action=$ledger_type;
if ( $r_jrn == -1 )
{
/* Specific action allow to see all the ledgers in once */
if ( $p_action == 'gl') $p_action='ALL';
if ( $ledger_type== 'gl') $p_action='ALL';
/* actions from commercial.php */
if ( $p_action == 'client') $p_action='ALL';
if ( $p_action == 'supplier') $p_action='ALL';
@ -2399,7 +2468,7 @@ class Acc_Ledger
$r.='<FORM METHOD="GET">';
$r.=$this->search_form($type);
$r.=HtmlInput::submit('search',_('Rechercher'));
$r.=HtmlInput::hidden('p_action',$_REQUEST['p_action']);
$r.=HtmlInput::hidden('ac',$_REQUEST['ac']);
/* when called from commercial.php some hidden values are needed */
if (isset($_REQUEST['sa'])) $r.= HtmlInput::hidden("sa",$_REQUEST['sa']);

View file

@ -118,6 +118,7 @@ class Anc_Print
$r.= '<span class="notice">'._('Les dates sont en format DD.MM.YYYY').'</span>';
$r.=$p_hidden;
$r.=HtmlInput::hidden('ac',$_REQUEST['ac']);
$r.='<span style="padding:5px;margin:5px;display:block;">';
$plan=new Anc_Plan($this->db);
$plan_id=new ISelect("pa_id");
@ -166,17 +167,17 @@ class Anc_Print
}
function check()
{
/*
* check date
*/
if (($this->from != '' && isDate ($this->from) == 0)
||
||
($this->to != '' && isDate ($this->to) == 0))
return -1;
return 0;
}
}
}

View file

@ -19,10 +19,10 @@
/* $Revision$ */
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
/*! \file
* \brief Class for the document template
* \brief Class for the document template
*/
/*!
* \brief Class for the document template
* \brief Class for the document template
*/
require_once('class_icheckbox.php');
require_once('class_ihidden.php');
@ -59,7 +59,7 @@ class Document_modele
$all=Database::fetch_all($Res);
$r='';
if ( Database::num_row($Res) != 0 ) {
$r.='<p><form method="post">';
$r.=dossier::hidden();
$r.="<table>";
@ -109,13 +109,13 @@ class Document_modele
return $r;
}
/*!
* \brief : Save a document_modele in the database,
* \brief : Save a document_modele in the database,
* if the document_modele doesn't exist yet it will be
* first created (-> insert into document_modele)
* in that case the name and the type must be set
* set before calling Save, the name will be modified
* with FormatString
*
*
*/
function Save()
{
@ -194,7 +194,7 @@ class Document_modele
}
}
/*!
* \brief Remove a template
* \brief Remove a template
* \return nothing
*/
function Delete()
@ -219,17 +219,17 @@ class Document_modele
/*!
* \brief show the form for loading a template
* \param p_action for the field action = destination url
*
* \param p_action for the field action = destination url
*
*
* \return string containing the forms
*/
function form($p_action)
function form()
{
$r='<p class="notice">';
$r.='Veuillez introduire les mod&egrave;les servant à g&eacute;n&eacute;rer vos documents';
$r.='</p>';
$r.='<form enctype="multipart/form-data" action="'.$p_action.'" method="post">';
$r.='<form enctype="multipart/form-data" method="post">';
$r.=dossier::hidden();
// we need to add the sub action as hidden
$h=new IHidden();
@ -294,7 +294,7 @@ class Document_modele
}
}
/*!
* \brief : update a document_modele in the database,
* \brief : update a document_modele in the database,
*/
function update($p_array)
{
@ -315,7 +315,7 @@ class Document_modele
));
if ( $p_array['seq'] != 0 )
$this->cn->alter_seq('seq_doc_type_'.$p_array['md_type'],$p_array['seq']);
// Save the file
$new_name=tempnam($_ENV['TMP'],'document_');
if ( strlen ($_FILES['doc']['tmp_name']) != 0 )

View file

@ -764,7 +764,7 @@ class Fiche
{
$parameter=array($this->id,null);
}
$this->cn->exec_sql("select account_insert($1,$2)",$parameter);
$v=$this->cn->get_value("select account_insert($1,$2)",$parameter);
}
catch (Exception $e)
{

View file

@ -66,7 +66,7 @@ class Fiche_Def
/*!
* \brief Get attribut of a fiche_def
*
*
* \return string value of the attribute
*/
function getAttribut()
@ -95,7 +95,7 @@ class Fiche_Def
/*!
* \brief Get attribut of the fiche_def
*
*
*/
function Get()
{
@ -118,8 +118,8 @@ class Fiche_Def
/*!
**************************************************
* \brief Get all the fiche_def
*
* \return an array of fiche_def object
*
* \return an array of fiche_def object
*/
function GetAll()
{
@ -141,10 +141,10 @@ class Fiche_Def
}
/*!
**************************************************
* \brief Check in vw_fiche_def if a fiche has
* \brief Check in vw_fiche_def if a fiche has
* a attribut X
*
*
*
*
* \param $p_attr attribut to check
* \return true or false
*/
@ -156,8 +156,8 @@ class Fiche_Def
/*!
**************************************************
* \brief Display a fiche_def object into a table
*
* \return HTML row
*
* \return HTML row
*/
function Display()
{
@ -173,7 +173,7 @@ class Fiche_Def
* table : insert into fiche_def
* insert into attr_def
*
* \param $array array
* \param $array array
* index FICHE_REF
* nom_mod
* class_base
@ -384,6 +384,7 @@ class Fiche_Def
echo '<FORM METHOD="POST" action="?p_action=fiche&action=vue'.$str.'">';
echo HtmlInput::hidden('ac',$_REQUEST['ac']);
echo dossier::hidden();
echo HtmlInput::hidden("fiche",$this->id);
echo HtmlInput::submit('add','Ajout fiche');
@ -398,13 +399,17 @@ class Fiche_Def
else
echo '<TR class="even">';
$span_mod='<TD><A href="?p_action=fiche&'.$str_dossier.'&action=detail&fiche_id='.$l_line['f_id'].$str.'&fiche='.$_GET['fiche'].'">'.$l_line['quick_code'].'</A></TD>';
$span_mod='<TD><A href="?p_action=fiche&'.$str_dossier.
'&action=detail&fiche_id='.$l_line['f_id'].$str.'&fiche='.
$_GET['fiche'].'&ac='.$_REQUEST['ac'].'">'.$l_line['quick_code']
.'</A></TD>';
echo $span_mod.'<TD>'.h($l_line['vw_name'])."</TD>";
echo '</tr>';
}
echo '</table>';
echo '<FORM METHOD="POST" action="?p_action=fiche&action=vue'.$str.'">';
echo HtmlInput::hidden('ac',$_REQUEST['ac']);
echo dossier::hidden();
echo HtmlInput::hidden("fiche",$this->id);
echo HtmlInput::submit('add','Ajout fiche');
@ -414,7 +419,7 @@ class Fiche_Def
}
/*!\brief show input for the basic attribute : label, class_base, create_account
* use only when we want to update
*
*
*\return HTML string with the form
*/
function input_base()
@ -440,7 +445,7 @@ class Fiche_Def
return $r;
}
/*!\brief Display all the attribut of the fiche_def
*\param $str give the action possible values are remove, empty
*\param $str give the action possible values are remove, empty
*/
function DisplayAttribut($str="")
{
@ -674,8 +679,8 @@ class Fiche_Def
}
/*!
* \brief retrieve the mandatory field of the card model
*
* \param $p_fiche_def_ref
*
* \param $p_fiche_def_ref
* \return array of ad_id (attr_min.ad_id) and labels (attr_def.ad_text)
*/
function get_attr_min($p_fiche_def_ref)

View file

@ -229,13 +229,13 @@ class Periode
$change='<TD></TD>';
$remove=sprintf(_('Nombre opérations %d'),$l_line['count_op']);
$remove=td($remove,' class="mtitle" ');
$change=td ('<A class="mtitle" HREF="?p_action=periode&action=reopen&p_per='.$l_line['p_id'].'&'.$str_dossier.'" onclick="return confirm(\''._('Confirmez Réouverture').' ?\')"> Réouverture</A>',' class="mtitle"');
$change=td ('<A class="mtitle" HREF="?ac='.$_REQUEST['ac'].'&action=reopen&p_per='.$l_line['p_id'].'&'.$str_dossier.'" onclick="return confirm(\''._('Confirmez Réouverture').' ?\')"> Réouverture</A>',' class="mtitle"');
}
else
{
$closed='<TD class="mtitle">';
$closed.='<A class="mtitle" HREF="?p_action=periode&action=closed&p_per='.$l_line['p_id'].'&'.$str_dossier.'" onclick="return confirm(\''._('Confirmez cloture').' ?\')"> Cloturer</A></td>';
$closed.='<A class="mtitle" HREF="?ac='.$_REQUEST['ac'].'&action=closed&p_per='.$l_line['p_id'].'&'.$str_dossier.'" onclick="return confirm(\''._('Confirmez cloture').' ?\')"> Cloturer</A></td>';
if ($l_line['count_op'] == 0 )
{
@ -260,7 +260,7 @@ class Periode
if ($l_line['count_op'] == 0 )
{
$remove.='<A class="mtitle" HREF="?p_action=periode&action=delete_per&p_per='.
$remove.='<A class="mtitle" HREF="?ac='.$_REQUEST['ac'].'&action=delete_per&p_per='.
$l_line['p_id']."&$str_dossier\" onclick=\"return confirm('"._('Confirmez effacement ?')."')\" > Efface</A>";
}
else
@ -277,7 +277,7 @@ class Periode
echo '</TR>';
}
echo '<TR> <FORM ACTION="?p_action=periode" METHOD="POST">';
echo '<TR> <FORM METHOD="POST">';
echo dossier::hidden();
$istart=new IDate('p_date_start');
$iend=new IDate('p_date_end');
@ -325,13 +325,13 @@ class Periode
if ( $l_line['status'] != 'OP' )
{
$closed=td ('<A class="mtitle" HREF="?p_action=periode&action=reopen&p_per='.$l_line['p_id'].'&'.$str_dossier.'&jrn_def_id='.$this->jrn_def_id.'" onclick="return confirm(\''._('Confirmez Réouverture').' ?\')"> Réouverture</A>',' class="mtitle"');
$closed=td ('<A class="mtitle" HREF="?ac='.$_REQUEST['ac'].'&action=reopen&p_per='.$l_line['p_id'].'&'.$str_dossier.'&jrn_def_id='.$this->jrn_def_id.'" onclick="return confirm(\''._('Confirmez Réouverture').' ?\')"> Réouverture</A>',' class="mtitle"');
// $closed=($l_line['status']=='CE')?'<TD>Centralisee</TD>':'<TD>Ferm&eacute;e</TD>';
}
else
{
$closed='<TD class="mtitle">';
$closed.='<A class="mtitle" HREF="?p_action=periode&action=closed&p_per='.$l_line['p_id'].'&'.$str_dossier.'&jrn_def_id='.$this->jrn_def_id.'" onclick="return confirm(\''._('Confirmez Cloture').' ?\')"> Cloturer</A>';
$closed.='<A class="mtitle" HREF="?ac='.$_REQUEST['ac'].'&action=closed&p_per='.$l_line['p_id'].'&'.$str_dossier.'&jrn_def_id='.$this->jrn_def_id.'" onclick="return confirm(\''._('Confirmez Cloture').' ?\')"> Cloturer</A>';
$closed.='</td>';
}
echo "$closed";
@ -486,7 +486,7 @@ class Periode
*/
function insert_exercice($p_exercice)
{
try
try
{
$this->cn->start();
for ($i=1;$i < 12;$i++)

View file

@ -99,7 +99,7 @@ class Pre_operation
return true;
}
/*!\brief load the data from the database and return an array
* \return an array
* \return an array
*/
function load()
{
@ -195,6 +195,7 @@ class Pre_operation_detail
$hid=new IHidden();
$r=$hid->input("action","use_opd");
echo HtmlInput::hidden('ac',$_REQUEST['ac']);
$r.=dossier::hidden();
$r.=$hid->input("p_jrn",$this->get("ledger"));
$r.=$hid->input("jrn_type",$this->get("ledger_type"));

View file

@ -15,10 +15,10 @@
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
*/
/* $Revision$ */
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
/*!\brief include from client.inc.php and concerned only the customer card and
/* !\brief include from client.inc.php and concerned only the customer card and
* the customer category
*/
require_once("class_iselect.php");
@ -32,105 +32,101 @@ require_once('class_fiche_def.php');
require_once('class_ipopup.php');
echo ICard::ipopup('ipop_newcard');
$ip_cat=new IPopup('ipop_cat');
$ip_cat->title=_('Ajout d\'une catégorie');
$ip_cat->value='';
$ip_cat = new IPopup('ipop_cat');
$ip_cat->title = _('Ajout d\'une catégorie');
$ip_cat->value = '';
echo $ip_cat->input();
echo IPoste::ipopup('ipop_account');
$search_card=new IPopup('ipop_card');
$search_card->title=_('Recherche de fiche');
$search_card->value='';
$search_card = new IPopup('ipop_card');
$search_card->title = _('Recherche de fiche');
$search_card->value = '';
echo $search_card->input();
echo ICard::ipopup('ipopcard');
$low_action=(isset($_REQUEST['sb']))?$_REQUEST['sb']:"list";
/*! \file
$low_action = (isset($_REQUEST['sb'])) ? $_REQUEST['sb'] : "list";
/* ! \file
* \brief Called from the module "Gestion" to manage the customer
*/
$User->can_request(GECUST);
$href=basename($_SERVER['PHP_SELF']);
// by default open liste
if ( $low_action == "" )
$low_action="list";
if ($low_action == "")
$low_action = "list";
//-----------------------------------------------------
// Remove a card
//-----------------------------------------------------
if ( isset($_POST['delete_card'] ) )
if (isset($_POST['delete_card']))
{
if ( $User->check_action(FICADD) == 0 )
if ($g_user->check_action(FICADD) == 0)
{
alert(j(_('Vous ne pouvez pas enlever de fiche')));
return;
alert(j(_('Vous ne pouvez pas enlever de fiche')));
return;
}
$f_id=$_REQUEST['f_id'];
$f_id = $_REQUEST['f_id'];
$fiche=new Customer($cn,$f_id);
$fiche = new Customer($cn, $f_id);
$fiche->remove();
$low_action="list";
$low_action = "list";
}
//-----------------------------------------------------
// list of customer
//-----------------------------------------------------
if ( $low_action == "list" )
if ($low_action == "list")
{
?>
<div class="content">
<span style="position:float;float:left">
<form method="get" action="<?php echo $href; ?>">
<?php
echo dossier::hidden();
$a=(isset($_GET['query']))?$_GET['query']:"";
printf (_('Recherche').' <input class="input_text" type="text" name="query" value="%s">',
$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_CLIENT.
' order by fd_label ',1);
$sel_card->selected=(isset($_GET['cat']))?$_GET['cat']:-1;
$sel_card->javascript=' onchange="submit(this);"';
echo _('Catégorie :').$sel_card->input();
$nooperation=new ICheckBox('noop');
$nooperation->selected=(isset($_GET['noop']))?true:false;
<div class="content">
<span style="position:float;float:left">
<form method="get" action="<?php echo $href;?>">
<?php
echo dossier::hidden();
$a = (isset($_GET['query'])) ? $_GET['query'] : "";
printf(_('Recherche') . ' <input class="input_text" type="text" name="query" value="%s">', $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_CLIENT .
' order by fd_label ', 1);
$sel_card->selected = (isset($_GET['cat'])) ? $_GET['cat'] : -1;
$sel_card->javascript = ' onchange="submit(this);"';
echo _('Catégorie :') . $sel_card->input();
$nooperation = new ICheckBox('noop');
$nooperation->selected = (isset($_GET['noop'])) ? true : false;
echo _('Inclure les clients sans opération :').$nooperation->input();
?>
<input type="submit" class="button" name="submit_query" value="<?=_('recherche')?>">
<input type="hidden" name="p_action" value="client">
</form>
</span>
<?php
$client=new Customer($cn);
$search=(isset($_GET['query']))?$_GET['query']:"";
$sql="";
if ( isset($_GET['cat']))
{
if ( $_GET['cat'] != -1) $sql=sprintf(" and fd_id = %d",$_GET['cat']);
}
$noop=(isset($_GET['noop']))?false:true;
echo '<div class="content">';
echo $client->Summary($search,'client',$sql,$noop);
echo _('Inclure les clients sans opération :') . $nooperation->input();
?>
<input type="submit" class="button" name="submit_query" value="<?= _('recherche')?>">
<input type="hidden" name="ac" value="<?= $_REQUEST['ac']?>">
</form>
</span>
<?php
$client = new Customer($cn);
$search = (isset($_GET['query'])) ? $_GET['query'] : "";
$sql = "";
if (isset($_GET['cat']))
{
if ($_GET['cat'] != -1)
$sql = sprintf(" and fd_id = %d", $_GET['cat']);
}
$noop = (isset($_GET['noop'])) ? false : true;
echo '<div class="content">';
echo $client->Summary($search, 'client', $sql, $noop);
echo '<br>';
echo '<br>';
echo '<br>';
/* Add button */
$f_add_button=new IButton('add_card');
$f_add_button->label=_('Créer une nouvelle fiche');
$f_add_button->set_attribute('ipopup','ipop_newcard');
$f_add_button->set_attribute('win_refresh','yes');
echo '<br>';
echo '<br>';
echo '<br>';
/* Add button */
$f_add_button = new IButton('add_card');
$f_add_button->label = _('Créer une nouvelle fiche');
$f_add_button->set_attribute('ipopup', 'ipop_newcard');
$f_add_button->set_attribute('win_refresh', 'yes');
// $list=$cn->make_list("select fd_id from fiche_def where frd_id=$1",array(FICHE_TYPE_CLIENT));
$f_add_button->set_attribute('type_cat',FICHE_TYPE_CLIENT);
$f_add_button->javascript=" select_card_type(this);";
echo $f_add_button->input();
$f_add_button->set_attribute('type_cat', FICHE_TYPE_CLIENT);
$f_add_button->javascript = " select_card_type(this);";
echo $f_add_button->input();
$f_cat_button=new IButton('add_cat');
$f_cat_button->set_attribute('ipopup','ipop_cat');
@ -153,29 +149,27 @@ if ( $low_action == 'detail')
require_once('client_card.inc.php');
exit();
}
if ( $low_action=="insert" )
{
/* security : check if user can add card */
if ( $User->check_action(FICADD) == 0 )
if ($low_action == "insert")
{
alert('Vous ne pouvez pas ajouter de fiche');
return;
/* security : check if user can add card */
if ($g_user->check_action(FICADD) == 0)
{
alert('Vous ne pouvez pas ajouter de fiche');
return;
}
$customer = new Customer($cn);
$customer->Save($_REQUEST['fd_id']);
echo '<div class="content">';
echo "<table>";
echo $customer->Display(true);
echo "</table>";
$retour = new IAction();
$retour->label = "Retour";
$retour->value = "?ac=" . $_REQUEST["ac"] . "&" . dossier::get();
echo $retour->input();
echo '</div>';
}
$customer=new Customer($cn);
$customer->Save($_REQUEST['fd_id']);
echo '<div class="content">';
echo "<table>";
echo $customer->Display(true);
echo "</table>";
$retour=new IAction();
$retour->label="Retour";
$retour->value="?p_action=client&".dossier::get();
echo $retour->input();
echo '</div>';
}
html_page_stop();
html_page_stop();
?>

102
include/company.inc.php Normal file
View file

@ -0,0 +1,102 @@
<?php
global $g_user;
$g_user->can_request(PARCOORD,1);
echo '<div class="content">';
require_once("class_own.php");
if ( isset ($_POST['record_company'] ))
{
$m=new Own($cn);
extract($_POST);
$m->MY_NAME=$p_name;
$m->MY_TVA=$p_tva;
$m->MY_STREET=$p_street;
$m->MY_NUMBER=$p_no;
$m->MY_CP=$p_cp;
$m->MY_COMMUNE=$p_Commune;
$m->MY_TEL=$p_tel;
$m->MY_FAX=$p_fax;
$m->MY_PAYS=$p_pays;
$m->MY_CHECK_PERIODE=$p_check_periode;
$m->MY_DATE_SUGGEST=$p_date_suggest;
if ( $g_user->check_action(PARCA)!=0)$m->MY_ANALYTIC=$p_compta;
if ( $g_user->check_action(PARSTR)!=0) $m->MY_STRICT=$p_strict;
if ( $g_user->check_action(PARTVA)!=0)$m->MY_TVA_USE=$p_tva_use;
$m->MY_PJ_SUGGEST=$p_pj;
$m->Update();
}
$my=new Own($cn);
///// Compta analytic
$array=array (
array("value"=>"ob",'label'=>_("obligatoire")),
array("value"=>"op",'label'=>_("optionnel")),
array("value"=>"nu",'label'=>_("non utilisé"))
);
$strict_array=array(
array('value'=>'N','label'=>_('Non')),
array('value'=>'Y','label'=>_('Oui'))
);
$compta=new ISelect();
$compta->table=1;
$compta->selected=$my->MY_ANALYTIC;
$strict=new ISelect();
$strict->table=1;
$strict->selected=$my->MY_STRICT;
$tva_use=new ISelect();
$tva_use->table=1;
$tva_use->selected=$my->MY_TVA_USE;
$pj_suggest=new ISelect();
$pj_suggest->table=1;
$pj_suggest->selected=$my->MY_PJ_SUGGEST;
$date_suggest=new ISelect();
$date_suggest->table=1;
$date_suggest->selected=$my->MY_DATE_SUGGEST;
$check_periode=new ISelect();
$check_periode->table=1;
$check_periode->selected=$my->MY_CHECK_PERIODE;
// other parameters
$all=new IText();
$all->table=1;
echo '<form method="post" >';
echo dossier::hidden();
echo "<table class=\"result\" style=\"width:auto\">";
echo "<tr>".td(_('Nom société'),'style="text-align:right"').$all->input("p_name",$my->MY_NAME)."</tr>";
$all->value='';
echo "<tr>".td(_("Téléphone"),'style="text-align:right"').$all->input("p_tel",$my->MY_TEL)."</tr>";
$all->value='';
echo "<tr>".td(_("Fax"),'style="text-align:right"').$all->input("p_fax",$my->MY_FAX)."</tr>";
$all->value='';
echo "<tr>".td(_("Rue "),'style="text-align:right"').$all->input("p_street",$my->MY_STREET)."</tr>";
$all->value='';
echo "<tr>".td(_("Numéro"),'style="text-align:right"').$all->input("p_no",$my->MY_NUMBER)."</tr>";
$all->value='';
echo "<tr>".td(_("Code Postal"),'style="text-align:right"').$all->input("p_cp",$my->MY_CP)."</tr>";
$all->value='';
echo "<tr>".td(_("Commune"),'style="text-align:right"').$all->input("p_Commune",$my->MY_COMMUNE)."</tr>";
$all->value='';
echo "<tr>".td(_("Pays"),'style="text-align:right"').$all->input("p_pays",$my->MY_PAYS)."</tr>";
$all->value='';
echo "<tr>".td(_("Numéro de Tva"),'style="text-align:right"').$all->input("p_tva",$my->MY_TVA)."</tr>";
if ( $g_user->check_action(PARCA)==0) $compta->setReadonly(true);
echo "<tr>".td(_("Utilisation de la compta. analytique"),'style="text-align:right"').$compta->input("p_compta",$array)."</tr>";
if ( $g_user->check_action(PARSTR)==0) $strict->setReadonly(true);
echo "<tr>".td(_("Utilisation du mode strict "),'style="text-align:right"').$strict->input("p_strict",$strict_array)."</tr>";
if ( $g_user->check_action(PARTVA)==0) $tva_use->setReadonly(true);
echo "<tr>".td(_("Assujetti à la tva"),'style="text-align:right"').$tva_use->input("p_tva_use",$strict_array)."</tr>";
echo "<tr>".td(_("Suggérer le numéro de pièce justificative"),'style="text-align:right"').$pj_suggest->input("p_pj",$strict_array)."</tr>";
echo "<tr>".td(_("Suggérer la date"),'style="text-align:right"').$date_suggest->input("p_date_suggest",$strict_array)."</tr>";
echo '<tr>'.td(_('Afficher la période comptable pour éviter les erreurs de date'),'style="text-align:right"').$check_periode->input('p_check_periode',$strict_array).'</tr>';
echo "</table>";
echo HtmlInput::submit("record_company",_("Sauve"));
echo "</form>";
echo '</div>';
exit();
?>

View file

@ -34,13 +34,11 @@ $p_action=(isset($_REQUEST['p_action']))?$_REQUEST['p_action']:'';
$cn=new Database(dossier::id());
//menu = show a list of ledger
$str_dossier=dossier::get();
$ac="ac=".$_REQUEST['ac'];
$array=array(
array('?p_action=ach&sa=n&'.$str_dossier,_('Nouvelle dépense'),_('Nouvel achat ou dépense'),1),
array('?p_action=ach&sa=l&'.$str_dossier,_('Liste achat'),_('Liste des achats'),2),
array('?p_action=ach&sa=lnp&'.$str_dossier,_('Liste dépenses non payées'),_('Liste des ventes non payées'),3),
array('commercial.php?p_action=supplier&'.$str_dossier,_('Fournisseurs'),_('Fournisseurs')),
array('?p_action=impress&type=jrn&'.$str_dossier,_('Impression'),_('Impression'))
array('?ledger_type=ACH&sa=n&'.$str_dossier."&$ac",_('Nouvelle dépense'),_('Nouvel achat ou dépense'),1),
array('?ledger_type=ACH&sa=l&'.$str_dossier."&$ac",_('Liste achat'),_('Liste des achats'),2),
array('?ledger_type=ACH&sa=lnp&'.$str_dossier."&$ac",_('Liste dépenses non payées'),_('Liste des ventes non payées'),3)
);
$sa=(isset ($_REQUEST['sa']))?$_REQUEST['sa']:-1;
@ -66,8 +64,7 @@ case 'lnp':
echo '<div class="lmenu">';
echo ShowItem($array,'H','mtitle','mtitle',$def);
echo '</div>';
$href=basename($_SERVER['PHP_SELF']);
$href=basename($_SERVER['PHP_SELF'])."?$ac&$str_dossier";
//----------------------------------------------------------------------
// Encode a new invoice
// empty form for encoding
@ -76,7 +73,7 @@ if ( $def==1 || $def == 4 )
{
// Check privilege
if ( isset($_REQUEST['p_jrn']))
if ( $User->check_jrn($_REQUEST['p_jrn']) != 'W' )
if ( $g_user->check_jrn($_REQUEST['p_jrn']) != 'W' )
{
NoAccess();
exit -1;
@ -105,7 +102,7 @@ if ( $def==1 || $def == 4 )
echo HtmlInput::hidden('p_action','ach');
echo dossier::hidden();
echo $Ledger->confirm($_POST );
echo HtmlInput::hidden('ac',$_REQUEST['ac']);
$chk=new ICheckBox();
$chk->selected=false;
echo '<div style="float:left;clear:both">';
@ -150,7 +147,7 @@ if ( $def==1 || $def == 4 )
/* Save the predefined operation */
if ( isset($_POST['opd_save']) && $User->check_action(PARPREDE)==1)
if ( isset($_POST['opd_save']) && $g_user->check_action(PARPREDE)==1)
{
$opd=new Pre_op_ach($cn);
$opd->get_post();
@ -270,7 +267,7 @@ if ( $def == 2 )
echo '<div class="content">';
// Check privilege
if ( isset($_REQUEST['p_jrn']) &&
$User->check_jrn($_REQUEST['p_jrn']) == 'X')
$g_user->check_jrn($_REQUEST['p_jrn']) == 'X')
{
NoAccess();
@ -296,7 +293,7 @@ if ( $def == 2 )
/* by default we should the default period */
if ( ! isset($p_array['date_start']))
{
$period=$User->get_periode();
$period=$g_user->get_periode();
$per=new Periode($cn,$period);
list($date_start,$date_end)=$per->get_date_limit();
$p_array['date_start']=$date_start;
@ -358,7 +355,7 @@ if ( $def==3 )
echo '<div class="content">';
// Check privilege
if ( isset($_REQUEST['p_jrn']) &&
$User->check_jrn($_REQUEST['p_jrn']) == 'X')
$g_user->check_jrn($_REQUEST['p_jrn']) == 'X')
{
NoAccess();
exit -1;

View file

@ -27,17 +27,15 @@ require_once ('class_acc_ledger_fin.php');
require_once('class_ipopup.php');
$gDossier=dossier::id();
$p_action=(isset ($_REQUEST['p_action']))?$_REQUEST['p_action']:'';
$cn=new Database(dossier::id());
$menu_action="?p_action=fin&".dossier::get();
$menu_action="?ledger_type=fin&ac=".$_REQUEST['ac']."&".dossier::get();
$menu=array(
array($menu_action.'&sa=n',_('Nouvel extrait'),_('Encodage d\'un nouvel extrait'),1),
array($menu_action.'&sa=l',_('Liste'),_('Liste opération bancaire'),2),
array($menu_action.'&sa=s',_('Solde'),_('Solde des comptes'),3),
array($menu_action.'&sa=r',_('Rapprochements banquaires'),_('Rapprochements banquaires'),4),
array('?p_action=impress&type=jrn&'.dossier::get(),_('Impression'),_('Impression'))
array($menu_action.'&sa=r',_('Rapprochements banquaires'),_('Rapprochements banquaires'),4)
);
$sa=(isset($_REQUEST['sa']))?$_REQUEST['sa']:-1;
@ -71,8 +69,6 @@ $Ledger=new Acc_Ledger_Fin($cn,0);
if ( $def == 1 )
{
$href=basename($_SERVER['PHP_SELF']);
if ( isset($_REQUEST['p_jrn']))
$Ledger->id=$_REQUEST['p_jrn'];
else
@ -106,7 +102,7 @@ if ( $def == 1 )
{
echo '<div class="content">';
echo '<form name="form_detail" class="print" enctype="multipart/form-data" ACTION="'.$href.'" METHOD="POST">';
echo HtmlInput::hidden('p_action','fin');
echo HtmlInput::hidden('ac',$_REQUEST['ac']);
echo $Ledger->confirm($_POST);
echo HtmlInput::submit('confirm',_('Confirmer'));
echo HtmlInput::submit('correct',_('Corriger'));
@ -139,7 +135,7 @@ if ( $def == 1 )
echo $a;
echo '</div>';
echo '<div class="content">';
echo HtmlInput::button_anchor(_('Nouvel extrait'),$href.'?p_action=fin&sa=n&'.dossier::get());
echo HtmlInput::button_anchor(_('Nouvel extrait'),$href.'?ledger_type=fin&sa=n&'.dossier::get()."&ac=".$_REQUEST['ac']);
echo '</div>';
exit();
}
@ -158,8 +154,9 @@ if ( $def == 1 )
echo '<form class="print" name="form_detail" enctype="multipart/form-data" ACTION="'.$href.'" METHOD="POST">';
echo HtmlInput::hidden('p_action','fin');
echo HtmlInput::hidden('ledger_type','fin');
echo HtmlInput::hidden('sa','n');
echo HtmlInput::hidden('ac',$_REQUEST['ac']);
$array=( isset($correct))?$_POST:null;
// show select ledger
echo $Ledger->input($array);
@ -207,7 +204,6 @@ if ( $def == 2)
$bar=jrn_navigation_bar($offset,$max_line,$step,$page);
echo HtmlInput::hidden("sa","lnp");
echo HtmlInput::hidden("p_action","ach");
echo dossier::hidden();
echo $bar;
list($count,$html)= $Ledger->list_operation($sql,$offset);
@ -216,7 +212,7 @@ if ( $def == 2)
/*
* Export to csv
*/
$r=HtmlInput::get_to_hidden(array('l','date_start','date_end','desc','amount_min','amount_max','qcode','accounting','unpaid','gDossier','ledger_type','p_action'));
$r=HtmlInput::get_to_hidden(array('l','ac','date_start','date_end','desc','amount_min','amount_max','qcode','accounting','unpaid','gDossier','ledger_type','p_action'));
if (isset($_GET['r_jrn'])) {
foreach ($_GET['r_jrn'] as $k=>$v)
$r.=HtmlInput::hidden('r_jrn['.$k.']',$v);
@ -352,7 +348,7 @@ if ($def==4)
//-------------------------
echo '<div class="content">';
echo '<form method="get">';
echo HtmlInput::get_to_hidden(array('gDossier','p_action','sa'));
echo HtmlInput::get_to_hidden(array('gDossier','ledger_type','ac','sa'));
$wLedger=$Ledger->select_ledger('FIN',3);
if ($wLedger == null ) exit ('Pas de journal disponible');

View file

@ -35,12 +35,11 @@ $gDossier=dossier::id();
$cn=new Database(dossier::id());
//menu = show a list of ledger
$str_dossier=dossier::get();
$ac="ac=".$_REQUEST['ac'];
$array=array(
array('?p_action=ven&sa=n&'.$str_dossier,_('Nouvelle vente'),_('Nouvelle vente'),1),
array('?p_action=ven&sa=l&'.$str_dossier,_('Liste ventes'),_('Liste des ventes'),2),
array('?p_action=ven&sa=lnp&'.$str_dossier,_('Liste vente non payées'),_('Liste des ventes non payées'),3),
array('commercial.php?p_action=client&'.$str_dossier,_('Clients'),_('Clients')),
array('?p_action=impress&type=jrn&'.$str_dossier,_('Impression'),_('Impression'))
array('?ledger_type=ven&sa=n&'.$str_dossier."&$ac",_('Nouvelle vente'),_('Nouvelle vente'),1),
array('?ledger_type=ven&sa=l&'.$str_dossier."&$ac",_('Liste ventes'),_('Liste des ventes'),2),
array('?ledger_type=ven&sa=lnp&'.$str_dossier."&$ac",_('Liste vente non payées'),_('Liste des ventes non payées'),3)
);
$sa=(isset ($_REQUEST['sa']))?$_REQUEST['sa']:-1;
@ -66,7 +65,7 @@ case 'lnp':
echo '<div class="lmenu">';
echo ShowItem($array,'H','mtitle','mtitle',$def);
echo '</div>';
$href=basename($_SERVER['PHP_SELF']);
$href=basename($_SERVER['PHP_SELF'])."?$ac&$str_dossier";
//----------------------------------------------------------------------
@ -79,7 +78,7 @@ if ( $def==1 || $def == 4 )
// Check privilege
if ( isset($_REQUEST['p_jrn']) &&
$User->check_jrn($_REQUEST['p_jrn']) != 'W' )
$g_user->check_jrn($_REQUEST['p_jrn']) != 'W' )
{
NoAccess();
@ -120,6 +119,7 @@ if ( $def==1 || $def == 4 )
echo "Nom du modèle ".$opd_name->input();
echo '</div>';
echo '<hr>';
echo HtmlInput::hidden('ac',$_REQUEST['ac']);
echo HtmlInput::submit("record",_("Enregistrement"),'onClick="return verify_ca(\'\');"');
echo HtmlInput::submit('correct',_("Corriger"));
echo '</form>';
@ -135,7 +135,7 @@ if ( $def==1 || $def == 4 )
if ( isset($_POST['record']) )
{
// Check privilege
if ( $User->check_jrn($_REQUEST['p_jrn']) != 'W' )
if ( $g_user->check_jrn($_REQUEST['p_jrn']) != 'W' )
{
NoAccess();
@ -243,7 +243,8 @@ if ( $def==1 || $def == 4 )
}
else
{
echo HtmlInput::hidden("p_action","ven");
echo HtmlInput::hidden("ledger_type","VEN");
echo HtmlInput::hidden("ac",$_REQUEST['ac']);
echo HtmlInput::hidden("sa","p");
echo $Ledger->input($array);
echo '<div class="content">';
@ -263,6 +264,7 @@ if ( $def==1 || $def == 4 )
echo '<form method="GET" action="'.$href.'">';
echo HtmlInput::hidden("sa","p");
echo HtmlInput::hidden("p_action","ven");
echo dossier::hidden();
echo HtmlInput::hidden('p_jrn_predef',$Ledger->id);
$op=new Pre_op_ven($cn);
@ -289,7 +291,7 @@ if ( $def == 2 )
echo '<div class="content">';
// Check privilege
if ( isset($_REQUEST['p_jrn']) &&
$User->check_jrn($_REQUEST['p_jrn']) == 'X')
$g_user->check_jrn($_REQUEST['p_jrn']) == 'X')
{
NoAccess();
@ -315,7 +317,7 @@ if ( $def == 2 )
/* by default we should the default period */
if ( ! isset($p_array['date_start']))
{
$period=$User->get_periode();
$period=$g_user->get_periode();
$per=new Periode($cn,$period);
list($date_start,$date_end)=$per->get_date_limit();
$p_array['date_start']=$date_start;
@ -336,6 +338,7 @@ if ( $def == 2 )
echo HtmlInput::hidden("sa","l");
echo HtmlInput::hidden("p_action","ven");
echo dossier::hidden();
echo HtmlInput::hidden("ac",$_REQUEST['ac']);
echo $bar;
list($count,$html)= $Ledger->list_operation($sql,$offset,1);
echo $html;
@ -378,7 +381,7 @@ if ( $def==3 )
echo '<div class="content">';
// Check privilege
if ( isset($_REQUEST['p_jrn']) &&
$User->check_jrn($_REQUEST['p_jrn']) == 'X')
$g_user->check_jrn($_REQUEST['p_jrn']) == 'X')
{
NoAccess();
exit -1;

39
include/dashboard.inc.php Normal file
View file

@ -0,0 +1,39 @@
<?php
require_once("class_idate.php");
require_once("class_itext.php");
require_once ('constant.php');
require_once ('ac_common.php');
require_once ('class_user.php');
require_once('class_acc_report.php');
require_once('class_periode.php');
require_once ('user_menu.php');
require_once ('class_dossier.php');
require_once('class_todo_list.php');
require_once("class_itextarea.php");
require_once('class_calendar.php');
require_once('class_acc_ledger.php');
echo '<div class="content">';
global $g_user;
/* others report */
$cal=new Calendar();
$cal->get_preference();
$Ledger=new Acc_Ledger($cn,0);
$last_ledger=array();
if ( $g_user->check_action(GESTION)==1)
{
$Operation=new Action($cn);
$last_ledger=$Ledger->get_last(10);
$last_operation=$Operation->get_last(10);
}
else
{
$last_operation=array();
}
ob_start();
require_once('template/dashboard.php');
$ret=ob_get_contents();
ob_end_clean();
echo $ret;
echo '</div>';
?>

View file

@ -78,7 +78,7 @@ if ( $sub_action == 'mod_template')
//-----------------------------------------------------
echo $doc->myList();
echo '<div id="add_modele" style="display:none">';
echo $doc->form('parametre.php?p_action=document');
echo $doc->form('');
echo '</div>';
?>

View file

@ -32,17 +32,17 @@ require_once('class_ipopup.php');
echo IPoste::ipopup('ipop_account');
echo ICard::ipopup('ipop_card');
$gDossier=dossier::id();
$str_dossier=dossier::get();
global $g_user,$cn;
$pop_tva=new IPopup('popup_tva');
$pop_tva->title=_('Choix TVA');
$pop_tva->value='';
echo $pop_tva->input();
$cn=new Database($gDossier);
// Security check
$write=$User->check_action(FICADD);
$write=$g_user->check_action(FICADD);
if ($write == 0 )
{
/* Cannot Access */
@ -53,11 +53,14 @@ function ShowRecherche()
{
echo '<form method="GET" action="?">';
echo dossier::hidden();
echo HtmlInput::hidden('ac',$_REQUEST['ac']);
$w=new IText();
$search_text=(isset($_REQUEST['search_text']))?$_REQUEST['search_text']:"";
$h=new IHidden();
echo $h->input('p_action','fiche');
echo $h->input('action','search');
echo $h->input('ac',$_REQUEST['ac']);
echo _("Recherche :").$w->input('search_text',$search_text);
echo HtmlInput::submit('submit',_('Rechercher'));
echo '</form>';
@ -90,8 +93,10 @@ function ShowFicheDefInput($p_fiche_def)
/* show the values label class_base and create account */
$r.='<form method="post">';
$r.= HtmlInput::hidden('ac',$_REQUEST['ac']);
$r.=dossier::hidden();
$r.=HtmlInput::hidden("fd_id",$p_fiche_def->id);
$r.=HtmlInput::hidden("ac",$_REQUEST['ac']);
$r.=HtmlInput::hidden("p_action","fiche");
$r.= $p_fiche_def->input_base();
$r.='<hr>';
@ -101,9 +106,11 @@ function ShowFicheDefInput($p_fiche_def)
/* attributes */
$r.='<fieldset><legend>Détails</legend>';
$r.= '<FORM action="?p_action=fiche" method="POST">';
$r.= '<FORM action="do.php" method="POST">';
$r.=dossier::hidden();
$r.= HtmlInput::hidden('ac',$_REQUEST['ac']);
$r.=HtmlInput::hidden("fd_id",$p_fiche_def->id);
$r.=HtmlInput::hidden("ac",$_REQUEST['ac']);
$r.= $p_fiche_def->DisplayAttribut("remove");
$r.= HtmlInput::submit('add_line',_('Ajoutez cet élément'));
$r.= HtmlInput::submit("save_line",_("Sauvez"));
@ -126,7 +133,7 @@ $recherche=true;
// in the database
if ( isset($_POST['add_modele']) )
{
$User->can_request(FICCAT);
$g_user->can_request(FICCAT);
// insert the model of card in database
$fiche_def=new Fiche_Def($cn);
$fiche_def->Add($_POST);
@ -135,7 +142,7 @@ $r="";
if ( isset ($_POST['remove_cat'] ) )
{
$User->can_request(FICCAT);
$g_user->can_request(FICCAT);
$fd_id=new Fiche_Def($cn,$_POST['fd_id']);
$remains=$fd_id->remove();
@ -147,7 +154,7 @@ if ( isset ($_POST['remove_cat'] ) )
// Add a line in the card model
if ( isset ($_POST["add_line"]) )
{
$User->can_request(FIC);
$g_user->can_request(FIC);
$r= '<DIV class="u_redcontent" style="width:auto">';
if ( $write ==0)
@ -170,7 +177,7 @@ if ( isset ($_POST["add_line"]) )
if ( isset($_POST['save_line']))
{
$User->can_request(FICCAT);
$g_user->can_request(FICCAT);
$fiche_def=new Fiche_Def($cn,$_REQUEST['fd_id']);
$fiche_def->save_order($_POST);
$r= '<DIV class="u_redcontent" style="width:auto">';
@ -190,7 +197,7 @@ if ( isset($_POST['save_line']))
// Remove lines from a card model
if ( isset ($_POST['remove_line']) )
{
$User->can_request(FICCAT);
$g_user->can_request(FICCAT);
$r= '<DIV class="u_redcontent" style="width:auto">';
if ( $write ==0)
$r.= "<h2 class=\"error\"> Pas d'accès </h2>";
@ -213,7 +220,7 @@ if ( isset ($_POST['remove_line']) )
// Change the name of the card model
if ( isset ($_POST["change_name"] ) )
{
$User->can_request(FICCAT);
$g_user->can_request(FICCAT);
$r= '<DIV class="u_redcontent" style="width:auto">';
if ( $write ==0)
$r.= "<h2 class=\"error\"> "._("Pas d'accès")." </h2>";
@ -224,12 +231,12 @@ if ( isset ($_POST["change_name"] ) )
}
$r.= '</DIV>';
$recherche=false;
ShowMenuFiche($gDossier);
ShowMenuFiche(Dossier::id());
echo $r;
exit();
}
ShowMenuFiche($gDossier);
ShowMenuFiche(Dossier::id());
echo $r;
//------------------------------------------------------------------------------
@ -244,7 +251,7 @@ if ( isset ( $_GET["action"]) )
&& ! isset ($_POST['move'])
&& ! isset ($_POST['delete']))
{
$User->can_request(FICADD);
$g_user->can_request(FICADD);
echo '<DIV class="u_redcontent" style="width:auto">';
$fiche_def=new Fiche_Def($cn,$_GET['fiche']);
@ -260,7 +267,7 @@ if ( isset ( $_GET["action"]) )
{
echo '<DIV class="u_redcontent" style="width:auto">';
$t=false;
if ( $User->check_action(FICADD)==0)
if ( $g_user->check_action(FICADD)==0)
{
echo '<H2 class="info"> Vos changements ne seront pas sauvés</h2>';
$t=true;
@ -291,6 +298,7 @@ if ( isset ( $_GET["action"]) )
echo '<form method="post" action="?p_action=fiche&action=vue&fiche='.$_GET['fiche'].$str.'">';
echo dossier::hidden();
echo $fiche->Display($t);
echo HtmlInput::hidden('ac',$_REQUEST['ac']);
echo HtmlInput::hidden("f_id",$_GET['fiche_id']);
if ( $write != 0 )
{
@ -304,7 +312,8 @@ if ( isset ( $_GET["action"]) )
echo $iselect->input();
}
$str="";
echo HtmlInput::button_anchor(_('Retour'),'?p_action=fiche&action=vue&'.$str_dossier.'&fiche='.$fiche->fiche_def.$str);
echo HtmlInput::button_anchor(_('Retour'),'?p_action=fiche&action=vue&'.$str_dossier.'&fiche='.$fiche->fiche_def.$str.
"&ac=".$_REQUEST['ac']);
if ( $write != 0 ) echo '</form>';
echo '</DIV>';
@ -315,9 +324,10 @@ if ( isset ( $_GET["action"]) )
// the property of the card model
if ($action == "add_modele" )
{
$User->can_request(FICCAT);
$g_user->can_request(FICCAT);
echo '<DIV class="u_redcontent" style="width:auto">';
echo '<form method="post">';
echo HtmlInput::hidden('ac',$_REQUEST['ac']);
$oFiche_Def=new Fiche_Def($cn);
echo HtmlInput::hidden("p_action","fiche");
echo dossier::hidden();
@ -332,7 +342,7 @@ if ( isset ( $_GET["action"]) )
// Modify a card Model
if ($action == "modifier" )
{
$User->can_request(FICCAT);
$g_user->can_request(FICCAT);
echo '<DIV class="u_redcontent" style="width:auto">';
$fiche_def=new Fiche_Def($cn,$_GET['fiche']);
@ -361,7 +371,7 @@ if ( isset ( $_GET["action"]) )
{
$fiche=new Fiche($cn,$f_id['f_id']);
echo '<A href="?p_action=fiche&'.$str_dossier.'&action=detail&fiche_id='.$f_id['f_id'].
'&fiche='.$f_id['fd_id'].'">'.
'&fiche='.$f_id['fd_id']."&ac=".$_REQUEST['ac'].'">'.
$fiche->getName().'</A>';
}
}
@ -380,7 +390,7 @@ if ( isset ( $_GET["action"]) )
// Display a blank card from the selected category
if ( isset ($_POST["fiche"]) && isset ($_POST["add"] ) )
{
$User->can_request(FICADD);
$g_user->can_request(FICADD);
echo '<DIV class="u_redcontent" style="width:auto">';
if ( $write ==0)
@ -395,6 +405,7 @@ if ( isset ($_POST["fiche"]) && isset ($_POST["add"] ) )
echo '<form method="post" action="'.$url.'&fiche='.$_POST['fiche'].'">';
echo dossier::hidden();
echo HtmlInput::hidden('ac',$_REQUEST['ac']);
echo $fiche->blank($_POST['fiche']);
echo HtmlInput::submit("add_fiche","Ajout");
echo HtmlInput::button_anchor(_('Annuler'),$url.'&fiche='.$_POST['fiche'].'&'.$str_dossier);
@ -410,7 +421,7 @@ if ( isset ($_POST["fiche"]) && isset ($_POST["add"] ) )
// delete a card
if (isset($_POST['delete']) )
{
$User->can_request(FIC);
$g_user->can_request(FIC);
ShowRecherche();
echo '<DIV class="u_redcontent">';
if ( $write ==0)
@ -430,7 +441,7 @@ if (isset($_POST['delete']) )
// Add the data (attribute) of the card
if ( isset ($_POST["add_fiche"]) )
{
$User->can_request(FICADD);
$g_user->can_request(FICADD);
if ( $write ==0)
{
echo '<DIV class="u_redcontent">';
@ -454,7 +465,7 @@ if ( isset ($_POST["add_fiche"]) )
// Update a card
if ( isset ($_POST["update_fiche"]) )
{
$User->can_request(FIC);
$g_user->can_request(FIC);
echo '<DIV class="u_redcontent">';
if ( $write ==0)
echo "<h2 class=\"error\"> Pas d'accès </h2>";

View file

@ -50,8 +50,8 @@ for ($i=0;$i<sizeof($all);$i++)
$w=new IHidden();
echo $w->input('idx',$all[$i]->frd_id);
echo HtmlInput::submit('mod','modifie');
echo $w->input($p_action,'p_action');
echo $w->input($sa,'sa');
echo $w->input($_REQUEST['ac'],'ac');
//echo $w->input($sa,'sa');
echo "</form>";
echo "</TD>";
echo '</TR>';
@ -77,8 +77,8 @@ if ( isset ($_POST['mod']) )
echo $mod->Input();
echo "</ul>";
$w=new IHidden();
echo $w->input('p_action',$p_action);
echo $w->input('sa',$sa);
echo $w->input('ac',$_REQUEST['ac']);
// echo $w->input('sa',$sa);
echo HtmlInput::submit('confirm_mod' ,'Confirme');
echo HtmlInput::submit('no','Cancel');
echo '</form>';

View file

@ -1,4 +1,5 @@
<?php
/*
* This file is part of PhpCompta.
*
@ -20,379 +21,369 @@
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
/*!\file
/* !\file
* \brief display, add, delete and modify forecast
*/
require_once 'class_anticipation.php';
$sa=(isset($_REQUEST['sa']))?$_REQUEST['sa']:'';
/**********************************************************************
$sa = (isset($_REQUEST['sa'])) ? $_REQUEST['sa'] : '';
/* * ********************************************************************
* Remove a anticipation
*
*
**********************************************************************/
* ******************************************************************** */
/**
* @todo add security for forecast.inc.php
*/
if ( isset($_GET['del']))
if (isset($_GET['del']))
{
$forecast=new Forecast($cn,$_GET['f_id']);
$forecast = new Forecast($cn, $_GET['f_id']);
$forecast->delete();
}
/*
* Cloning
*/
if (isset ($_REQUEST ['clone']))
{
if (isset($_REQUEST ['clone']))
{
echo "<h2> cloning</h2>";
/*
* We need to clone the forecast
*/
$anti=new Forecast($cn,$_REQUEST ['f_id']);
$anti = new Forecast($cn, $_REQUEST ['f_id']);
$anti->object_clone();
}
/**********************************************************************
}
/* * ********************************************************************
* Save the modification mod_cat_save
*
*
**********************************************************************/
if ( isset($_POST['mod_cat_save']))
{
/*
* We save the forecast
*/
$anti=new Forecast($cn,$_POST['f_id']);
try
{
$cn->start();
/* Save forecast */
$anti->set_parameter('name',$_POST['an_name']);
$anti->set_parameter('start_date',$_POST['start_date']);
$anti->set_parameter('end_date',$_POST['end_date']);
* ******************************************************************** */
if (isset($_POST['mod_cat_save']))
{
/*
* We save the forecast
*/
$anti = new Forecast($cn, $_POST['f_id']);
try
{
$cn->start();
/* Save forecast */
$anti->set_parameter('name', $_POST['an_name']);
$anti->set_parameter('start_date', $_POST['start_date']);
$anti->set_parameter('end_date', $_POST['end_date']);
$anti->save();
$anti->save();
/* add new category */
for ($i=0;$i<MAX_CAT;$i++)
{
if( isset($_POST['fr_cat_new'.$i]))
{
if (strlen(trim($_POST['fr_cat_new'.$i])) != 0 )
{
$c=new Forecast_Cat($cn);
$c->set_parameter('order',$_POST['fc_order_new'.$i]);
$c->set_parameter('desc',$_POST['fr_cat_new'.$i]);
$c->set_parameter('forecast',$_POST['f_id']);
$c->save();
}
}
}
/* add new category */
for ($i = 0; $i < MAX_CAT; $i++)
{
if (isset($_POST['fr_cat_new' . $i]))
{
if (strlen(trim($_POST['fr_cat_new' . $i])) != 0)
{
$c = new Forecast_Cat($cn);
$c->set_parameter('order', $_POST['fc_order_new' . $i]);
$c->set_parameter('desc', $_POST['fr_cat_new' . $i]);
$c->set_parameter('forecast', $_POST['f_id']);
$c->save();
}
}
}
/* update existing cat */
foreach ($_POST as $key=>$value)
{
$var=sscanf($key,'fr_cat%d');
$idx=sprintf("fr_cat%d",$var[0]);
if (isset($_POST[$idx]))
{
$fc=new Forecast_Cat($cn,$var[0]);
if (strlen(trim($_POST[$idx]))==0)
{
$fc->delete();
}
else
{
$fc->set_parameter('order',$_POST['fc_order'.$var[0]]);
$fc->set_parameter('desc',$_POST['fr_cat'.$var[0]]);
$fc->set_parameter('forecast',$_POST['f_id']);
$fc->save();
}
/* update existing cat */
foreach ($_POST as $key => $value)
{
$var = sscanf($key, 'fr_cat%d');
$idx = sprintf("fr_cat%d", $var[0]);
if (isset($_POST[$idx]))
{
$fc = new Forecast_Cat($cn, $var[0]);
if (strlen(trim($_POST[$idx])) == 0)
{
$fc->delete();
}
else
{
$fc->set_parameter('order', $_POST['fc_order' . $var[0]]);
$fc->set_parameter('desc', $_POST['fr_cat' . $var[0]]);
$fc->set_parameter('forecast', $_POST['f_id']);
$fc->save();
}
}
}
}
}
$cn->commit();
}
catch (Exception $e)
{
alert($e->getMessage());
$cn->rollback();
}
$sa='vw';
}
/**********************************************************************
$cn->commit();
}
catch (Exception $e)
{
alert($e->getMessage());
$cn->rollback();
}
$sa = 'vw';
}
/* * ********************************************************************
* Save first the data for new
*
*
**********************************************************************/
if ( $sa == 'new' || isset ($_POST['step3']))
* ******************************************************************** */
if ($sa == 'new' || isset($_POST['step3']))
{
$correct=0;
$correct = 0;
if (isset($_POST['step3']))
{
/*save all the items */
try
{
$cn->start();
for ($i=0;$i<$_POST['nbrow'];$i++)
{
/* save all the items */
try
{
$cn->start();
for ($i = 0; $i < $_POST['nbrow']; $i++)
{
// Delete if needed
if ( isset($_POST['fi_id'.$i]))
{
if (strlen(trim($_POST['an_cat_acc'.$i]))==0 &&strlen(trim($_POST['an_qc'.$i]))== 0)
{
$e=new Forecast_item($cn);
$e->set_parameter("id",$_POST['fi_id'.$i]);
$e->delete();
}
}
if (strlen(trim($_POST['an_cat_acc'.$i]))!=0 || strlen(trim($_POST['an_qc'.$i]))!= 0)
{
/* we save only if there is something */
$e=new Forecast_item($cn);
if ( isset($_POST['fi_id'.$i]))
{
$e->set_parameter("id",$_POST['fi_id'.$i]);
}
$e->set_parameter('text',$_POST['an_label'.$i]);
$e->set_parameter('amount',$_POST['an_cat_amount'.$i]);
$e->set_parameter('debit',$_POST['an_deb'.$i]);
$e->set_parameter('cat_id',$_POST['an_cat'.$i]);
$e->set_parameter('account',$_POST['an_cat_acc'.$i]);
$e->set_parameter('periode',$_POST['month'.$i]);
$f=new Fiche($cn);
if ( $f->get_by_qcode($_POST['an_qc'.$i],false) == 0 )
$e->set_parameter('card',$f->id);
else
$e->set_parameter('card',null);
$e->set_parameter('order',$i);
$e->save();
}
}
$cn->commit();
$sa='vw'; // to avoid to restart the add of new anticipation
}
catch (Exception $e)
{
$cn->rollback();
alert($e->getMessage());
$correct=1;
}
// Delete if needed
if (isset($_POST['fi_id' . $i]))
{
if (strlen(trim($_POST['an_cat_acc' . $i])) == 0 && strlen(trim($_POST['an_qc' . $i])) == 0)
{
$e = new Forecast_item($cn);
$e->set_parameter("id", $_POST['fi_id' . $i]);
$e->delete();
}
}
if (strlen(trim($_POST['an_cat_acc' . $i])) != 0 || strlen(trim($_POST['an_qc' . $i])) != 0)
{
/* we save only if there is something */
$e = new Forecast_item($cn);
if (isset($_POST['fi_id' . $i]))
{
$e->set_parameter("id", $_POST['fi_id' . $i]);
}
$e->set_parameter('text', $_POST['an_label' . $i]);
$e->set_parameter('amount', $_POST['an_cat_amount' . $i]);
$e->set_parameter('debit', $_POST['an_deb' . $i]);
$e->set_parameter('cat_id', $_POST['an_cat' . $i]);
$e->set_parameter('account', $_POST['an_cat_acc' . $i]);
$e->set_parameter('periode', $_POST['month' . $i]);
$f = new Fiche($cn);
if ($f->get_by_qcode($_POST['an_qc' . $i], false) == 0)
$e->set_parameter('card', $f->id);
else
$e->set_parameter('card', null);
$e->set_parameter('order', $i);
$e->save();
}
}
$cn->commit();
$sa = 'vw'; // to avoid to restart the add of new anticipation
}
catch (Exception $e)
{
$cn->rollback();
alert($e->getMessage());
$correct = 1;
}
}
/* Second step : we save the name and category
* and propose the items we add the item */
if ($correct==2 || isset ($_POST['step2']))
if ($correct == 2 || isset($_POST['step2']))
{
try
{
$cn->start();
/* Save forecast */
$a=new Forecast($cn);
$a->set_parameter('name',$_POST['an_name']);
$a->set_parameter('start_date',$_POST['start_date']);
$a->set_parameter('end_date',$_POST['end_date']);
try
{
$cn->start();
/* Save forecast */
$a = new Forecast($cn);
$a->set_parameter('name', $_POST['an_name']);
$a->set_parameter('start_date', $_POST['start_date']);
$a->set_parameter('end_date', $_POST['end_date']);
$a->save();
$id=$a->get_parameter("id");
/* save cat */
for ($i=0;$i<MAX_CAT;$i++)
{
if( strlen(trim($_POST['fr_cat'.$i])) != 0 )
{
$c=new Forecast_Cat($cn);
$c->set_parameter('order',$_POST['fr_order'.$i]);
$c->set_parameter('desc',$_POST['fr_cat'.$i]);
$c->set_parameter('forecast',$id);
$c->save();
}
}
$cn->commit();
}
catch (Exception $e)
{
alert($e->getMessage());
$correct=1;
unset($_POST['step2']);
$cn->rollback();
}
$a->save();
$id = $a->get_parameter("id");
/* save cat */
for ($i = 0; $i < MAX_CAT; $i++)
{
if (strlen(trim($_POST['fr_cat' . $i])) != 0)
{
$c = new Forecast_Cat($cn);
$c->set_parameter('order', $_POST['fr_order' . $i]);
$c->set_parameter('desc', $_POST['fr_cat' . $i]);
$c->set_parameter('forecast', $id);
$c->save();
}
}
$cn->commit();
}
catch (Exception $e)
{
alert($e->getMessage());
$correct = 1;
unset($_POST['step2']);
$cn->rollback();
}
}
}
/**********************************************************************
/* * ********************************************************************
* Display menu
*
*
**********************************************************************/
* ******************************************************************** */
// display button add and list of forecast to display
$aForecast=Forecast::load_all($cn);
$menu=array();
$get_dossier=dossier::get();
$aForecast = Forecast::load_all($cn);
$menu = array();
$get_dossier = dossier::get();
for ($i = 0;$i<count($aForecast);$i++)
for ($i = 0; $i < count($aForecast); $i++)
{
$href="?p_action=prev&sa=vw&".$get_dossier.'&f_id='.$aForecast[$i]['f_id'];
$name=h($aForecast[$i]['f_name']);
$menu[]=array($href,$name,$name,$aForecast[$i]['f_id']);
$href = "?ac=" . $_REQUEST['ac'] . "&sa=vw&" . $get_dossier . '&f_id=' . $aForecast[$i]['f_id'];
$name = h($aForecast[$i]['f_name']);
$menu[] = array($href, $name, $name, $aForecast[$i]['f_id']);
}
$href="?p_action=prev&sa=new&".$get_dossier;
$menu[]=array($href,_("Ajout prévision"),_("Ajout d'une prévision"),0);
$def=(isset($_REQUEST['f_id']))?$_REQUEST['f_id']:-1;
$href = "?ac=" . $_REQUEST['ac'] . "&sa=new&" . $get_dossier;
$menu[] = array($href, _("Ajout prévision"), _("Ajout d'une prévision"), 0);
$def = (isset($_REQUEST['f_id'])) ? $_REQUEST['f_id'] : -1;
echo '<div class="lmenu">';
echo ShowItem($menu,'H','mtitle','mtitle',$def);
echo ShowItem($menu, 'H', 'mtitle', 'mtitle', $def);
echo '</div>';
/**********************************************************************
/* * ********************************************************************
* Ask for a new anticipation (forecast)
*
*
**********************************************************************/
if ( $sa == 'new')
* ******************************************************************** */
if ($sa == 'new')
{
/* Second step : we save the name and category
* and propose the items we add the item */
if ($correct==2 || isset ($_POST['step2']))
if ($correct == 2 || isset($_POST['step2']))
{
/* Propose a form for the items
*/
$anticip=new Anticipation($cn,$a->get_parameter("id"));
echo '<div class="content">';
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();
echo '<form method="post" action="?">';
echo dossier::hidden();
echo HtmlInput::hidden('sa','new');
echo HtmlInput::hidden('p_action','prev');
echo HtmlInput::hidden('f_id',$id);
echo $anticip->form_item();
echo HtmlInput::submit('step3',_('Sauver'));
echo '</form>';
echo '</div>';
/* Propose a form for the items
*/
$anticip = new Anticipation($cn, $a->get_parameter("id"));
echo '<div class="content">';
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();
echo '<form method="post" action="?">';
echo dossier::hidden();
echo HtmlInput::hidden('sa', 'new');
echo HtmlInput::hidden('ac', $_REQUEST['ac']);
echo HtmlInput::hidden('f_id', $id);
echo $anticip->form_item();
echo HtmlInput::submit('step3', _('Sauver'));
echo '</form>';
echo '</div>';
}
/* First step, the name and the category */
if ( ! isset ($_POST['step2']) || $correct==1)
if (!isset($_POST['step2']) || $correct == 1)
{
$anc=new Anticipation($cn);
echo '<div class="content">';
/* display a blank form for name and category */
echo '<form method="post" action="?">';
echo dossier::hidden();
echo HtmlInput::hidden('sa','new');
echo HtmlInput::hidden('p_action','prev');
echo $anc->form_cat();
echo HtmlInput::submit('step2',_('Sauver'));
echo '</form>';
echo '</div>';
$anc = new Anticipation($cn);
echo '<div class="content">';
/* display a blank form for name and category */
echo '<form method="post" action="?">';
echo dossier::hidden();
echo HtmlInput::hidden('sa', 'new');
echo HtmlInput::hidden('ac', $_REQUEST['ac']);
echo $anc->form_cat();
echo HtmlInput::submit('step2', _('Sauver'));
echo '</form>';
echo '</div>';
}
}
/**********************************************************************
/* * ********************************************************************
* If we request to modify the category or the name
*
*
**********************************************************************/
if ( isset($_GET['mod_cat']))
* ******************************************************************** */
if (isset($_GET['mod_cat']))
{
$anc=new Anticipation($cn,$_GET['f_id']);
$anc = new Anticipation($cn, $_GET['f_id']);
echo '<div class="content">';
/* display a blank form for name and category */
echo '<form method="post" action="?">';
echo dossier::hidden();
echo HtmlInput::hidden('sa','mod');
echo HtmlInput::hidden('p_action','prev');
echo HtmlInput::hidden('sa', 'mod');
echo HtmlInput::hidden('ac', $_REQUEST['ac']);
echo $anc->form_cat();
echo HtmlInput::submit('mod_cat_save',_('Sauver'));
echo HtmlInput::submit('mod_cat_save', _('Sauver'));
echo '</form>';
echo '</div>';
}
/**********************************************************************
/* * ********************************************************************
* If we request to modify the items
*
*
**********************************************************************/
* ******************************************************************** */
if (isset($_GET['mod_item']))
{
/* Propose a form for the items
*/
$anticip=new Anticipation($cn,$_GET['f_id']);
$anticip = new Anticipation($cn, $_GET['f_id']);
echo '<div class="content">';
echo ICard::ipopup('ipopcard');
echo IPoste::ipopup('ipop_account');
$search_card=new IPopup('ipop_card');
$search_card->title=_('Recherche de fiche');
$search_card->value='';
$search_card = new IPopup('ipop_card');
$search_card->title = _('Recherche de fiche');
$search_card->value = '';
echo $search_card->input();
echo '<form method="post" action="?">';
echo dossier::hidden();
echo HtmlInput::hidden('sa','new');
echo HtmlInput::hidden('p_action','prev');
echo HtmlInput::hidden('f_id',$_GET['f_id']);
echo HtmlInput::hidden('sa', 'new');
echo HtmlInput::hidden('ac', $_REQUEST['ac']);
echo HtmlInput::hidden('f_id', $_GET['f_id']);
echo $anticip->form_item();
echo HtmlInput::submit('step3',_('Sauver'));
echo HtmlInput::submit('step3', _('Sauver'));
echo '</form>';
echo '</div>';
}
/**********************************************************************
/* * ********************************************************************
* if a forecast is asked we display the result
*
*
**********************************************************************/
if ( isset($_REQUEST['f_id']) && $sa=="vw")
* ******************************************************************** */
if (isset($_REQUEST['f_id']) && $sa == "vw")
{
echo '<div class="content">';
$forecast=new Anticipation($cn);
$forecast->set_parameter("id",$_REQUEST['f_id']);
try {
echo $forecast->display();
echo '<div class="noprint">';
echo '<form method="get">';
echo dossier::hidden();
echo HtmlInput::hidden('f_id',$_REQUEST['f_id']);
echo HtmlInput::submit('mod_cat',_('Modifier nom ou catégories'));
echo HtmlInput::submit('mod_item',_('Modifier éléments'));
//echo HtmlInput::submit('cvs',_('Export CVS'));
echo HtmlInput::submit('del',_('Effacer'),'onclick="return confirm(\''._('Vous confirmez l\\\' effacement').'\')"');
echo HtmlInput::submit('clone',_('Cloner'),'onclick="return confirm(\''._('Vous confirmez le clonage ').'\')"');
echo HtmlInput::hidden('p_action','prev');
echo '</form>';
echo '</div>';
echo '</div>';
exit();
}
catch (Exception $e)
{
echo "<div class=\"error\"><p>"._("Erreur : ").$e->getMessage().'</p><p>'._('Vous devez corriger').'</p></div>';
$anc=new Anticipation($cn,$_GET['f_id']);
$forecast = new Anticipation($cn);
$forecast->set_parameter("id", $_REQUEST['f_id']);
try
{
echo $forecast->display();
echo '<div class="noprint">';
echo '<form method="get">';
echo dossier::hidden();
echo HtmlInput::hidden('f_id', $_REQUEST['f_id']);
echo HtmlInput::submit('mod_cat', _('Modifier nom ou catégories'));
echo HtmlInput::submit('mod_item', _('Modifier éléments'));
//echo HtmlInput::submit('cvs',_('Export CVS'));
echo HtmlInput::submit('del', _('Effacer'), 'onclick="return confirm(\'' . _('Vous confirmez l\\\' effacement') . '\')"');
echo HtmlInput::submit('clone', _('Cloner'), 'onclick="return confirm(\'' . _('Vous confirmez le clonage ') . '\')"');
echo HtmlInput::hidden('ac', $_REQUEST['ac']);
echo '</form>';
echo '</div>';
echo '</div>';
exit();
}
catch (Exception $e)
{
echo "<div class=\"error\"><p>" . _("Erreur : ") . $e->getMessage() . '</p><p>' . _('Vous devez corriger') . '</p></div>';
$anc = new Anticipation($cn, $_GET['f_id']);
echo '<div class="content">';
/* display a blank form for name and category */
echo '<form method="post" action="?">';
echo dossier::hidden();
echo HtmlInput::hidden('sa','mod');
echo HtmlInput::hidden('p_action','prev');
echo HtmlInput::hidden('sa', 'mod');
echo HtmlInput::hidden('ac', $_REQUEST['ac']);
echo $anc->form_cat();
echo HtmlInput::submit('mod_cat_save',_('Sauver'));
echo HtmlInput::submit('mod_cat_save', _('Sauver'));
echo '</form>';
echo '</div>';
}
echo '</div>';
}
}
?>

View file

@ -25,7 +25,7 @@ require_once('class_exercice.php');
* \brief form who call the printing of the bilan in RTF
* file included by user_impress
*
* some variable are already defined ($cn, $User ...)
* some variable are already defined ($cn, $g_user ...)
*/
//-----------------------------------------------------
@ -33,6 +33,8 @@ require_once('class_exercice.php');
//-----------------------------------------------------
require_once('class_database.php');
global $g_user;
//-----------------------------------------------------
// Form
//-----------------------------------------------------
@ -40,7 +42,7 @@ require_once('class_database.php');
$bilan=new Acc_Bilan($cn);
$bilan->get_request_get();
echo '<div class="content">';
$exercice=(isset($_GET['exercice']))?$_GET['exercice']:$User->get_exercice();
$exercice=(isset($_GET['exercice']))?$_GET['exercice']:$g_user->get_exercice();
/*
* Let you change the exercice

View file

@ -27,6 +27,8 @@ require_once('class_lettering.php');
$gDossier=dossier::id();
$cn=new Database($gDossier);
global $g_user;
/**
* Show first the form
*/
@ -37,7 +39,7 @@ $categorie->selected=(isset($_GET['cat']))?$_GET['cat']:0;
$str_categorie=$categorie->input();
/* periode */
$exercice=$User->get_exercice();
$exercice=$g_user->get_exercice();
$iperiode=new Periode($cn);
list ($first,$last)=$iperiode->get_limit($exercice);
@ -69,8 +71,7 @@ $str_histo=$histo->input();
echo '<div class="content">';
echo '<FORM method="GET">';
echo dossier::hidden();
echo HtmlInput::hidden('p_action',$_GET['p_action']);
echo HtmlInput::hidden('type',$_GET['type']);
echo HtmlInput::hidden('ac',$_GET['ac']);
require_once('template/impress_cat_card.php');
echo HtmlInput::submit('cat_display',_('Recherche'));
echo '</FORM>';
@ -106,7 +107,7 @@ if ( $_GET['histo'] == 3 )
HtmlInput::submit('bt_csv',"Export CSV").
HtmlInput::hidden('act',"CSV/fiche").
$hid->input("type","fiche").
$hid->input("p_action","impress").
$hid->input("ac",$_REQUEST['ac']).
$hid->input("fd_id",$_REQUEST['cat']);
echo "</form>";

View file

@ -27,28 +27,28 @@ require_once('class_acc_operation.php');
* \brief Print account (html or pdf)
* file included from user_impress
*
* some variable are already defined $cn, $User ...
* some variable are already defined $cn, $g_user ...
*
*/
//-----------------------------------------------------
// Show the jrn and date
//-----------------------------------------------------
require_once('class_database.php');
global $g_user;
//-----------------------------------------------------
// Form
//-----------------------------------------------------
echo '<div class="content">';
echo '<FORM action="?" METHOD="GET">';
echo HtmlInput::hidden('p_action','impress');
echo HtmlInput::hidden('ac',$_REQUEST['ac']);
echo HtmlInput::hidden('type','gl_comptes');
echo dossier::hidden();
echo '<TABLE><TR>';
$cn=new Database(dossier::id());
$periode=new Periode($cn);
$a=$periode->get_limit($User->get_exercice());
$a=$periode->get_limit($g_user->get_exercice());
// $a is an array
$first_day=$a[0]->first_day();
$last_day=$a[1]->last_day();
@ -56,7 +56,7 @@ $last_day=$a[1]->last_day();
// filter on period
$date_from=new IDate('from_periode');
$date_to=new IDate('to_periode');
$year=$User->get_exercice();
$year=$g_user->get_exercice();
$date_from->value=(isset($_REQUEST['from_periode'])&& isDate($_REQUEST['from_periode'])!=0)?$_REQUEST['from_periode']:$first_day;
$date_to->value=(isset($_REQUEST['to_periode']) && isDate($_REQUEST['to_periode']) !=0 )?$_REQUEST['to_periode']:$last_day;
echo td(_('Depuis').$date_from->input());
@ -117,7 +117,7 @@ if ( isset( $_REQUEST['bt_html'] ) )
$sql='select pcm_val from tmp_pcmn ';
$cond_poste='';
if ($from_poste->value != '')
if ($from_poste->value != '')
{
$cond_poste = ' where ';
$cond_poste .=' pcm_val >= upper (\''.Database::escape_string($from_poste->value).'\')';
@ -125,7 +125,7 @@ if ( isset( $_REQUEST['bt_html'] ) )
if ( $to_poste->value != '')
{
if ( $cond_poste == '')
if ( $cond_poste == '')
{
$cond_poste = ' where pcm_val <= upper (\''.Database::escape_string($to_poste->value).'\')';
}
@ -155,12 +155,12 @@ if ( isset( $_REQUEST['bt_html'] ) )
echo '<table class="result">';
$l=(isset($_REQUEST['letter']))?2:0;
$s=(isset($_REQUEST['solded']))?1:0;
foreach ($a_poste as $poste_id )
{
$Poste=new Acc_Account_Ledger ($cn, $poste_id['pcm_val']);
$Poste->load();
$Poste->get_row_date( $_GET['from_periode'], $_GET['to_periode'],$l,$s);
if ( empty($Poste->row))

View file

@ -29,18 +29,19 @@ require_once('class_exercice.php');
require_once('class_dossier.php');
load_all_script();
$gDossier=dossier::id();
global $g_user;
//-----------------------------------------------------
// Show the jrn and date
//-----------------------------------------------------
require_once('class_database.php');
if ( $User->Admin() == 0 && $User->is_local_admin()==0)
if ( $g_user->Admin() == 0 && $g_user->is_local_admin()==0)
{
$sql="select jrn_def_id,jrn_def_name
from jrn_def join jrn_type on jrn_def_type=jrn_type_id
join user_sec_jrn on uj_jrn_id=jrn_def_id
where
uj_login='$User->login'
uj_login='$g_user->login'
and uj_priv !='X'
";
$ret=$cn->make_array($sql);
@ -58,7 +59,7 @@ $NoPriv=$cn->count_sql("select jrn_def_id,jrn_def_name,jrn_def_class_deb,jrn_def
from jrn_def join jrn_type on jrn_def_type=jrn_type_id
join user_sec_jrn on uj_jrn_id=jrn_def_id
where
uj_login='$User->id'
uj_login='$g_user->id'
and uj_priv ='X'
");
// Pour voir tout les journal ?
@ -70,7 +71,7 @@ if ( $NoPriv == 0 )
}
if ( count($ret) < 1 )
NoAccess();
$exercice=(isset($_GET['exercice']))?$_GET['exercice']:$User->get_exercice();
$exercice=(isset($_GET['exercice']))?$_GET['exercice']:$g_user->get_exercice();
//-----------------------------------------------------
// Form
@ -86,14 +87,14 @@ $ex=new Exercice($cn);
$wex=$ex->select('exercice',$exercice,' onchange="submit(this)"');
echo $wex->input();
echo dossier::hidden();
echo HtmlInput::get_to_hidden(array('p_action','type'));
echo HtmlInput::get_to_hidden(array('ac','type'));
echo '</form>';
echo '</fieldset>';
echo '<FORM METHOD="GET">'.dossier::hidden();
echo HtmlInput::hidden('p_action','impress');
echo HtmlInput::get_to_hidden(array('ac','type'));
echo HtmlInput::hidden('type','jrn');
echo HtmlInput::get_to_hidden(array('exercice'));
echo '<TABLE ><TR>';
@ -171,22 +172,22 @@ if ( isset( $_REQUEST['bt_html'] ) )
HtmlInput::submit('bt_pdf',"Export PDF").
HtmlInput::hidden('act','PDF/ledger').
$hid->input("type","jrn").
$hid->input("p_action","impress").
$hid->input("jrn_id",$Jrn->id).
$hid->input("from_periode",$_GET['from_periode']).
$hid->input("to_periode",$_GET['to_periode']);
echo $hid->input("p_simple",$_GET['p_simple']);
echo HtmlInput::get_to_hidden(array('ac','type'));
echo "</form></TD>";
echo '<TD><form method="GET" ACTION="export.php">'.dossier::hidden().
HtmlInput::submit('bt_csv',"Export CSV").
HtmlInput::hidden('act','CSV/ledger').
$hid->input("type","jrn").
$hid->input("p_action","impress").
$hid->input("jrn_id",$Jrn->id).
$hid->input("from_periode",$_GET['from_periode']).
$hid->input("to_periode",$_GET['to_periode']);
echo $hid->input("p_simple",$_GET['p_simple']);
echo HtmlInput::get_to_hidden(array('ac','type'));
echo "</form></TD>";
echo "</TR>";

View file

@ -35,6 +35,7 @@ require_once('class_acc_operation.php');
//-----------------------------------------------------
require_once('class_database.php');
require_once('class_ipopup.php');
global $User;
echo IPoste::ipopup('ipop_account');
echo ICard::ipopup('ipopcard');
@ -49,7 +50,7 @@ echo $search_card->input();
echo '<div class="content">';
echo '<FORM action="?" METHOD="GET">';
echo HtmlInput::hidden('p_action','impress');
echo HtmlInput::hidden('ac',$_REQUEST['ac']);
echo HtmlInput::hidden('type','poste');
echo dossier::hidden();
echo '<TABLE><TR>';
@ -86,7 +87,7 @@ print '<TR>';
$date_from=new IDate('from_periode');
$date_to=new IDate('to_periode');
$year=$User->get_exercice();
$year=$g_user->get_exercice();
$date_from->value=(isset($_REQUEST['from_periode']))?$_REQUEST['from_periode']:"01.01.".$year;
$date_to->value=(isset($_REQUEST['to_periode']))?$_REQUEST['to_periode']:"31.12.".$year;
echo td(_('Depuis').$date_from->input());
@ -138,19 +139,18 @@ if ( isset( $_REQUEST['bt_html'] ) )
require_once("class_acc_account_ledger.php");
$go=0;
// we ask a poste_id
if ( isset($_GET['poste_id']) && strlen(trim($_GET['poste_id'])) != 0 )
if ( isset($_GET['poste_id']) && strlen(trim($_GET['poste_id'])) != 0 )
{
$poste=$cn->get_value('select format_account($1)',array($_GET['poste_id']));
if ( isset ($_GET['poste_fille']) )
{
$a_poste=$cn->get_array("select pcm_val from tmp_pcmn where pcm_val::text like $1||'%' order by pcm_val::text",array($poste));
$parent=$_GET['poste_id'];
$a_poste=$cn->get_array("select pcm_val from tmp_pcmn where pcm_val::text like '$parent%' order by pcm_val::text");
$go=3;
}
// Check if the post is numeric and exists
elseif ( $cn->count_sql('select * from tmp_pcmn where pcm_val=$1',array($poste)) != 0 )
elseif ( $cn->count_sql('select * from tmp_pcmn where pcm_val=$1',array($_GET['poste_id'])) != 0 )
{
$Poste=new Acc_Account_Ledger($cn,$poste);
$Poste=new Acc_Account_Ledger($cn,$_GET['poste_id']);
$go=1;
}
}

View file

@ -21,14 +21,14 @@
* \brief print first the report in html and propose to print it in pdf
* file included by user_impress
*
* some variable are already defined ($cn, $User ...)
* some variable are already defined ($cn, $g_user ...)
*/
require_once("class_ihidden.php");
require_once("class_iselect.php");
require_once("class_idate.php");
require_once("class_acc_report.php");
require_once('class_exercice.php');
global $g_user;
//-----------------------------------------------------
// If print is asked
// First time in html
@ -90,14 +90,14 @@ if ( isset( $_GET['bt_html'] ) )
echo '<TD><form method="GET" ACTION="?">'.
dossier::hidden().
HtmlInput::submit('bt_other',"Autre Rapport").
$hid->input("type","rapport").$hid->input("p_action","impress")."</form></TD>";
$hid->input("type","rapport").$hid->input("ac",$_GET['ac'])."</form></TD>";
echo '<TD><form method="GET" ACTION="export.php">'.
HtmlInput::submit('bt_pdf',"Export PDF").
HtmlInput::hidden('act','PDF/report').
dossier::hidden().
$hid->input("type","rapport").
$hid->input("p_action","impress").
$hid->input("ac",$_GET['ac']).
$hid->input("form_id",$Form->id);
if ( isset($_GET['from_periode'])) echo $hid->input("from_periode",$_GET['from_periode']);
if ( isset($_GET['to_periode'])) echo $hid->input("to_periode",$_GET['to_periode']);
@ -115,7 +115,7 @@ if ( isset( $_GET['bt_html'] ) )
HtmlInput::submit('bt_csv',"Export CSV").
dossier::hidden().
$hid->input("type","form").
$hid->input("p_action","impress").
$hid->input("ac",$_GET['ac']).
$hid->input("form_id",$Form->id);
if ( isset($_GET['from_periode'])) echo $hid->input("from_periode",$_GET['from_periode']);
if ( isset($_GET['to_periode'])) echo $hid->input("to_periode",$_GET['to_periode']);
@ -174,7 +174,7 @@ if ( sizeof($ret) == 0 )
// Form
//-----------------------------------------------------
echo '<div class="content">';
$exercice=(isset($_GET['exercice']))?$_GET['exercice']:$User->get_exercice();
$exercice=(isset($_GET['exercice']))?$_GET['exercice']:$g_user->get_exercice();
/*
* Let you change the exercice
@ -186,14 +186,14 @@ $ex=new Exercice($cn);
$wex=$ex->select('exercice',$exercice,' onchange="submit(this)"');
echo $wex->input();
echo dossier::hidden();
echo HtmlInput::get_to_hidden(array('p_action','type'));
echo HtmlInput::get_to_hidden(array('ac','type'));
echo '</form>';
echo '</fieldset>';
echo '<FORM METHOD="GET">';
$hidden=new IHidden();
echo $hidden->input("p_action","impress");
echo $hidden->input("ac",$_GET['ac']);
echo $hidden->input("type","rapport");
echo dossier::hidden();

View file

@ -25,12 +25,13 @@
*/
require_once ('class_acc_reconciliation.php');
require_once('function_javascript.php');
echo load_all_script();
global $g_user;
/**
*@file
*@todo add the export to PDF
*/
$aledger=$User->get_ledger('ALL',3);
$aledger=$g_user->get_ledger('ALL',3);
echo '<div class="noprint">';
echo '<div class="content">';
$rjrn='';
@ -38,13 +39,13 @@ $radio=new IRadio('choice');
$choice=(isset($_GET['choice']))?$_GET['choice']:0;
$r_jrn=(isset($_GET['r_jrn']))?$_GET['r_jrn']:'';
echo '<form method="GET">';
echo dossier::hidden().HtmlInput::hidden('p_action','impress').HtmlInput::hidden('type','rec');
echo dossier::hidden().HtmlInput::hidden('ac',$_GET['ac']).HtmlInput::hidden('type','rec');
echo 'Filtre par journal :'.HtmlInput::select_ledger($aledger,$r_jrn );
echo '<br/>';
/*
* Limit by date, default current exercice
*/
list($start,$end)=$User->get_limit_current_exercice();
list($start,$end)=$g_user->get_limit_current_exercice();
$dstart=new IDate('p_start');
$dstart->value=(isset($_REQUEST['p_start']))?$_REQUEST['p_start']:$start;
@ -105,7 +106,6 @@ default:
echo "Choix invalid";
exit();
}
$gDossier=Dossier::id();
require_once('template/impress_reconciliation.php');
exit();
exit();
exit();

View file

@ -30,7 +30,7 @@ echo '<div class="content">';
echo '<div id="search">';
echo '<FORM METHOD="GET">';
echo dossier::hidden();
echo HtmlInput::hidden('p_action','let');
echo HtmlInput::hidden('ac',$_REQUEST['ac']);
echo HtmlInput::hidden('sa','poste');
echo '<table width="50%">';
@ -49,7 +49,7 @@ $r= td(_('Lettrage pour le poste comptable ')).
td($poste_span->input());
echo tr($r);
// limit of the year
$exercice=$User->get_exercice();
$exercice=$g_user->get_exercice();
$periode=new Periode($cn);
list($first_per,$last_per)=$periode->get_limit($exercice);

View file

@ -31,7 +31,7 @@ echo '<div class="content">';
echo '<div id="search">';
echo '<FORM METHOD="GET">';
echo dossier::hidden();
echo HtmlInput::hidden('p_action','let');
echo HtmlInput::hidden('ac',$_REQUEST['ac']);
echo HtmlInput::hidden('sa','qc');
echo HtmlInput::hidden('p_jrn','0');
echo '<table width="50%">';
@ -52,7 +52,7 @@ $r= td(_('Lettrage pour la fiche ')).
td($poste_span->input());
echo tr($r);
// limit of the year
$exercice=$User->get_exercice();
$exercice=$g_user->get_exercice();
$periode=new Periode($cn);
list($first_per,$last_per)=$periode->get_limit($exercice);

View file

@ -1,10 +1,11 @@
<?php
require_once('class_lettering.php');
global $g_user;
echo '<div class="content">';
echo '<div id="search">';
echo '<FORM METHOD="GET">';
echo dossier::hidden();
echo HtmlInput::hidden('p_action',$_REQUEST['p_action']);
echo HtmlInput::hidden('ac',$_REQUEST['ac']);
echo HtmlInput::hidden('sb',$_REQUEST['sb']);
echo HtmlInput::hidden('sc',$_REQUEST['sc']);
echo HtmlInput::hidden('f_id',$_REQUEST['f_id']);
@ -12,7 +13,7 @@ echo HtmlInput::hidden('f_id',$_REQUEST['f_id']);
echo '<table width="50%">';
// limit of the year
$exercice=$User->get_exercice();
$exercice=$g_user->get_exercice();
$periode=new Periode($cn);
list($first_per,$last_per)=$periode->get_limit($exercice);

View file

@ -19,7 +19,7 @@
/* $Revision$ */
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
require_once 'user_menu.php';
/*!\file
* \brief The opening of the exercices. it takes the saldo of the
* choosen foolder / exercice and import it as a misc operation in the
@ -48,7 +48,7 @@ if ($sa == '')
exit();
}
echo '<form class="print" method="post">';
echo HtmlInput::hidden('p_action','ouv');
echo HtmlInput::hidden('ac',$_REQUEST['ac']);
echo HtmlInput::hidden('sa','step2');
echo dossier::hidden();
$wAvail=new ISelect();
@ -74,7 +74,7 @@ if ($sa == '')
/* --------------------------------------------------
* Step 2 choose now the exercice of this folder
*/
$back='user_advanced.php?p_action=ouv&'.dossier::get();
$back='do.php?ac='.$_REQUEST['ac'].'&'.dossier::get();
if ( $sa=='step2')
{
echo '<div class="content">'.
@ -83,7 +83,7 @@ if ( $sa=='step2')
'<form class="print" method="post">'.
' Choississez l\'exercice du dossier ';
echo dossier::hidden();
echo HtmlInput::hidden('p_action','ouv');
echo HtmlInput::hidden('ac',$_REQUEST['ac']);
echo HtmlInput::hidden('sa','step3');
echo HtmlInput::hidden('f',$_REQUEST['f']);
$cn=new Database($_REQUEST['f']);
@ -131,9 +131,10 @@ if ( $sa == 'step3')
$wLedger->value=$array;
echo $wLedger->input('p_jrn');
echo HtmlInput::submit('ok','Continuer');
echo HtmlInput::hidden('ac',$_REQUEST['ac']);
echo dossier::hidden();
echo "</form>";
echo HtmlInput::button_anchor('Retour',$back);
echo HtmlInput::button_anchor('Retour',$back.'&sa=step2&f='.$_REQUEST['f']);
exit(0);
}
@ -171,8 +172,9 @@ if ( $sa=='step4')
$cn=new Database(dossier::id());
$User=new User($cn);
$jrn=new Acc_Ledger($cn,$_REQUEST['p_jrn']);
echo '<form class="print" method="post" action="compta.php">';
echo HtmlInput::hidden('p_action','quick_writing');
echo '<form class="print" method="post" action="do.php">';
echo HtmlInput::hidden('ac',$_REQUEST['ac']);
echo HtmlInput::hidden('sa','step5');
echo dossier::hidden();
echo HtmlInput::hidden('p_jrn',$_REQUEST['p_jrn']);
echo $jrn->show_form($result,0);
@ -184,3 +186,13 @@ if ( $sa=='step4')
echo '</div>';
}
// if sa=step4 then record it
//
/*
* @todo finir les ouvertures d'année
*/
if ( $_REQUEST['sa']=='step5')
{
echo "<h2> A ENREGISTRER</H2>";
}

View file

@ -88,7 +88,7 @@ $User->can_request(PARPCMN);
echo '<div class="lmenu">';
ShowMenuPcmn($_SESSION['g_start']);
menu_acc_plan($_SESSION['g_start']);
echo '</div>';
echo '<DIV CLASS="u_redcontent">';
/* Analyse ce qui est demandé */
@ -304,7 +304,7 @@ for ($i=0; $i <$MaxRow; $i++)
echo $td;
printf ('<A href="?p_action=pcmn&l=%s&action=del&%s">Delete</A>',$A['pcm_val'],$str_dossier);
printf ('<A href="?ac='.$_REQUEST['ac'].'&l=%s&action=del&%s">Efface</A>',$A['pcm_val'],$str_dossier);
echo "</TD>";

View file

@ -33,7 +33,7 @@ $eth='</th>';
/*!\file
* \brief payment mode
*/
$sb=HtmlInput::default_value('sb', "", $_REQUEST);
echo '<div class="content">';
//----------------------------------------------------------------------
@ -44,7 +44,7 @@ if ( $sb=='change')
$row=new Acc_Payment($cn,$_GET['id']);
$row->load();
$javascript="return confirm('"._('Vous confirmez')."')";
echo '<form method="post" action="parametre.php" onsubmit="'.$javascript.'">';
echo '<form method="post" onsubmit="'.$javascript.'">';
echo dossier::hidden();
echo HtmlInput::hidden('p_jrn',0);
echo HtmlInput::hidden('p_action','divers');
@ -90,7 +90,7 @@ if ($sb=='ins')
$r=$mp->blank();
echo '<form method="POST">';
echo dossier::hidden().HtmlInput::hidden('sa',$_REQUEST['sa']).
HtmlInput::hidden('p_action',$_REQUEST['p_action']).HtmlInput::hidden('sb','insert');
HtmlInput::hidden('ac',$_REQUEST['ac']).HtmlInput::hidden('sb','insert');
echo $r;
echo HtmlInput::submit('insert',_('Enregistre'));
echo '</form>';
@ -130,7 +130,7 @@ if ( ! empty ($array))
{
echo $tr;
echo $row->row();
echo $td.HtmlInput::button_anchor(_('Modifie'),'?p_action=divers&sa=mp&sb=change&'.dossier::get().
echo $td.HtmlInput::button_anchor(_('Modifie'),'?ac='.$_REQUEST['ac'].'&sa=mp&sb=change&'.dossier::get().
'&id='.$row->get_parameter('id'));
echo $etr;

View file

@ -38,7 +38,7 @@ if ($choose=='Valider') $choose='yes';
if ( isset ($_POST["add_per"] ))
{
$User->can_request(PARPER,1);
$g_user->can_request(PARPER,1);
extract($_POST);
$obj=new Periode($cn);
if ( $obj->insert($p_date_start,$p_date_end,$p_exercice) == 1 )
@ -50,7 +50,7 @@ if ( isset ($_POST["add_per"] ))
}
if (isset($_POST['add_exercice']))
{
$User->can_request(PARPER,1);
$g_user->can_request(PARPER,1);
$obj=new Periode($cn);
$exercice=$cn->get_value('select max(p_exercice::float)+1 from parm_periode');
if ( $obj->insert_exercice($exercice) == 1 )
@ -62,7 +62,7 @@ if (isset($_POST['add_exercice']))
}
if ( $action=="closed")
{
$User->can_request(PARCLO);
$g_user->can_request(PARCLO);
$p_per=$_GET['p_per'];
$per=new Periode($cn);
$jrn_def_id=(isset($_GET['jrn_def_id']))?$_GET['jrn_def_id']:0;
@ -74,7 +74,7 @@ if ( $action=="closed")
if ( $action== "delete_per" )
{
$User->can_request(PARPER);
$g_user->can_request(PARPER);
$p_per=$_GET["p_per"];
// Check if the periode is not used
if ( $cn->count_sql("select * from jrnx where j_tech_per=$p_per") != 0 )
@ -87,9 +87,9 @@ if ( $action== "delete_per" )
}
$choose="yes";
}
if ( $action == 'reopen')
if ( $action == 'reopen')
{
$User->can_request(PARCLO);
$g_user->can_request(PARCLO);
$jrn_def_id=(isset($_GET['jrn_def_id']))?$_GET['jrn_def_id']:0;
$per=new Periode($cn);
$jrn_def_id=(isset($_GET['jrn_def_id']))?$_GET['jrn_def_id']:0;
@ -101,7 +101,7 @@ if ( $action == 'reopen')
}
if ( $choose=="yes" )
{
echo HtmlInput::button_anchor('Autre Journal ?','?choose=no&p_action=periode&gDossier='.dossier::id());
echo HtmlInput::button_anchor('Autre Journal ?','?choose=no&ac='.$_REQUEST['ac'].'&gDossier='.dossier::id());
$per=new Periode($cn);
$jrn=(isset($_GET['jrn_def_id']))?$_GET['jrn_def_id']:0;
$per->set_jrn($jrn);
@ -111,7 +111,7 @@ if ( $choose=="yes" )
}
else
{
echo '<form method="GET" action="?">';
echo '<form method="GET" >';
echo dossier::hidden();
$sel_jrn=$cn->make_array("select jrn_def_id, jrn_def_name from ".
" jrn_def order by jrn_def_name");
@ -121,7 +121,7 @@ else
$wSel->name='jrn_def_id';
echo "Choississez global ou uniquement le journal à fermer".$wSel->input();
echo HtmlInput::submit('choose','Valider');
echo HtmlInput::hidden('p_action','periode');
echo HtmlInput::hidden('ac',$_REQUEST['ac']);
echo "</form>";
echo '<p class="info"> Pour ajouter, effacer ou modifier une p&eacute;riode, il faut choisir global</p>';
}

View file

@ -15,13 +15,13 @@
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
*/
/* $Revision$ */
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
/*!\file
/* !\file
* \brief this file is always included and then executed
* it permits to change the user preferences
*\see user_pref.php
* \see user_pref.php
*/
require_once('class_user.php');
@ -32,214 +32,213 @@ require_once('class_periode.php');
echo '<DIV class="content">';
//----------------------------------------------------------------------
// Change password
if ( isset($_POST['pass_1'])
&& strlen(trim($_POST['pass_1'])) != 0 )
if ( isset ($_POST['val']))
{
if ($_POST['pass_1'] != $_POST['pass_2'] )
/*
* @todo save the preference
*/
var_dump($_POST);
}
if (isset($_POST['pass_1'])
&& strlen(trim($_POST['pass_1'])) != 0)
{
if ($_POST['pass_1'] != $_POST['pass_2'])
{
alert(_("Les mots de passe ne correspondent pas. Mot de passe inchangé"));
alert(_("Les mots de passe ne correspondent pas. Mot de passe inchangé"));
}
else
{
$Rep=new Database();
$l_pass=md5($_POST['pass_1']);
$Res=$Rep->exec_sql("update ac_users set use_pass='$l_pass' where use_login='".$_SESSION['g_user']."'");
$pass=$_POST['pass_1'];
$_SESSION['g_pass']=$_POST['pass_1'];
$g_pass=$_POST['pass_1'];
echo "<i>"._('Mot de passe est modifiée')."</i>";
$Rep = new Database();
$l_pass = md5($_POST['pass_1']);
$Res = $Rep->exec_sql("update ac_users set use_pass='$l_pass' where use_login='" . $_SESSION['g_user'] . "'");
$pass = $_POST['pass_1'];
$_SESSION['g_pass'] = $_POST['pass_1'];
$g_pass = $_POST['pass_1'];
echo "<i>" . _('Mot de passe est modifiée') . "</i>";
}
}
$url=$_SERVER['REQUEST_URI'];
if ( ! isset ($_REQUEST['gDossier']) )
if (!isset($_REQUEST['gDossier']))
{
echo HtmlInput::button_anchor(_('Retour'),'user_login.php?');
echo HtmlInput::button_anchor(_('Retour'), 'user_login.php?');
}
else
{
echo '<h2 class="info2">'._('Changez vos préférences').'</h2>';
echo '<h2 class="info2">' . _('Changez vos préférences') . '</h2>';
}
?>
<div class="content">
<FORM ACTION="<?php echo $url;?>" METHOD="POST">
<fieldset><legend><?php echo _('Options Générales')?></legend>
<table>
<tr><td>
Mot de passe :
<td><input type="password" value="" class="input_type" name="pass_1">
<input type="password" value="" class="input_type" name="pass_2">
</td>
</tr>
<?php
$Rep=new Database();
// charge tous les styles
$res=$Rep->exec_sql("select the_name from theme
order by the_name");
for ($i=0;$i < Database::num_row($res);$i++)
{
$st=Database::fetch_array($res,$i);
$style[]=$st['the_name'];
}
// Formatte le display
$disp_style="<SELECT NAME=\"style_user\" >";
foreach ($style as $st)
{
if ( $st == $_SESSION['g_theme'] )
{
$disp_style.='<OPTION VALUE="'.$st.'" SELECTED>'.$st;
}
else
{
$disp_style.='<OPTION VALUE="'.$st.'">'.$st;
}
}
$disp_style.="</SELECT>";
?>
<p>
<tr>
<td>
<?php echo _('Thème');
?>
</td>
<td>
<?php print $disp_style;
?>
</td>
</tr>
<FORM METHOD="POST">
<fieldset><legend><?php echo _('Options Générales')?></legend>
<table>
<tr><td>
Mot de passe :
</td>
<td><input type="password" value="" class="input_type" name="pass_1" nohistory>
<input type="password" value="" class="input_type" name="pass_2" nohistory>
</td>
</tr>
<?php
$inside_dossier=false;
$Rep = new Database();
// charge tous les styles
$res = $Rep->exec_sql("select the_name from theme
order by the_name");
$astyle = array();
for ($i = 0; $i < Database::num_row($res); $i++)
{
$st = Database::fetch_array($res, $i);
$astyle[] = $st['the_name'];
}
// Formatte le display
$disp_style = "<SELECT NAME=\"style_user\" >";
foreach ($astyle as $st)
{
if ($st == $_SESSION['g_theme'])
{
$disp_style.='<OPTION VALUE="' . $st . '" SELECTED>' . $st;
}
else
{
$disp_style.='<OPTION VALUE="' . $st . '">' . $st;
}
}
$disp_style.="</SELECT>";
?>
<p>
<tr>
<td>
<?php echo _('Thème');
?>
</td>
<td>
<?php print $disp_style;
?>
</td>
</tr>
<?php
global $g_user;
$inside_dossier = false;
// Si utilise un dossier alors propose de changer
// la periode par defaut
if ( isset ($_REQUEST['gDossier']))
{
$inside_dossier=true;
$msg="";
$cn=new Database($_REQUEST['gDossier']);
$User->cn=$cn;
if (isset($_REQUEST['gDossier']))
{
$inside_dossier = true;
$msg = "";
$cn = new Database($_REQUEST['gDossier']);
$g_user->cn = $cn;
if ( isset ($_POST['period']))
{
$periode=$_POST["period"];
$User->set_periode($periode);
}
if (isset($_POST['period']))
{
$periode = $_POST["period"];
$g_user->set_periode($periode);
}
$l_user_per=$User->get_periode();
if ( $l_user_per=="")
$l_user_per=$cn->get_value("select min(p_id) from parm_periode where p_closed='f'");
$l_user_per = $g_user->get_periode();
if ($l_user_per == "")
$l_user_per = $cn->get_value("select min(p_id) from parm_periode where p_closed='f'");
// if periode is closed then warns the users
$period=new Periode($cn,$l_user_per);
// if periode is closed then warns the users
$period = new Periode($cn, $l_user_per);
$period->p_id=$l_user_per;
$period->jrn_def_id=0;
if ( $period->is_closed($l_user_per)==1)
{
$msg=_('Attention cette période est fermée, vous ne pourrez rien modifier dans le module comptable');
$msg= '<h2 class="notice">'.$msg.'</h2>';
}
$period->p_id = $l_user_per;
$period->jrn_def_id = 0;
if ($period->is_closed($l_user_per) == 1)
{
$msg = _('Attention cette période est fermée, vous ne pourrez rien modifier dans le module comptable');
$msg = '<h2 class="notice">' . $msg . '</h2>';
}
$period=new IPeriod("period");
$period->user=$User;
$period->cn=$cn;
$period->filter_year=false;
$period->value=$l_user_per;
$period->type=ALL;
$l_form_per=$period->input();
$period = new IPeriod("period");
$period->user = $g_user;
$period->cn = $cn;
$period->filter_year = false;
$period->value = $l_user_per;
$period->type = ALL;
$l_form_per = $period->input();
?>
<tr><td><?php echo _('Période');
?></td>
<td>
<?php printf(' %s ', $l_form_per);?>
</td>
<td> <?php echo $msg;?></td>
<?php
}
?>
?>
<tr><td><?php echo _('Période');
?></td>
<td>
<?php printf(' %s ',$l_form_per);
?>
</td>
<td> <?php echo $msg;
?></td>
<?php
}
?>
<tr>
<td><? echo _('Taille des pages');
?></td>
<td>
<SELECT NAME="p_size">
<option value="15">15
<option value="25">25
<option value="50">50
<option value="100">100
<option value="150">150
<option value="200">200
<option value="-1"><?php echo _('Illimité');
?>
<tr>
<td><? echo _('Taille des pages');
?></td>
<td>
<SELECT NAME="p_size">
<option value="15">15
<option value="25">25
<option value="50">50
<option value="100">100
<option value="150">150
<option value="200">200
<option value="-1"><?php echo _('Illimité');?>
<?php
$label=($_SESSION['g_pagesize'] == -1)?_('Illimité'):$_SESSION['g_pagesize'];
echo '<option value="'.$_SESSION['g_pagesize'].'" selected>'.$label;
$label = ($_SESSION['g_pagesize'] == -1) ? _('Illimité') : $_SESSION['g_pagesize'];
echo '<option value="' . $_SESSION['g_pagesize'] . '" selected>' . $label;
?>
</SELECT>
</SELECT>
</td>
</tr>
</table>
</fieldset>
</td>
</tr>
</table>
</fieldset>
<?php
if ( $inside_dossier )
if ($inside_dossier)
{
/* Pref for welcome page */
echo '<fieldset>';
echo '<legend>'._('Options pour la page d\'accueil').'</legend>';
echo '<legend>' . _('Options pour la page d\'accueil') . '</legend>';
echo _('Mini-Rapport : ');
$rapport=new Acc_Report($cn);
$aRapport=$rapport->make_array();
$aRapport[]=array("value"=>0,"label"=>_('Aucun mini rapport'));
$wRapport=new ISelect();
$wRapport->name="minirap";
$wRapport->selected=$User->get_mini_report();
$wRapport->value=$aRapport;
$rapport = new Acc_Report($cn);
$aRapport = $rapport->make_array();
$aRapport[] = array("value" => 0, "label" => _('Aucun mini rapport'));
$wRapport = new ISelect();
$wRapport->name = "minirap";
$wRapport->selected = $g_user->get_mini_report();
$wRapport->value = $aRapport;
echo $wRapport->input();
echo '<span class="notice">'._('Le mini rapport est un rapport qui s\'affiche sur votre page d\'accueil').'</span>';
echo '<span class="notice">' . _('Le mini rapport est un rapport qui s\'affiche sur votre page d\'accueil') . '</span>';
echo '</fieldset>';
}
echo '<fieldset>';
echo '<legend>'._('Langue').'</legend>';
echo '<legend>' . _('Langue') . '</legend>';
echo _('Selectionnez votre langue');
$aLang=array(array(_('Français'),'fr_FR.utf8'),
array(_('Anglais'),'en_US.utf8'),
array(_('Néerlandais'),'nl_NL.utf8'),
);
$aLang = array(array(_('Français'), 'fr_FR.utf8'),
array(_('Anglais'), 'en_US.utf8'),
array(_('Néerlandais'), 'nl_NL.utf8'),
);
echo '<select name="lang" id="l">';
for ($i =0;$i < count($aLang);$i++)
for ($i = 0; $i < count($aLang); $i++)
{
$sel="";
if ( $aLang[$i][1]==$_SESSION['g_lang']) $sel=" selected ";
printf('<option value="%s" %s>%s</option>',
$aLang[$i][1],$sel,$aLang[$i][0]);
$sel = "";
if ($aLang[$i][1] == $_SESSION['g_lang'])
$sel = " selected ";
printf('<option value="%s" %s>%s</option>', $aLang[$i][1], $sel, $aLang[$i][0]);
}
echo '</select>';
echo '</fieldset>';
echo HtmlInput::submit("val",_("Valider"));
echo HtmlInput::submit("val", _("Valider"));
echo '</form>';
if ( ! $inside_dossier )
if (!$inside_dossier)
{
echo HtmlInput::button_anchor(_('Retour'),'user_login.php?');
echo HtmlInput::button_anchor(_('Retour'), 'user_login.php?');
}

View file

@ -45,7 +45,7 @@ echo 'Choississez un journal '.$sel->input();
echo dossier::hidden();
$hid=new IHidden();
echo $hid->input("sa","jrn");
echo $hid->input("p_action","preod");
echo $hid->input("ac",$_REQUEST['ac']);
echo '<hr>';
echo HtmlInput::submit('Accepter','Accepter');
echo '</form>';
@ -96,7 +96,7 @@ if ( $sa == 'jrn' )
echo '<form method="POST" style="margin:0;padding:0">';
echo dossier::hidden();
echo $hid->input("sa","del");
echo $hid->input("p_action","preod");
echo $hid->input("ac",$_REQUEST['ac']);
echo $hid->input("del","");
echo $hid->input("od_id",$row['od_id']);
echo $hid->input("jrn",$_GET['jrn']);

View file

@ -34,28 +34,15 @@ $gDossier=dossier::id();
html_page_start($_SESSION['g_theme']);
require_once('class_database.php');
/* Admin. Dossier */
$gDossier=dossier::id();
$cn=new Database($gDossier);
include_once ("class_user.php");
$User=new User($cn);
$User->Check();
global $g_user;
$href=basename($_SERVER['PHP_SELF']);
if ($href=='compta.php')
{
//Show the top menu
include_once ("user_menu.php");
// Show Menu Left
$left_menu=ShowMenuAdvanced(5);
//echo '<div class="lmenu">';
echo $left_menu;
}
// Get The priv on the selected folder
$User->can_request(STOLE,1);
$g_user->can_request(STOLE,1);
$action= ( isset ($_GET['action']))? $_GET['action']:"";
@ -64,7 +51,7 @@ include_once("stock_inc.php");
// Adjust the stock
if ( isset ($_POST['sub_change']))
{
$User->can_request(STOWRITE,1);
$g_user->can_request(STOWRITE,1);
$change=$_POST['stock_change'];
$sg_code=$_POST['sg_code'];
$sg_date=$_POST['sg_date'];
@ -82,7 +69,7 @@ if ( isset ($_POST['sub_change']))
else
{
// Check if User Can change the stock
if ( $User->check_action($gDossier,GESTOCK) == 0 )
if ( $g_user->check_action($gDossier,GESTOCK) == 0 )
{
NoAccess();
exit (-1);
@ -126,7 +113,7 @@ if ( isset ($_POST['sub_change']))
if ( ! isset ($_GET['year']) )
{
// get defaut periode
$a=$User->get_periode();
$a=$g_user->get_periode();
// get exercice of periode
$periode=new Periode($cn,$a);
$year=$periode->get_exercice();
@ -141,11 +128,11 @@ else
if ( $action == 'detail' )
{
// Check if User Can see the stock
$User->can_request(STOLE,1);
$g_user->can_request(STOLE,1);
$sg_code=(isset ($_GET['sg_code'] ))?$_GET['sg_code']:$_POST['sg_code'];
$year=(isset($_GET['year']))?$_GET['year']:$_POST['year'];
$a=ViewDetailStock($cn,$sg_code,$year);
$write=$User->check_action(STOWRITE);
$write=$g_user->check_action(STOWRITE);
$b="";
@ -159,16 +146,16 @@ if ( $action == 'detail' )
echo '<fieldset><legend>';
echo 'Entrer la valeur qui doit augmenter ou diminuer le stock';
echo '</legend>';
echo '<form action="?p_action=stock" method="POST">';
echo '<form action="?ac='.$_GET['ac'].'" method="POST">';
echo ChangeStock($sg_code,$year);
echo HtmlInput::submit("sub_change" ,"Valider");
echo dossier::hidden();
echo HtmlInput::button_anchor('Retour','?p_action=stock&'.dossier::get());
echo HtmlInput::button_anchor('Retour','?ac='.$_REQUEST['ac'].'&'.dossier::get());
echo '</form>';
echo '</fieldset>';
}
else
echo HtmlInput::button_anchor('Retour','?p_action=stock&'.dossier::get());
echo HtmlInput::button_anchor('Retour','?ac='.$_REQUEST['ac'].'&'.dossier::get());
echo '</div>';
@ -185,7 +172,7 @@ $r="";
for ( $i = 0; $i < Database::num_row($Res);$i++)
{
$l=Database::fetch_array($Res,$i);
$url=sprintf("?p_action=stock&year=%d&".dossier::get(),
$url=sprintf("?ac=".$_REQUEST['ac']."&year=%d&".dossier::get(),
$l['exercice']);
$r.=HtmlInput::button_anchor($l['exercice'],$url);
}

View file

@ -29,7 +29,7 @@
* - $cn = database connection
*/
require_once('class_action.php');
$User->can_request(GECOUR);
$g_user->can_request(GECOUR);
/**
*\note fix problem with ShowActionList, this function is local

View file

@ -29,7 +29,7 @@
* - $cn = database connection
*/
require_once('class_action.php');
$User->can_request(GECOUR);
$g_user->can_request(GECOUR);
/**
*\note problem with ShowActionList, this function is local

View file

@ -30,12 +30,13 @@ require_once('class_fiche_def.php');
require_once('class_iaction.php');
require_once('class_fiche_def.php');
require_once('class_ipopup.php');
global $g_user;
$low_action=(isset($_REQUEST['sb']))?$_REQUEST['sb']:"list";
/*! \file
* \brief Called from the module "Gestion" to manage the supplier
*/
$User->can_request(GECUST);
$g_user->can_request(GECUST);
$href=basename($_SERVER['PHP_SELF']);
// by default open liste
@ -48,7 +49,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;
@ -90,7 +91,7 @@ if ( $low_action == "list" )
?>
<input type="submit" class="button" name="submit_query" value="<?=_('recherche')?>">
<input type="hidden" name="p_action" value="supplier">
<input type="hidden" name="ac" value="<?=$_REQUEST['ac']?>">
</form>
</span>
<?php
@ -133,7 +134,7 @@ if ( $low_action == "list" )
}
/*----------------------------------------------------------------------
* Detail for a card, Suivi, Contact, Operation,... *
* cc stands for supplier card
* cc stands for supplier card
*----------------------------------------------------------------------*/
if ( $low_action == 'detail')
{
@ -145,7 +146,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;

View file

@ -30,7 +30,6 @@ endfor;
</table>
<?
echo dossier::hidden();
echo HtmlInput::hidden('p_action',$_REQUEST['p_action']);
echo HtmlInput::hidden('sa',$_REQUEST['sa']);
echo HtmlInput::hidden('ac',$_REQUEST['ac']);
?>
</form>

57
include/template/menu.php Normal file
View file

@ -0,0 +1,57 @@
<div class="topmenu">
<? if ( count($amenu) > 4 && $idx == 0) :
$width = 100;
?>
<table style="width:<?=$width?>%">
<? else:
?>
<table>
<? endif;?>
<tr>
<?php
global $g_user;
// Display the menu
for($i=0;$i < count($amenu);$i++):
if ( isset($module[$idx+1]) && $module[$idx+1]==$amenu[$i]['me_code']):
$class="selectedcell";
?>
<td class="<?=$class?>">
<a class="mtitle" href="do.php?gDossier=<?=Dossier::id()?>&ac=<?=$_REQUEST['ac']?>">
<?=$amenu[$i]['me_menu']?>
</a>
</td>
<?
else:
$class="mtitle";
$url="";$pt="";
for ($e=0;$e <= $idx;$e++):
$url.=$pt.$module[$e];
$pt="/";
endfor;
$url.=$pt.$amenu[$i]['me_code'];
?> <td class="<?=$class?>">
<a class="mtitle" href="do.php?gDossier=<?=Dossier::id()?>&ac=<?=$url?>">
<?=$amenu[$i]['me_menu']?>
</a>
</td>
<?
endif;
?>
<?
endfor;
?>
</tr>
</table>
</div>
<?php
// if something is selected check if file to include or submen
//
?>

View file

@ -1,8 +1,8 @@
<div style="float:right">
<A style="background-color:blue;color:white;text-decoration:none" HREF="javascript:void(0)" onclick="removeDiv('mod_doc');">Fermer</A>
<A style="background-color:blue;color:white;text-decoration:none" HREF="javascript:void(0)" onclick="removeDiv('mod_doc');">Fermer</A>
</div>
<h2 class="info">Modèle de document</h2>
<form action="parametre.php" method="post" enctype="multipart/form-data">
<form method="post" enctype="multipart/form-data">
<table>
<tr>
@ -84,7 +84,7 @@ $last=0;
if ( $cn->exist_sequence("seq_doc_type_".$doc->md_type) )
{
$ret= $cn->get_array("select last_value,is_called from seq_doc_type_".$doc->md_type) ;
$last=$ret[0]['last_value'];
/*!
*\note With PSQL sequence , the last_value column is 1 when before AND after the first call, to make the difference between them

View file

@ -0,0 +1,40 @@
<div class="u_tool">
<div class="name">
<H2 class="dossier"> Dossier : <?=h(dossier::name())?></h2>
<?=IButton::show_calc()?>
</div>
<div class="acces_direct">
<table>
<tr>
<?php
foreach ($amodule as $row):
$style="background:white";
if ( $row['me_menu']=='new_line')
{
echo "</tr><tr>";
continue;
}
if ($row['me_code']==$selected)
{
$style="background:red";
}
if ( $row['me_url']!='')
{
$url=$row['me_url'];
}
else
{
$url="do.php?gDossier=".Dossier::id()."&ac=".$row['me_code'];
}
?>
<td class="tool" style="<?=$style?>"><a class="mtitle" href="<?=$url?>"><?=$row['me_menu']?></td>
<?
endforeach;
?>
</tr>
</table>
</div>
</div>

View file

@ -1,12 +1,12 @@
<fieldset><legend>Ajout d'un exercice</legend>
Ajout d'un exercice comptable de 13 périodes, commençant le 1 janvier jusqu'au 31 décembre
Ajout d'un exercice comptable de 13 périodes, commençant le 1 janvier jusqu'au 31 décembre
<form method="post" onsubmit="return confirm('Confirmez vous l\'ajout d\'un exercice comptable ?')">
<?
echo HtmlInput::hidden("p_action",$_REQUEST['p_action']);
echo HtmlInput::hidden("ac",$_REQUEST['ac']);
echo HtmlInput::hidden("jrn_def_id","0");
echo HtmlInput::hidden("jrn_def_id","0");
echo Dossier::hidden();
echo HtmlInput::submit("add_exercice","Ajout d'un exercice comptable");
echo HtmlInput::submit("add_exercice","Ajout d'un exercice comptable");
?>
</form>

View file

@ -27,6 +27,7 @@ include_once ("user_common.php");
include_once("class_user.php");
require_once("class_iselect.php");
require_once('class_acc_ledger.php');
$gDossier=Dossier::id();
$cn=new Database($gDossier);
require_once('class_iposte.php');
@ -41,6 +42,10 @@ if ( !isset($_REQUEST['p_jrn']))
}
else
$Ledger->id=$_REQUEST['p_jrn'];
/*
* @todo usefull ?
*/
$_GET['ledger_type']='ALL';
echo $Ledger->display_search_form();
echo '<hr>';
/* compute the sql stmt */
@ -54,7 +59,7 @@ $offset=(isset($_GET['offset']))?$_GET['offset']:0;
$bar=jrn_navigation_bar($offset,$max_line,$step,$page);
echo HtmlInput::request_to_hidden(array('sa','sb','sc','f_id','p_action'));
echo HtmlInput::request_to_hidden(array('sa','sb','sc','f_id','ac'));
echo dossier::hidden();
echo $bar;

View file

@ -142,7 +142,7 @@ function GetAvailableFolder($p_user,$p_admin,$p_filter="")
* \return string
*
*/
function ShowMenuCompta($p_high="")
function ShowMenuCompta_deprecated($p_high="")
{
require_once('class_database.php');
@ -227,7 +227,7 @@ function ShowMenuCompta($p_high="")
*
* \return the menu
*/
function ShowMenuAdvanced($default="")
function ShowMenuAdvanced_deprecated($default="")
{
$str_dossier=dossier::get();
// Show the left menu
@ -257,7 +257,8 @@ function ShowMenuAdvanced($default="")
function ShowMenuFiche($p_dossier)
{
$cn=new Database($p_dossier);
$str_dossier=dossier::get();
$mod="&ac=".$_REQUEST['ac'];
$str_dossier=dossier::get().$mod;
echo '<div class="lmenu">';
echo '<TABLE>';
@ -402,20 +403,21 @@ function MenuJrn()
*
*/
function ShowMenuPcmn($p_start=1)
function menu_acc_plan($p_start=1)
{
$base="?ac=".$_REQUEST['ac'];
$str_dossier="&".dossier::get();
echo '<TABLE>';
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="?p_action=pcmn&p_start=0'.$str_dossier.'">0'._(' Hors Bilan').' </A></TD></TR>';
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="?p_action=pcmn&p_start=1'.$str_dossier.'">1'._(' Immobilisé').' </A></TD></TR>';
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="?p_action=pcmn&p_start=2'.$str_dossier.'">2 '._('Actif a un an au plus').'</A></TD></TR>';
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="?p_action=pcmn&p_start=3'.$str_dossier.'">3 '._('Stock et commande').'</A></TD></TR>';
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="?p_action=pcmn&p_start=4'.$str_dossier.'">4 '._('Compte tiers').'</A></TD></TR>';
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="?p_action=pcmn&p_start=5'.$str_dossier.'">5'._('Actif').'</A></TD></TR>';
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="?p_action=pcmn&p_start=6'.$str_dossier.'">6'._('Charges').'</A></TD></TR>';
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="?p_action=pcmn&p_start=7'.$str_dossier.'">7'._('Produits').'</A></TD></TR>';
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="?p_action=pcmn&p_start=8'.$str_dossier.'">8'._('Hors Comptabilité').'</A></TD></TR>';
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="?p_action=pcmn&p_start=9'.$str_dossier.'">9 '._('Hors Comptabilité').'</A></TD></TR>';
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="'.$base.'&p_start=0'.$str_dossier.'">0'._(' Hors Bilan').' </A></TD></TR>';
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="'.$base.'&p_start=1'.$str_dossier.'">1'._(' Immobilisé').' </A></TD></TR>';
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="'.$base.'&p_start=2'.$str_dossier.'">2 '._('Actif a un an au plus').'</A></TD></TR>';
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="'.$base.'&p_start=3'.$str_dossier.'">3 '._('Stock et commande').'</A></TD></TR>';
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="'.$base.'&p_start=4'.$str_dossier.'">4 '._('Compte tiers').'</A></TD></TR>';
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="'.$base.'&p_start=5'.$str_dossier.'">5'._('Actif').'</A></TD></TR>';
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="'.$base.'&p_start=6'.$str_dossier.'">6'._('Charges').'</A></TD></TR>';
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="'.$base.'&p_start=7'.$str_dossier.'">7'._('Produits').'</A></TD></TR>';
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="'.$base.'&p_start=8'.$str_dossier.'">8'._('Hors Comptabilité').'</A></TD></TR>';
echo '<TR><TD class="mtitle"><A class="mtitle" HREF="'.$base.'&p_start=9'.$str_dossier.'">9 '._('Hors Comptabilité').'</A></TD></TR>';
echo "</TABLE>";
}

1
sql/backup-new-object.sh Executable file
View file

@ -0,0 +1 @@
pg_dump testdossier82 --inserts -t profile -t menu_ref -t profile_menu -t profile_user -t v_all_menu > object-6.0.sql

530
sql/object-6.0.sql Normal file
View file

@ -0,0 +1,530 @@
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: menu_ref; Type: TABLE; Schema: public; Owner: dany; Tablespace:
--
CREATE TABLE menu_ref (
me_code text NOT NULL,
me_menu text,
me_file text,
me_url text,
me_description text
);
ALTER TABLE public.menu_ref OWNER TO dany;
--
-- Name: COLUMN menu_ref.me_code; Type: COMMENT; Schema: public; Owner: dany
--
COMMENT ON COLUMN menu_ref.me_code IS 'Menu Code ';
--
-- Name: COLUMN menu_ref.me_menu; Type: COMMENT; Schema: public; Owner: dany
--
COMMENT ON COLUMN menu_ref.me_menu IS 'Label to display';
--
-- Name: COLUMN menu_ref.me_file; Type: COMMENT; Schema: public; Owner: dany
--
COMMENT ON COLUMN menu_ref.me_file IS 'if not empty file to include';
--
-- Name: COLUMN menu_ref.me_url; Type: COMMENT; Schema: public; Owner: dany
--
COMMENT ON COLUMN menu_ref.me_url IS 'url ';
--
-- Name: profile; Type: TABLE; Schema: public; Owner: dany; Tablespace:
--
CREATE TABLE profile (
p_name text NOT NULL,
p_id integer NOT NULL,
p_desc text
);
ALTER TABLE public.profile OWNER TO dany;
--
-- Name: TABLE profile; Type: COMMENT; Schema: public; Owner: dany
--
COMMENT ON TABLE profile IS 'Available profile ';
--
-- Name: COLUMN profile.p_name; Type: COMMENT; Schema: public; Owner: dany
--
COMMENT ON COLUMN profile.p_name IS 'Name of the profile';
--
-- Name: COLUMN profile.p_desc; Type: COMMENT; Schema: public; Owner: dany
--
COMMENT ON COLUMN profile.p_desc IS 'description of the profile';
--
-- Name: profile_menu; Type: TABLE; Schema: public; Owner: dany; Tablespace:
--
CREATE TABLE profile_menu (
pm_id integer NOT NULL,
me_code text,
me_code_dep text,
p_id integer,
p_order integer,
p_type_display text NOT NULL
);
ALTER TABLE public.profile_menu OWNER TO dany;
--
-- Name: TABLE profile_menu; Type: COMMENT; Schema: public; Owner: dany
--
COMMENT ON TABLE profile_menu IS 'Join between the profile and the menu ';
--
-- Name: COLUMN profile_menu.me_code_dep; Type: COMMENT; Schema: public; Owner: dany
--
COMMENT ON COLUMN profile_menu.me_code_dep IS 'menu code dependency';
--
-- Name: COLUMN profile_menu.p_id; Type: COMMENT; Schema: public; Owner: dany
--
COMMENT ON COLUMN profile_menu.p_id IS 'link to profile';
--
-- Name: COLUMN profile_menu.p_order; Type: COMMENT; Schema: public; Owner: dany
--
COMMENT ON COLUMN profile_menu.p_order IS 'order of displaying menu';
--
-- Name: COLUMN profile_menu.p_type_display; Type: COMMENT; Schema: public; Owner: dany
--
COMMENT ON COLUMN profile_menu.p_type_display IS 'M is a module
E is a menu';
--
-- Name: profile_menu_pm_id_seq; Type: SEQUENCE; Schema: public; Owner: dany
--
CREATE SEQUENCE profile_menu_pm_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
ALTER TABLE public.profile_menu_pm_id_seq OWNER TO dany;
--
-- Name: profile_menu_pm_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: dany
--
ALTER SEQUENCE profile_menu_pm_id_seq OWNED BY profile_menu.pm_id;
--
-- Name: profile_menu_pm_id_seq; Type: SEQUENCE SET; Schema: public; Owner: dany
--
SELECT pg_catalog.setval('profile_menu_pm_id_seq', 79, true);
--
-- Name: profile_p_id_seq; Type: SEQUENCE; Schema: public; Owner: dany
--
CREATE SEQUENCE profile_p_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
ALTER TABLE public.profile_p_id_seq OWNER TO dany;
--
-- Name: profile_p_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: dany
--
ALTER SEQUENCE profile_p_id_seq OWNED BY profile.p_id;
--
-- Name: profile_p_id_seq; Type: SEQUENCE SET; Schema: public; Owner: dany
--
SELECT pg_catalog.setval('profile_p_id_seq', 1, true);
--
-- Name: profile_user; Type: TABLE; Schema: public; Owner: dany; Tablespace:
--
CREATE TABLE profile_user (
user_name text NOT NULL,
pu_id integer NOT NULL,
p_id integer
);
ALTER TABLE public.profile_user OWNER TO dany;
--
-- Name: TABLE profile_user; Type: COMMENT; Schema: public; Owner: dany
--
COMMENT ON TABLE profile_user IS 'Contains the available profile for users';
--
-- Name: COLUMN profile_user.user_name; Type: COMMENT; Schema: public; Owner: dany
--
COMMENT ON COLUMN profile_user.user_name IS 'fk to available_user : login';
--
-- Name: COLUMN profile_user.p_id; Type: COMMENT; Schema: public; Owner: dany
--
COMMENT ON COLUMN profile_user.p_id IS 'fk to profile';
--
-- Name: profile_user_pu_id_seq; Type: SEQUENCE; Schema: public; Owner: dany
--
CREATE SEQUENCE profile_user_pu_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
ALTER TABLE public.profile_user_pu_id_seq OWNER TO dany;
--
-- Name: profile_user_pu_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: dany
--
ALTER SEQUENCE profile_user_pu_id_seq OWNED BY profile_user.pu_id;
--
-- Name: profile_user_pu_id_seq; Type: SEQUENCE SET; Schema: public; Owner: dany
--
SELECT pg_catalog.setval('profile_user_pu_id_seq', 1, true);
--
-- Name: v_all_menu; Type: VIEW; Schema: public; Owner: dany
--
CREATE VIEW v_all_menu AS
SELECT pm.me_code, pm.pm_id, pm.me_code_dep, pm.p_order, pm.p_type_display, pu.user_name, pu.pu_id, p.p_name, p.p_desc, mr.me_menu, mr.me_file, mr.me_url FROM (((profile_menu pm JOIN profile_user pu ON ((pu.p_id = pm.p_id))) JOIN profile p ON ((p.p_id = pm.p_id))) JOIN menu_ref mr USING (me_code)) ORDER BY pm.p_order;
ALTER TABLE public.v_all_menu OWNER TO dany;
--
-- Name: p_id; Type: DEFAULT; Schema: public; Owner: dany
--
ALTER TABLE profile ALTER COLUMN p_id SET DEFAULT nextval('profile_p_id_seq'::regclass);
--
-- Name: pm_id; Type: DEFAULT; Schema: public; Owner: dany
--
ALTER TABLE profile_menu ALTER COLUMN pm_id SET DEFAULT nextval('profile_menu_pm_id_seq'::regclass);
--
-- Name: pu_id; Type: DEFAULT; Schema: public; Owner: dany
--
ALTER TABLE profile_user ALTER COLUMN pu_id SET DEFAULT nextval('profile_user_pu_id_seq'::regclass);
--
-- Data for Name: menu_ref; Type: TABLE DATA; Schema: public; Owner: dany
--
INSERT INTO menu_ref VALUES ('COMPANY', 'Sociétés', 'company.inc.php', NULL, 'Parametre societe');
INSERT INTO menu_ref VALUES ('PERIODE', 'Période', 'periode.inc.php', NULL, 'Gestion des périodes');
INSERT INTO menu_ref VALUES ('DIVPARM', 'Divers', NULL, NULL, NULL);
INSERT INTO menu_ref VALUES ('CFGPAYMENT', 'Moyen de paiement', 'payment_middle.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('CFGTVA', 'TVA', 'tva.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('CFGACCOUNT', 'Poste', 'poste.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('CARD', 'Fiche', 'fiche.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('STOCK', 'Stock', 'stock.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('MISC', 'Opérations Diverses', 'compta_ods.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('HIST', 'Historique', 'user_action_gl.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('VEN', 'Vente', 'compta_ven.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('ACH', 'Achat', 'compta_ach.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('FIN', 'Financier', 'compta_fin.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('LET', 'Lettrage', 'letter.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('PREOD', 'Opérations prédéfinies', 'preod.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('VERIFBIL', 'Vérification ', 'verif_bilan.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('REPORT', 'Création de rapport', 'report.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('OPEN', 'Ecriture Ouverture', 'opening.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('ADM', 'Administration', 'adm.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('SUPPL', 'Fournisseur', 'supplier.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('FOLLOW', 'Courrier', 'action.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('FORECAST', 'Prévision', 'forecast.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('IMPJRN', 'Historique', 'impress_jrn.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('IMPREC', 'Rapprochement', 'impress_rec.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('IMPPOSTE', 'Poste', 'impress_poste.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('IMPREPORT', 'Rapport', 'impress_rapport.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('IMPBILAN', 'Bilan', 'impress_bilan.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('IMPGL', 'Grand Livre', 'impress_gl_comptes.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('IMPBAL', 'Balance', 'balance.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('IMPCARD', 'Catégorie de Fiches', 'impress_fiche.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('CUSTDET', 'Fiche', 'detail_client.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('CUSTFOLLOW', 'Suivi', 'suivi_client.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('CUSTOP', 'Opération', 'operation_client.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('CFGCARDCAT', 'Catégorie de fiche', 'fiche_def.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('CARDBAL', 'Balance', 'balance_card.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('CUST', 'Client', 'client.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('CFGCATDOC', 'Catégorie de documents', 'cat_document.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('CFGATTRIBCARD', 'Attribut de fiche', 'card_attr.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('CFGPCMN', 'Plan Comptable', 'param_pcmn.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('PARAM', 'Paramètre', NULL, NULL, NULL);
INSERT INTO menu_ref VALUES ('GESTION', 'Gestion', NULL, NULL, NULL);
INSERT INTO menu_ref VALUES ('CUSTCONTACT', 'Contact (à faire)', NULL, NULL, NULL);
INSERT INTO menu_ref VALUES ('CFGEXTENSION', 'Extension', 'extension.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('COMPTA', 'Comptabilité', NULL, NULL, NULL);
INSERT INTO menu_ref VALUES ('LOGOUT', 'Sortie', NULL, 'logout.php', NULL);
INSERT INTO menu_ref VALUES ('DASHBOARD', 'Tableau de bord', 'dashboard.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('IMP', 'Impression', NULL, NULL, NULL);
INSERT INTO menu_ref VALUES ('LETTER', 'Lettrage', NULL, NULL, NULL);
INSERT INTO menu_ref VALUES ('CFGSECURITY', 'Sécurité', 'param_sec.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('LETTERCARD', 'Let. Fiche', 'lettering.card.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('LETTERACC', 'Let. Poste', 'lettering.account.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('PREDOP', 'Ecriture prédefinie', 'preod.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('ADV', 'Avancé', NULL, NULL, NULL);
INSERT INTO menu_ref VALUES ('ANC', 'Compta Analytique', NULL, NULL, NULL);
INSERT INTO menu_ref VALUES ('CFGDOCUMENT', 'Document', 'document_modele.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('ACCESS', 'Dossier', NULL, 'user_login.php', NULL);
INSERT INTO menu_ref VALUES ('DOCUMENT', 'Document', 'document_modele.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('CFGLEDGER', 'journaux', NULL, NULL, NULL);
INSERT INTO menu_ref VALUES ('PLANANC', 'Plan Compt. analytique', 'anc_pa.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('ANCODS', 'Opérations diverses', 'anc_od.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('ANCGROUP', 'Groupe', 'anc_group.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('ANCIMP', 'Impression', 'anc_imp.inc.php', NULL, NULL);
INSERT INTO menu_ref VALUES ('PREFERENCE', 'Préférence', 'pref.inc.php', NULL, NULL);
--
-- Data for Name: profile; Type: TABLE DATA; Schema: public; Owner: dany
--
INSERT INTO profile VALUES ('default', 1, 'Profil par défaut');
INSERT INTO profile VALUES ('Analytique', 2, 'Uniquement comptabilité analytique');
INSERT INTO profile VALUES ('Vente', 3, 'Uniquement vente');
--
-- Data for Name: profile_menu; Type: TABLE DATA; Schema: public; Owner: dany
--
INSERT INTO profile_menu VALUES (1, 'COMPTA', NULL, 1, 5, 'M');
INSERT INTO profile_menu VALUES (2, 'ANC', NULL, 1, 7, 'M');
INSERT INTO profile_menu VALUES (45, 'PARAM', NULL, 1, 2, 'M');
INSERT INTO profile_menu VALUES (44, 'DASHBOARD', NULL, 1, 1, 'M');
INSERT INTO profile_menu VALUES (50, 'ANC', NULL, 2, 1, 'M');
INSERT INTO profile_menu VALUES (51, 'COMPTA', NULL, 3, 1, 'M');
INSERT INTO profile_menu VALUES (52, 'VEN', 'COMPTA', 3, 1, 'E');
INSERT INTO profile_menu VALUES (53, 'ACCESS', NULL, 1, 18, 'M');
INSERT INTO profile_menu VALUES (54, 'COMPANY', 'PARAM', 1, 1, 'E');
INSERT INTO profile_menu VALUES (55, 'PERIODE', 'PARAM', 1, 2, 'E');
INSERT INTO profile_menu VALUES (56, 'DIVPARM', 'PARAM', 1, 3, 'E');
INSERT INTO profile_menu VALUES (59, 'CFGPAYMENT', 'DIVPARM', 1, 4, 'E');
INSERT INTO profile_menu VALUES (60, 'CFGTVA', 'DIVPARM', 1, 5, 'E');
INSERT INTO profile_menu VALUES (61, 'CFGACCOUNT', 'DIVPARM', 1, 6, 'E');
INSERT INTO profile_menu VALUES (67, 'CFGCATDOC', 'DIVPARM', 1, 8, 'E');
INSERT INTO profile_menu VALUES (13, 'IMPBILAN', 'IMP', 1, 11, 'E');
INSERT INTO profile_menu VALUES (14, 'IMPCARD', 'IMP', 1, 12, 'E');
INSERT INTO profile_menu VALUES (15, 'IMPGL', 'IMP', 1, 13, 'E');
INSERT INTO profile_menu VALUES (16, 'IMPJRN', 'IMP', 1, 14, 'E');
INSERT INTO profile_menu VALUES (17, 'IMPBAL', 'IMP', 1, 15, 'E');
INSERT INTO profile_menu VALUES (68, 'CFGATTRIBCARD', 'DIVPARM', 1, 9, 'E');
INSERT INTO profile_menu VALUES (69, 'CFGPCMN', 'PARAM', 1, 4, 'E');
INSERT INTO profile_menu VALUES (70, 'CFGEXTENSION', 'PARAM', 1, 5, 'E');
INSERT INTO profile_menu VALUES (20, 'LOGOUT', NULL, 1, 19, 'M');
INSERT INTO profile_menu VALUES (71, 'CFGSECURITY', 'PARAM', 1, 6, 'E');
INSERT INTO profile_menu VALUES (72, 'PREDOP', 'PARAM', 1, 7, 'E');
INSERT INTO profile_menu VALUES (73, 'CFGDOCUMENT', 'PARAM', 1, 8, 'E');
INSERT INTO profile_menu VALUES (74, 'CFGLEDGER', 'PARAM', 1, 9, 'E');
INSERT INTO profile_menu VALUES (75, 'PLANANC', 'ANC', 1, 1, 'E');
INSERT INTO profile_menu VALUES (65, 'CFGCARDCAT', 'DIVPARM', 1, 7, 'E');
INSERT INTO profile_menu VALUES (9, 'IMPPOSTE', 'IMP', 1, 8, 'E');
INSERT INTO profile_menu VALUES (10, 'IMPREC', 'IMP', 1, 9, 'E');
INSERT INTO profile_menu VALUES (11, 'IMPREPORT', 'IMP', 1, 10, 'E');
INSERT INTO profile_menu VALUES (76, 'ANCODS', 'ANC', 1, 2, 'E');
INSERT INTO profile_menu VALUES (77, 'ANCGROUP', 'ANC', 1, 3, 'E');
INSERT INTO profile_menu VALUES (78, 'ANCIMP', 'ANC', 1, 4, 'E');
INSERT INTO profile_menu VALUES (79, 'PREFERENCE', NULL, 1, 2, 'M');
INSERT INTO profile_menu VALUES (23, 'LETTER', 'COMPTA', 1, 8, 'E');
INSERT INTO profile_menu VALUES (24, 'LETTERCARD', 'LETTER', 1, 1, 'E');
INSERT INTO profile_menu VALUES (27, 'LETTERACC', 'LETTER', 1, 2, 'E');
INSERT INTO profile_menu VALUES (37, 'CUST', 'GESTION', 1, 1, 'E');
INSERT INTO profile_menu VALUES (38, 'SUPPL', 'GESTION', 1, 2, 'E');
INSERT INTO profile_menu VALUES (39, 'ADM', 'GESTION', 1, 3, 'E');
INSERT INTO profile_menu VALUES (35, 'IMP', 'GESTION', 1, 4, 'E');
INSERT INTO profile_menu VALUES (36, 'CARD', 'GESTION', 1, 6, 'E');
INSERT INTO profile_menu VALUES (40, 'STOCK', 'GESTION', 1, 5, 'E');
INSERT INTO profile_menu VALUES (41, 'FORECAST', 'GESTION', 1, 7, 'E');
INSERT INTO profile_menu VALUES (42, 'FOLLOW', 'GESTION', 1, 8, 'E');
INSERT INTO profile_menu VALUES (29, 'VERIFBIL', 'ADV', 1, 21, 'E');
INSERT INTO profile_menu VALUES (30, 'STOCK', 'ADV', 1, 22, 'E');
INSERT INTO profile_menu VALUES (31, 'PREDOP', 'ADV', 1, 23, 'E');
INSERT INTO profile_menu VALUES (32, 'OPEN', 'ADV', 1, 24, 'E');
INSERT INTO profile_menu VALUES (33, 'REPORT', 'ADV', 1, 25, 'E');
INSERT INTO profile_menu VALUES (5, 'CARD', 'COMPTA', 1, 7, 'E');
INSERT INTO profile_menu VALUES (43, 'HIST', 'COMPTA', 1, 1, 'E');
INSERT INTO profile_menu VALUES (34, 'GESTION', NULL, 1, 6, 'M');
INSERT INTO profile_menu VALUES (4, 'VEN', 'COMPTA', 1, 2, 'E');
INSERT INTO profile_menu VALUES (3, 'ACH', 'COMPTA', 1, 3, 'E');
INSERT INTO profile_menu VALUES (19, 'FIN', 'COMPTA', 1, 4, 'E');
INSERT INTO profile_menu VALUES (18, 'MISC', 'COMPTA', 1, 5, 'E');
INSERT INTO profile_menu VALUES (6, 'IMP', 'COMPTA', 1, 6, 'E');
INSERT INTO profile_menu VALUES (28, 'ADV', 'COMPTA', 1, 20, 'E');
--
-- Data for Name: profile_user; Type: TABLE DATA; Schema: public; Owner: dany
--
INSERT INTO profile_user VALUES ('phpcompta', 1, 1);
--
-- Name: menu_ref_pkey; Type: CONSTRAINT; Schema: public; Owner: dany; Tablespace:
--
ALTER TABLE ONLY menu_ref
ADD CONSTRAINT menu_ref_pkey PRIMARY KEY (me_code);
--
-- Name: profile_menu_pkey; Type: CONSTRAINT; Schema: public; Owner: dany; Tablespace:
--
ALTER TABLE ONLY profile_menu
ADD CONSTRAINT profile_menu_pkey PRIMARY KEY (pm_id);
--
-- Name: profile_pkey; Type: CONSTRAINT; Schema: public; Owner: dany; Tablespace:
--
ALTER TABLE ONLY profile
ADD CONSTRAINT profile_pkey PRIMARY KEY (p_id);
--
-- Name: profile_user_pkey; Type: CONSTRAINT; Schema: public; Owner: dany; Tablespace:
--
ALTER TABLE ONLY profile_user
ADD CONSTRAINT profile_user_pkey PRIMARY KEY (pu_id);
--
-- Name: profile_user_user_name_key; Type: CONSTRAINT; Schema: public; Owner: dany; Tablespace:
--
ALTER TABLE ONLY profile_user
ADD CONSTRAINT profile_user_user_name_key UNIQUE (user_name, p_id);
--
-- Name: fki_profile_menu_menu_ref; Type: INDEX; Schema: public; Owner: dany; Tablespace:
--
CREATE INDEX fki_profile_menu_menu_ref ON profile_menu USING btree (me_code);
--
-- Name: fki_profile_menu_profile; Type: INDEX; Schema: public; Owner: dany; Tablespace:
--
CREATE INDEX fki_profile_menu_profile ON profile_menu USING btree (p_id);
--
-- Name: profile_menu_me_code_fkey; Type: FK CONSTRAINT; Schema: public; Owner: dany
--
ALTER TABLE ONLY profile_menu
ADD CONSTRAINT profile_menu_me_code_fkey FOREIGN KEY (me_code) REFERENCES menu_ref(me_code);
--
-- Name: profile_menu_p_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: dany
--
ALTER TABLE ONLY profile_menu
ADD CONSTRAINT profile_menu_p_id_fkey FOREIGN KEY (p_id) REFERENCES profile(p_id);
--
-- Name: profile_user_p_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: dany
--
ALTER TABLE ONLY profile_user
ADD CONSTRAINT profile_user_p_id_fkey FOREIGN KEY (p_id) REFERENCES profile(p_id) ON UPDATE CASCADE ON DELETE CASCADE;
--
-- PostgreSQL database dump complete
--