From f56b101d7ea6600a80c9f825ea5826b25c0c52f7 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Fri, 28 Apr 2006 22:24:11 +0000 Subject: [PATCH] progress task 5410 -> fonction CRM 5306 -> Improve parameter setting --- html/commercial.php | 39 +++++- html/facturation.php | 45 +++++-- html/parametre.php | 274 +++++++++++++++++++++++++++++++++++++++- html/style-light.css | 8 +- html/user_pref.php | 117 +---------------- include/pref.inc.php | 141 +++++++++++++++++++++ include/user_common.php | 4 +- include/user_menu.php | 1 + 8 files changed, 490 insertions(+), 139 deletions(-) create mode 100644 include/pref.inc.php diff --git a/html/commercial.php b/html/commercial.php index 775c3b61e..1960c8b74 100644 --- a/html/commercial.php +++ b/html/commercial.php @@ -22,6 +22,7 @@ include_once ("ac_common.php"); require_once("constant.php"); include_once ("postgres.php"); + if ( isset ($_REQUEST['dos'] ) ) { $_SESSION['g_dossier']=$_REQUEST['dos']; $g_name=GetDossierName($_SESSION['g_dossier']); @@ -29,17 +30,33 @@ if ( isset ($_REQUEST['dos'] ) ) { } +include_once ("postgres.php"); +/* Admin. Dossier */ +$rep=DbConnect($_SESSION['g_dossier']); +require_once ("class_user.php"); +$User=new cl_user($rep); +$User->Check(); +//////////////////////////////////////////////////////////////////////////////// +// update preference +//////////////////////////////////////////////////////////////////////////////// +if ( isset ( $_POST['style_user']) ) { + $User->update_global_pref('THEME',$_POST['style_user']); + $_SESSION['g_theme']=$_POST['style_user']; + +} +// Met a jour le pagesize +if ( isset ( $_POST['p_size']) ) { + $User->update_global_pref('PAGESIZE',$_POST['p_size']); + $_SESSION['g_pagesize']=$_POST['p_size']; + +} + +/// html_page_start($_SESSION['g_theme']); if ( ! isset ( $_SESSION['g_dossier'] ) ) { echo "You must choose a Dossier "; exit -2; } -include_once ("postgres.php"); -/* Admin. Dossier */ -$rep=DbConnect(); -require_once ("class_user.php"); -$User=new cl_user($rep); -$User->Check(); include("preference.php"); include_once("user_menu.php"); @@ -51,6 +68,9 @@ $p_action=(isset ($_REQUEST['p_action']))?$_REQUEST['p_action']:""; echo ShowItem(array( array('?p_action=client','Client'), array('?p_action=fournisseur','Fournisseur'), + array('?p_action=suivi_courrier','Suivi courrier'), + array('?p_action=mbre','Membre'), + array('?p_action=pref','Préférence'), array('login.php','Accueil',"Accueil"), array('logout.php','logout',"Sortie") ), @@ -62,6 +82,13 @@ echo ShowItem(array( $cn=DbConnect($_SESSION['g_dossier']); //////////////////////////////////////////////////////////////////////////////// +// p_action == pref +//////////////////////////////////////////////////////////////////////////////// +if ( $p_action == "pref" ) +{ + require_once("pref.inc.php"); +} +//////////////////////////////////////////////////////////////////////////////// // p_action == client //////////////////////////////////////////////////////////////////////////////// if ( $p_action == "client" ) diff --git a/html/facturation.php b/html/facturation.php index dc58e3775..e06078be3 100644 --- a/html/facturation.php +++ b/html/facturation.php @@ -24,17 +24,21 @@ include_once ("class_user.php"); include_once ("postgres.php"); include ("user_menu.php"); include_once("class_invoice.php"); -// Check user -$rep=DbConnect(); -$User=new cl_user($rep); -$User->Check(); -$g_dossier=(isset ($_REQUEST['dos']))?$_REQUEST['dos']:-1; -$_SESSION[ "g_dossier"]=$g_dossier; +if ( isset ($_REQUEST['dos'])) +{ + $_SESSION["g_dossier"]=$_REQUEST['dos']; +} +$g_dossier=(isset ($_SESSION['g_dossier']))?$_SESSION['g_dossier']:-1; + // List of customer select * from fiche_def where frd_id=9; if ( $g_dossier==-1 ) { echo "You must choose a Dossier "; exit -2; } +// Check user +$rep=DbConnect($g_dossier); +$User=new cl_user($rep); +$User->Check(); // Save Folder's name $g_name=GetDossierName($g_dossier); @@ -46,6 +50,22 @@ if ( $User->CheckAction($g_dossier,FACT) == 0 ){ NoAccess(); exit -1; } +//////////////////////////////////////////////////////////////////////////////// +// update preference +//////////////////////////////////////////////////////////////////////////////// +if ( isset ( $_POST['style_user']) ) { + $User->update_global_pref('THEME',$_POST['style_user']); + $_SESSION['g_theme']=$_POST['style_user']; + $User->theme=$_POST['style_user']; +} +// Met a jour le pagesize +if ( isset ( $_POST['p_size']) ) { + $User->update_global_pref('PAGESIZE',$_POST['p_size']); + $_SESSION['g_pagesize']=$_POST['p_size']; + +} + +/// html_page_start($User->theme); $cn=DbConnect($g_dossier); @@ -56,6 +76,7 @@ echo "

Facturation ".$_SESSION['g_name']."

"; echo ShowItem(array( array('?p_action=create_invoice&dos='.$g_dossier,'Nouvelle'), array('?p_action=view_invoice&dos='.$g_dossier,'Voir'), + array('?p_action=pref','Préférence'), array('parametre.php?p_action=invoice&dos='.$g_dossier,'Paramètre'), array('login.php','Accueil',"Accueil"), array('logout.php','logout',"Sortie") @@ -65,8 +86,16 @@ echo ShowItem(array( // Action requested // //////////////////////////////////////////////////////////////////////////////// -if ( isset ($_GET["p_action"] )) { - $action=$_GET["p_action"]; +if ( isset ($_REQUEST["p_action"] )) { + $action=$_REQUEST["p_action"]; + //////////////////////////////////////////////////////////////////////////////// + // p_action == pref + //////////////////////////////////////////////////////////////////////////////// + if ( $action == "pref" ) + { + require_once("pref.inc.php"); + } + //////////////////////////////////////////////////// // See All invoices if ($action == "create_invoice" ) { diff --git a/html/parametre.php b/html/parametre.php index 7081bf57c..cdc4f6648 100644 --- a/html/parametre.php +++ b/html/parametre.php @@ -22,6 +22,7 @@ include_once ("ac_common.php"); html_page_start($_SESSION['g_theme']); include_once ("postgres.php"); +require_once("class_widget.php"); if ( isset ($_REQUEST['dos'] ) ) { $_SESSION['g_dossier']=$_REQUEST['dos']; @@ -57,7 +58,7 @@ if ( $User->CheckAction($cn,PARM) == 0 ) { } - +// First action $p_action=""; if ( isset($_REQUEST["p_action"]) ) { $p_action=$_REQUEST["p_action"]; @@ -65,13 +66,280 @@ if ( isset($_REQUEST["p_action"]) ) { echo ShowMenuParam("parametre.php?p_action=".$p_action); echo '
'; -// Devise - +// sub action $action=""; if ( isset ($_POST['action']) ) { $action=$_POST['action']; } +echo_debug("parametre",__LINE__,$_POST); +//////////////////////////////////////////////////////////////////////////////// +// TVA RATE +//////////////////////////////////////////////////////////////////////////////// +if ( $p_action == "tva" ) +{ + // Confirm remove + if ( isset ($_POST['confirm_rm'])) + { + ExecSql($cn,'select tva_delete('.$_POST['tva_id'].')'); + } + // confirm add + if ( isset ($_POST['confirm_add'])) + { + extract($_POST); + $tva_id=FormatString($tva_id); + $tva_label=FormatString($tva_label); + $tva_rate=FormatString($tva_rate); + $tva_comment=FormatString($tva_comment); + $tva_poste=FormatString($tva_poste); + $err=0; // Error code + if ( isNumber($tva_id) == 0 ) { + $err=1; + + } + if ( isNumber($tva_rate) == 0 ) { + $err=2; + } + + if ( $err == 0 ) + { + $Res=ExecSql($cn, + "select tva_insert($tva_id,'$tva_label','$tva_rate','$tva_comment','$tva_poste')"); + $ret_sql=pg_fetch_row($Res); + $err=$ret_sql[0]; + } + if ( $err != 0 ) + { + $err_code=array(1=>"Tva id n\'est pas un nombre", + 2=>"Taux tva invalide", + 3=>"Label ne peut être vide", + 4=>"Poste invalide", + 5=>"Tva id doit être unique"); + $str_err=$err_code[$err]; + echo "";; + } + } + // confirm mod + if ( isset ($_POST['confirm_mod'])) + { + extract($_POST); + $tva_id=FormatString($tva_id); + $tva_label=FormatString($tva_label); + $tva_rate=FormatString($tva_rate); + $tva_comment=FormatString($tva_comment); + $tva_poste=FormatString($tva_poste); + $err=0; // Error code + if ( isNumber($tva_id) == 0 ) { + $err=1; + + } + if ( isNumber($tva_rate) == 0 ) { + $err=2; + } + + if ( $err == 0 ) + { + $Res=ExecSql($cn, + "select tva_modify($tva_id,'$tva_label','$tva_rate','$tva_comment','$tva_poste')"); + $ret_sql=pg_fetch_row($Res); + $err=$ret_sql[0]; + } + if ( $err != 0 ) + { + $err_code=array(1=>"Tva id n\'est pas un nombre", + 2=>"Taux tva invalide", + 3=>"Label ne peut être vide", + 4=>"Poste invalide", + 5=>"Tva id doit être unique"); + $str_err=$err_code[$err]; + echo "";; + } + } + + //////////////////////////////////////////////////////////////////////////////// + // Display + $sql="select tva_id,tva_label,tva_rate,tva_comment,tva_poste from tva_rate order by tva_id"; + $Res=ExecSql($cn,$sql); + ?> + + + + + + + + + $row['tva_label'], + 'tva_rate'=>$row['tva_rate'], + 'tva_comment'=>$row['tva_comment'], + 'tva_poste'=>$row['tva_poste'] + ); + echo ""; + echo ''; + + echo ""; + + echo ""; + + echo ""; + + echo ""; + + echo ""; + + echo ""; + + echo ''; + echo ""; + } +?> +
IdLabelTauxCommentairePoste
"; + echo $row['tva_id']; + echo ""; + echo $row['tva_label']; + echo ""; + echo $row['tva_rate']; + echo ""; + echo $row['tva_comment']; + echo ""; + echo $row['tva_poste']; + echo ""; + echo ''; + echo ''; + $w=new widget("hidden"); + $w->name="tva_id"; + $w->value=$row['tva_id']; + echo $w->IOValue(); + $w=new widget("hidden"); + $w->name="p_action"; + $w->value="tva"; + echo $w->IOValue(); + + echo "
+ +
+ + +
+ + + + + + + + + + + + + + +
LabelTauxCommentairePoste
+'; + echo ''; + echo ''; + echo ""; + + } + //////////////////////////////////////////////////////////////////////////////// + // add + if ( isset ( $_REQUEST['add'])) + { + echo_debug("parametre",__LINE__,"add a line "); + echo "Tva à ajouter, l'id doit être différent pour chaque taux"; + echo '
'; + + +?> + + + + + + + + + + + + + + + +
idLabelTauxCommentairePoste
size=5; echo $w->IOValue('tva_id','') ?> size=20; echo $w->IOValue('tva_label','') ?> size=5; echo $w->IOValue('tva_rate','') ?> heigh=2;$w->width=20;echo $w->IOValue('tva_comment','') ?> size=10;echo $w->IOValue('tva_poste','') ?>
+ + +
+'; + echo ''; +?> + + + + + + + + + + + + + +
LabelTauxCommentairePoste
size=20; echo $w->IOValue('tva_label',$a[$index]['tva_label']) ?> size=5; echo $w->IOValue('tva_rate',$a[$index]['tva_rate']) ?> heigh=2;$w->width=20; + echo $w->IOValue('tva_comment',$a[$index]['tva_comment']) ?> size=5; echo $w->IOValue('tva_poste',$a[$index]['tva_poste']) ?>
+ + + +'; - -if ( isset ($_POST['spass']) ) { - if ( $_POST['pass_1'] != $_POST['pass_2'] ) { -?> - - -

Password

-
- - - - -
-
-"; -foreach ($style as $st){ - if ( $st == $_SESSION['g_theme'] ) { - $disp_style.='