Fix: Blank page when creating supplier order
This commit is contained in:
parent
7b75dbc285
commit
f38232cbb1
@ -426,7 +426,7 @@ if ($action=='remove_file')
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Cree une commande
|
* Create an order
|
||||||
*/
|
*/
|
||||||
if ($_GET["action"] == 'create')
|
if ($_GET["action"] == 'create')
|
||||||
{
|
{
|
||||||
@ -449,7 +449,7 @@ if ($_GET["action"] == 'create')
|
|||||||
|
|
||||||
$id=$orderid;
|
$id=$orderid;
|
||||||
$_GET['id']=$id;
|
$_GET['id']=$id;
|
||||||
$_GET['action']='edit';
|
$_REQUEST['id']=$id;
|
||||||
$db->commit();
|
$db->commit();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -127,14 +127,13 @@ class Fournisseur extends Societe
|
|||||||
|
|
||||||
if ($comm->create($user) > 0)
|
if ($comm->create($user) > 0)
|
||||||
{
|
{
|
||||||
dol_syslog("Fournisseur::Create_Commande : Success");
|
|
||||||
$this->single_open_commande = $comm->id;
|
$this->single_open_commande = $comm->id;
|
||||||
|
|
||||||
return $comm->id;
|
return $comm->id;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_syslog("Fournisseur::Create_Commande : Failed");
|
$this->error=$comm->error;
|
||||||
|
dol_syslog("Fournisseur::Create_Commande Failed ".$this->error, LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -687,16 +687,14 @@ class CommandeFournisseur extends Commande
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Cr<EFBFBD><EFBFBD> la commande au statut brouillon
|
* \brief Create order with draft status
|
||||||
* \param user Utilisateur qui cr<EFBFBD>e
|
* \param user User making creation
|
||||||
* \return int <0 si ko, >0 si ok
|
* \return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function create($user)
|
function create($user)
|
||||||
{
|
{
|
||||||
global $langs,$conf;
|
global $langs,$conf;
|
||||||
|
|
||||||
dol_syslog("CommandeFournisseur::Create soc id=".$this->socid);
|
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
/* On positionne en mode brouillon la commande */
|
/* 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 = "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."')";
|
$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) )
|
if ( $this->db->query($sql) )
|
||||||
{
|
{
|
||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."commande_fournisseur");
|
$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 = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur";
|
||||||
$sql.= " SET ref='(PROV".$this->id.")'";
|
$sql.= " SET ref='(PROV".$this->id.")'";
|
||||||
$sql.= " WHERE rowid=".$this->id;
|
$sql.= " WHERE rowid=".$this->id;
|
||||||
|
dol_syslog("CommandeFournisseur::Create sql=".$sql);
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
{
|
{
|
||||||
// On logue creation pour historique
|
// On logue creation pour historique
|
||||||
@ -724,13 +724,12 @@ class CommandeFournisseur extends Commande
|
|||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||||
// Fin appel triggers
|
// Fin appel triggers
|
||||||
|
|
||||||
dol_syslog("CommandeFournisseur::Create : Success");
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error()." - ".$sql;
|
$this->error=$this->db->error();
|
||||||
dol_syslog("CommandeFournisseur::Create: Failed -2 - ".$this->error, LOG_ERR);
|
dol_syslog("CommandeFournisseur::Create: Failed -2 - ".$this->error, LOG_ERR);
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -2;
|
return -2;
|
||||||
@ -738,7 +737,7 @@ class CommandeFournisseur extends Commande
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error()." - ".$sql;
|
$this->error=$this->db->error();
|
||||||
dol_syslog("CommandeFournisseur::Create: Failed -1 - ".$this->error, LOG_ERR);
|
dol_syslog("CommandeFournisseur::Create: Failed -1 - ".$this->error, LOG_ERR);
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user