From f38232cbb1bd3369399956adfd9f23bc60ade02c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Mar 2009 17:11:25 +0000 Subject: [PATCH] Fix: Blank page when creating supplier order --- htdocs/fourn/commande/fiche.php | 4 ++-- htdocs/fourn/fournisseur.class.php | 5 ++--- htdocs/fourn/fournisseur.commande.class.php | 15 +++++++-------- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 9d1b114367c..8ae04574725 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -426,7 +426,7 @@ if ($action=='remove_file') /* - * Cree une commande + * Create an order */ if ($_GET["action"] == 'create') { @@ -449,7 +449,7 @@ if ($_GET["action"] == 'create') $id=$orderid; $_GET['id']=$id; - $_GET['action']='edit'; + $_REQUEST['id']=$id; $db->commit(); } else diff --git a/htdocs/fourn/fournisseur.class.php b/htdocs/fourn/fournisseur.class.php index 06d541d335e..9e51cbb6a14 100644 --- a/htdocs/fourn/fournisseur.class.php +++ b/htdocs/fourn/fournisseur.class.php @@ -127,14 +127,13 @@ class Fournisseur extends Societe if ($comm->create($user) > 0) { - dol_syslog("Fournisseur::Create_Commande : Success"); $this->single_open_commande = $comm->id; - return $comm->id; } else { - dol_syslog("Fournisseur::Create_Commande : Failed"); + $this->error=$comm->error; + dol_syslog("Fournisseur::Create_Commande Failed ".$this->error, LOG_ERR); return -1; } } diff --git a/htdocs/fourn/fournisseur.commande.class.php b/htdocs/fourn/fournisseur.commande.class.php index b1e3242f875..4e6f4dc5249 100644 --- a/htdocs/fourn/fournisseur.commande.class.php +++ b/htdocs/fourn/fournisseur.commande.class.php @@ -687,16 +687,14 @@ class CommandeFournisseur extends Commande } /** - * \brief Cr�� la commande au statut brouillon - * \param user Utilisateur qui cr�e - * \return int <0 si ko, >0 si ok + * \brief Create order with draft status + * \param user User making creation + * \return int <0 if KO, >0 if OK */ function create($user) { global $langs,$conf; - dol_syslog("CommandeFournisseur::Create soc id=".$this->socid); - $this->db->begin(); /* On positionne en mode brouillon la commande */ @@ -705,6 +703,7 @@ class CommandeFournisseur extends Commande $sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseur (ref, fk_soc, date_creation, fk_user_author, fk_statut, source, model_pdf) "; $sql .= " VALUES ('',".$this->socid.", ".$this->db->idate(mktime()).", ".$user->id.",0,0,'".$conf->global->COMMANDE_SUPPLIER_ADDON_PDF."')"; + dol_syslog("CommandeFournisseur::Create sql=".$sql); if ( $this->db->query($sql) ) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."commande_fournisseur"); @@ -712,6 +711,7 @@ class CommandeFournisseur extends Commande $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur"; $sql.= " SET ref='(PROV".$this->id.")'"; $sql.= " WHERE rowid=".$this->id; + dol_syslog("CommandeFournisseur::Create sql=".$sql); if ($this->db->query($sql)) { // On logue creation pour historique @@ -724,13 +724,12 @@ class CommandeFournisseur extends Commande if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers - dol_syslog("CommandeFournisseur::Create : Success"); $this->db->commit(); return 1; } else { - $this->error=$this->db->error()." - ".$sql; + $this->error=$this->db->error(); dol_syslog("CommandeFournisseur::Create: Failed -2 - ".$this->error, LOG_ERR); $this->db->rollback(); return -2; @@ -738,7 +737,7 @@ class CommandeFournisseur extends Commande } else { - $this->error=$this->db->error()." - ".$sql; + $this->error=$this->db->error(); dol_syslog("CommandeFournisseur::Create: Failed -1 - ".$this->error, LOG_ERR); $this->db->rollback(); return -1;