Qual: Uniformize code
This commit is contained in:
parent
326db81983
commit
cc7758b60c
@ -54,7 +54,7 @@ class Commande extends CommonObject
|
|||||||
var $ref_client;
|
var $ref_client;
|
||||||
var $contactid;
|
var $contactid;
|
||||||
var $fk_project;
|
var $fk_project;
|
||||||
var $statut; // -1=Canceled, 0=Draft, 1=Validated, 2=Accepted, 3=Closed (Envoyee/Recue facturee ou non)
|
var $statut; // -1=Canceled, 0=Draft, 1=Validated, 2=Accepted/On process, 3=Closed (Sent/Recevied, billed or not)
|
||||||
|
|
||||||
var $facturee; // Facturee ou non
|
var $facturee; // Facturee ou non
|
||||||
var $brouillon;
|
var $brouillon;
|
||||||
@ -186,6 +186,8 @@ class Commande extends CommonObject
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$now=dol_now();
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
// Definition du nom de module de numerotation de commande
|
// Definition du nom de module de numerotation de commande
|
||||||
@ -209,7 +211,7 @@ class Commande extends CommonObject
|
|||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commande";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."commande";
|
||||||
$sql.= " SET ref = '".$num."'";
|
$sql.= " SET ref = '".$num."'";
|
||||||
$sql.= ", fk_statut = 1";
|
$sql.= ", fk_statut = 1";
|
||||||
$sql.= ", date_valid=".$this->db->idate(mktime());
|
$sql.= ", date_valid=".$this->db->idate($now);
|
||||||
$sql.= ", fk_user_valid = ".$user->id;
|
$sql.= ", fk_user_valid = ".$user->id;
|
||||||
$sql.= " WHERE rowid = ".$this->id;
|
$sql.= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
@ -391,7 +393,7 @@ class Commande extends CommonObject
|
|||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande';
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande';
|
||||||
$sql.= ' SET fk_statut=2';
|
$sql.= ' SET fk_statut=2, facture=0';
|
||||||
$sql.= ' WHERE rowid = '.$this->id;
|
$sql.= ' WHERE rowid = '.$this->id;
|
||||||
|
|
||||||
dol_syslog("Commande::set_reopen sql=".$sql);
|
dol_syslog("Commande::set_reopen sql=".$sql);
|
||||||
|
|||||||
@ -1767,6 +1767,13 @@ else
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reopen a closed order
|
||||||
|
if ($commande->statut == 3)
|
||||||
|
{
|
||||||
|
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$commande->id.'&action=reopen">'.$langs->trans('ReOpen').'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create bill and Classify billed
|
||||||
if ($conf->facture->enabled && $commande->statut > 0 && ! $commande->facturee)
|
if ($conf->facture->enabled && $commande->statut > 0 && ! $commande->facturee)
|
||||||
{
|
{
|
||||||
if ($user->rights->facture->creer)
|
if ($user->rights->facture->creer)
|
||||||
@ -1774,7 +1781,7 @@ else
|
|||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&origin='.$commande->element.'&originid='.$commande->id.'&socid='.$commande->socid.'">'.$langs->trans("CreateBill").'</a>';
|
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&origin='.$commande->element.'&originid='.$commande->id.'&socid='.$commande->socid.'">'.$langs->trans("CreateBill").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user->rights->commande->creer)
|
if ($user->rights->commande->creer && $commande->statut > 2)
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=classifybilled">'.$langs->trans("ClassifyBilled").'</a>';
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=classifybilled">'.$langs->trans("ClassifyBilled").'</a>';
|
||||||
}
|
}
|
||||||
@ -1790,12 +1797,6 @@ else
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reopen a close order
|
|
||||||
if ($commande->statut == 3)
|
|
||||||
{
|
|
||||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$commande->id.'&action=reopen">'.$langs->trans('ReOpen').'</a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clone
|
// Clone
|
||||||
if ($user->rights->commande->creer)
|
if ($user->rights->commande->creer)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user