Better error management
This commit is contained in:
parent
cb3f178dbc
commit
7d1d9414c6
@ -512,9 +512,15 @@ class Commande extends CommonObject
|
|||||||
// Clean parameters
|
// Clean parameters
|
||||||
$this->brouillon = 1; // On positionne en mode brouillon la commande
|
$this->brouillon = 1; // On positionne en mode brouillon la commande
|
||||||
|
|
||||||
dol_syslog("Commande::create");
|
dol_syslog("Commande::create user=".$user->id);
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
|
if (empty($this->ref))
|
||||||
|
{
|
||||||
|
$this->error=$langs->trans("ErrorFieldRequired",$langs->trans("Ref"));
|
||||||
|
dol_syslog("Commande::create ".$this->error, LOG_ERR);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
if (! empty($conf->global->COMMANDE_REQUIRE_SOURCE) && $this->source < 0)
|
if (! empty($conf->global->COMMANDE_REQUIRE_SOURCE) && $this->source < 0)
|
||||||
{
|
{
|
||||||
$this->error=$langs->trans("ErrorFieldRequired",$langs->trans("Source"));
|
$this->error=$langs->trans("ErrorFieldRequired",$langs->trans("Source"));
|
||||||
|
|||||||
@ -147,6 +147,14 @@ class Facture extends CommonObject
|
|||||||
|
|
||||||
dol_syslog("Facture::Create user=".$user->id);
|
dol_syslog("Facture::Create user=".$user->id);
|
||||||
|
|
||||||
|
// Check parameters
|
||||||
|
if (empty($this->ref))
|
||||||
|
{
|
||||||
|
$this->error=$langs->trans("ErrorFieldRequired",$langs->trans("Ref"));
|
||||||
|
dol_syslog("Facture::create ".$this->error, LOG_ERR);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
$soc = new Societe($this->db);
|
$soc = new Societe($this->db);
|
||||||
$soc->fetch($this->socid);
|
$soc->fetch($this->socid);
|
||||||
|
|
||||||
|
|||||||
@ -518,14 +518,23 @@ class Propal extends CommonObject
|
|||||||
{
|
{
|
||||||
global $langs,$conf,$mysoc;
|
global $langs,$conf,$mysoc;
|
||||||
|
|
||||||
// on verifie si la ref n'est pas utilisee
|
|
||||||
$soc = new Societe($this->db);
|
|
||||||
$soc->fetch($this->socid);
|
|
||||||
$this->verifyNumRef($soc);
|
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
$this->fin_validite = $this->datep + ($this->duree_validite * 24 * 3600);
|
$this->fin_validite = $this->datep + ($this->duree_validite * 24 * 3600);
|
||||||
|
|
||||||
|
dol_syslog("Propal::Create");
|
||||||
|
|
||||||
|
// Check parameters
|
||||||
|
if (empty($this->ref))
|
||||||
|
{
|
||||||
|
$this->error=$langs->trans("ErrorFieldRequired",$langs->trans("Ref"));
|
||||||
|
dol_syslog("Facture::create ".$this->error, LOG_ERR);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
$soc = new Societe($this->db);
|
||||||
|
$soc->fetch($this->socid);
|
||||||
|
$this->verifyNumRef($soc); // Check ref is not yet used
|
||||||
|
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$this->fetch_client();
|
$this->fetch_client();
|
||||||
|
|||||||
@ -469,9 +469,9 @@ class User extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Charge dans l'objet user, la liste des permissions auxquelles l'utilisateur a droit
|
* \brief Charge dans l'objet user, la liste des permissions auxquelles l'utilisateur a droit
|
||||||
\param moduletag nom du module dont il faut recuperer les droits ('' par defaut signifie tous les droits)
|
* \param moduletag nom du module dont il faut recuperer les droits ('' par defaut signifie tous les droits)
|
||||||
*/
|
*/
|
||||||
function getrights($moduletag='')
|
function getrights($moduletag='')
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|||||||
@ -11,3 +11,6 @@
|
|||||||
delete from llx_facture where facnumber = '(PROV)';
|
delete from llx_facture where facnumber = '(PROV)';
|
||||||
delete from llx_commande where ref = '(PROV)';
|
delete from llx_commande where ref = '(PROV)';
|
||||||
delete from llx_propal where ref = '(PROV)';
|
delete from llx_propal where ref = '(PROV)';
|
||||||
|
delete from llx_facture where facnumber = '';
|
||||||
|
delete from llx_commande where ref = '';
|
||||||
|
delete from llx_propal where ref = '';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user