Fix: La saisie de la ref commande client sur commande ne s'enregistrait pas pour certains etats de commande
This commit is contained in:
parent
4505ca9c26
commit
d1462e543c
@ -421,6 +421,7 @@ class Commande
|
|||||||
$obj = $this->db->fetch_object();
|
$obj = $this->db->fetch_object();
|
||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
$this->ref = $obj->ref;
|
$this->ref = $obj->ref;
|
||||||
|
$this->ref_client = $obj->ref_client;
|
||||||
$this->soc_id = $obj->fk_soc;
|
$this->soc_id = $obj->fk_soc;
|
||||||
$this->statut = $obj->fk_statut;
|
$this->statut = $obj->fk_statut;
|
||||||
$this->user_author_id = $obj->fk_user_author;
|
$this->user_author_id = $obj->fk_user_author;
|
||||||
@ -432,7 +433,6 @@ class Commande
|
|||||||
$this->source = $obj->source;
|
$this->source = $obj->source;
|
||||||
$this->facturee = $obj->facture;
|
$this->facturee = $obj->facture;
|
||||||
$this->note = $obj->note;
|
$this->note = $obj->note;
|
||||||
$this->ref_client = $obj->ref_client;
|
|
||||||
$this->projet_id = $obj->fk_projet;
|
$this->projet_id = $obj->fk_projet;
|
||||||
$this->db->free();
|
$this->db->free();
|
||||||
if ($this->statut == 0)
|
if ($this->statut == 0)
|
||||||
@ -591,16 +591,20 @@ class Commande
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* \brief Positionne numero reference commande client
|
||||||
*
|
* \param user Utilisateur qui modifie
|
||||||
*/
|
* \param ref_client Reference commande client
|
||||||
|
* \return int <0 si ko, >0 si ok
|
||||||
|
*/
|
||||||
function set_ref_client($user, $ref_client)
|
function set_ref_client($user, $ref_client)
|
||||||
{
|
{
|
||||||
if ($user->rights->commande->creer)
|
if ($user->rights->commande->creer)
|
||||||
{
|
{
|
||||||
|
dolibarr_syslog('Commande::set_ref_client this->id='.$this->id.', ref_client='.$ref_client);
|
||||||
|
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande SET ref_client = '.(empty($ref_client) ? 'NULL' : '\''.addslashes($ref_client).'\'');
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande SET ref_client = '.(empty($ref_client) ? 'NULL' : '\''.addslashes($ref_client).'\'');
|
||||||
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut = 0 ;';
|
$sql.= ' WHERE rowid = '.$this->id;
|
||||||
if ($this->db->query($sql) )
|
if ($this->db->query($sql) )
|
||||||
{
|
{
|
||||||
$this->ref_client = $ref_client;
|
$this->ref_client = $ref_client;
|
||||||
@ -608,10 +612,17 @@ class Commande
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dolibarr_syslog('Commande::set_ref_client Erreur SQL');
|
$this->error=$this->db->error();
|
||||||
|
dolibarr_syslog('Commande::set_ref_client Erreur '.$this->error.' - '.$sql);
|
||||||
|
return -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
|||||||
@ -46,6 +46,7 @@ require_once(DOL_DOCUMENT_ROOT.'/propal.class.php');
|
|||||||
require_once(DOL_DOCUMENT_ROOT.'/commande/commande.class.php');
|
require_once(DOL_DOCUMENT_ROOT.'/commande/commande.class.php');
|
||||||
|
|
||||||
// Sécurité accés client
|
// Sécurité accés client
|
||||||
|
$socidp=0;
|
||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
{
|
{
|
||||||
$action = '';
|
$action = '';
|
||||||
@ -56,15 +57,16 @@ if ($user->societe_id > 0)
|
|||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Categorisation dans projet
|
||||||
if ($_POST['action'] == 'classin' && $user->rights->commande->creer)
|
if ($_POST['action'] == 'classin' && $user->rights->commande->creer)
|
||||||
{
|
{
|
||||||
$commande = new Commande($db);
|
$commande = new Commande($db);
|
||||||
$commande->fetch($_GET['id']);
|
$commande->fetch($_GET['id']);
|
||||||
$commande->classin($_POST['projetid']);
|
$commande->classin($_POST['projetid']);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
*
|
// Ajout commande
|
||||||
*/
|
|
||||||
if ($_POST['action'] == 'add' && $user->rights->commande->creer)
|
if ($_POST['action'] == 'add' && $user->rights->commande->creer)
|
||||||
{
|
{
|
||||||
$datecommande = mktime(12, 0 , 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
$datecommande = mktime(12, 0 , 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||||
@ -95,6 +97,7 @@ if ($_POST['action'] == 'add' && $user->rights->commande->creer)
|
|||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Positionne ref commande client
|
||||||
if ($_POST['action'] == 'set_ref_client' && $user->rights->commande->creer)
|
if ($_POST['action'] == 'set_ref_client' && $user->rights->commande->creer)
|
||||||
{
|
{
|
||||||
$commande = new Commande($db);
|
$commande = new Commande($db);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user