Fix problem with account

This commit is contained in:
sparkyx 2007-05-31 22:20:57 +00:00
parent 5bed44970f
commit d61b8d86c0
6 changed files with 27 additions and 5 deletions

View file

@ -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 "<span class=\"error\">Erreur : ce compte [$v] n'a pas de compte parent.".
"L'op&eacute;ration est annul&eacute;e</span>";
Rollback($this->cn);
return;
}
continue;
continue;
}
}

View file

@ -121,15 +121,16 @@ de donn&eacute;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");
}

View file

@ -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 '<div class="u_redcontent">';
echo $r;
echo "<div><h4>On-line calculator</h4>".JS_CALC_LINE."<div>";

View file

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

View file

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

View file

@ -26,6 +26,8 @@
/* $Revision$ */
/*!
* \brief Show all the available folder for the users
* at the login page