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 '