From d61b8d86c0436d6b12eeb13ff0944604b4e9d126 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Thu, 31 May 2007 22:20:57 +0000 Subject: [PATCH] Fix problem with account --- include/class_fiche.php | 17 ++++++++++++++++- include/postgres.php | 5 +++-- include/user_action_ods.php | 2 -- include/user_common.php | 4 ++++ include/user_form_ach.php | 2 ++ include/user_menu.php | 2 ++ 6 files changed, 27 insertions(+), 5 deletions(-) diff --git a/include/class_fiche.php b/include/class_fiche.php index 0168d1282..4482a0876 100644 --- a/include/class_fiche.php +++ b/include/class_fiche.php @@ -18,6 +18,8 @@ */ /* $Revision$ */ + + // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr include_once("class_attribut.php"); require_once('class_fiche_def.php'); @@ -568,10 +570,14 @@ class fiche { if ( $id == ATTR_DEF_NAME ) { echo_debug("Modify ATTR_DEF_NAME"); + echo_debug("Value = $v"); if ( strlen(trim($value)) == 0 ) continue; + + echo_debug("Value = $v"); } + // account if ( $id == ATTR_DEF_ACCOUNT ) { @@ -599,7 +605,16 @@ class fiche { { $sql=sprintf("select account_update(%d,null)", $this->id); - $Ret=ExecSql($this->cn,$sql); + $Ret=ExecSql($this->cn,$sql,false); + + ob_end_clean(); + if ( $Ret == false ) { + echo "Erreur : ce compte [$v] n'a pas de compte parent.". + "L'opération est annulée"; + Rollback($this->cn); + return; + } + continue; continue; } } diff --git a/include/postgres.php b/include/postgres.php index 4a159d4f2..5924008c4 100644 --- a/include/postgres.php +++ b/include/postgres.php @@ -121,15 +121,16 @@ de données"); * \brief send a sql string to the database * \param $p_connection db connection * \param $p_string sql string + * \param $p_exit if true exits in case of error otherwise returns false * \return false if error otherwise true */ -function ExecSql($p_connection, $p_string) { +function ExecSql($p_connection, $p_string,$p_exit=true) { echo_debug('postgres.php',__LINE__,"SQL = $p_string"); // probl. with Ubuntu & UTF8 //---- pg_set_client_encoding($p_connection,'latin1'); $ret=pg_query($p_connection,$p_string); - if ( $ret == false ) { + if ( $ret == false && $p_exit ) { echo_error ("SQL ERROR ::: $p_string"); exit(" Operation cancelled due to error : $p_string"); } diff --git a/include/user_action_ods.php b/include/user_action_ods.php index 868b31f08..172c479f2 100644 --- a/include/user_action_ods.php +++ b/include/user_action_ods.php @@ -46,7 +46,6 @@ if ( $action == 'new' ) { NoAccess(); exit -1; } - // We request a new form if ( isset($_GET['blank'] )) { // Submit button in the form @@ -56,7 +55,6 @@ if ( $action == 'new' ) { $prop=GetJrnProp($_SESSION['g_dossier'],$_GET['p_jrn']); $line=$prop['jrn_deb_max_line']; $r=FormODS($cn,$_GET['p_jrn'],$User->GetPeriode(),$submit,null,false,$line); - echo '
'; echo $r; echo "

On-line calculator

".JS_CALC_LINE."
"; diff --git a/include/user_common.php b/include/user_common.php index 33f96100f..dac4e2b34 100644 --- a/include/user_common.php +++ b/include/user_common.php @@ -17,6 +17,10 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + + + /* $Revision$ */ // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr diff --git a/include/user_form_ach.php b/include/user_form_ach.php index add660f7c..8915ec089 100644 --- a/include/user_form_ach.php +++ b/include/user_form_ach.php @@ -21,12 +21,14 @@ /*! \file * \brief Functions for the ledger of expenses */ + require_once("constant.php"); require_once("class_widget.php"); require_once("preference.php"); require_once("fiche_inc.php"); require_once("user_common.php"); require_once("class_parm_code.php"); + /*! * \brief Display the form for a sell * Used to show detail, encode a new invoice diff --git a/include/user_menu.php b/include/user_menu.php index d089d96e7..28ae84d90 100644 --- a/include/user_menu.php +++ b/include/user_menu.php @@ -26,6 +26,8 @@ /* $Revision$ */ + + /*! * \brief Show all the available folder for the users * at the login page