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);
|
||||||
@ -700,7 +702,7 @@ class Commande extends CommonObject
|
|||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$object=new Commande($this->db);
|
$object=new Commande($this->db);
|
||||||
|
|
||||||
// Instantiate hooks of thirdparty module
|
// Instantiate hooks of thirdparty module
|
||||||
if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules))
|
if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules))
|
||||||
{
|
{
|
||||||
@ -712,7 +714,7 @@ class Commande extends CommonObject
|
|||||||
// Load source object
|
// Load source object
|
||||||
$object->fetch($fromid);
|
$object->fetch($fromid);
|
||||||
$objFrom = $object;
|
$objFrom = $object;
|
||||||
|
|
||||||
$object->id=0;
|
$object->id=0;
|
||||||
$object->statut=0;
|
$object->statut=0;
|
||||||
|
|
||||||
@ -744,7 +746,7 @@ class Commande extends CommonObject
|
|||||||
if ($result < 0) $error++;
|
if ($result < 0) $error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Appel des triggers
|
// Appel des triggers
|
||||||
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
||||||
$interface=new Interfaces($this->db);
|
$interface=new Interfaces($this->db);
|
||||||
@ -880,7 +882,7 @@ class Commande extends CommonObject
|
|||||||
$this->line->total_ttc=$total_ttc;
|
$this->line->total_ttc=$total_ttc;
|
||||||
$this->line->product_type=$type;
|
$this->line->product_type=$type;
|
||||||
$this->line->special_code=$special_code;
|
$this->line->special_code=$special_code;
|
||||||
|
|
||||||
$this->line->date_start=$date_start;
|
$this->line->date_start=$date_start;
|
||||||
$this->line->date_end=$date_end;
|
$this->line->date_end=$date_end;
|
||||||
|
|
||||||
@ -2415,9 +2417,9 @@ class Commande extends CommonObject
|
|||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -1358,7 +1358,7 @@ else
|
|||||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$commande->id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 0, 1);
|
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$commande->id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 0, 1);
|
||||||
if ($ret == 'html') print '<br>';
|
if ($ret == 'html') print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO ajout temporaire pour test en attendant la migration en template
|
* TODO ajout temporaire pour test en attendant la migration en template
|
||||||
*/
|
*/
|
||||||
@ -1657,9 +1657,9 @@ else
|
|||||||
$numlines=0;
|
$numlines=0;
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
$result = $commande->getLinesArray();
|
$result = $commande->getLinesArray();
|
||||||
|
|
||||||
if (!empty($commande->lines))
|
if (!empty($commande->lines))
|
||||||
{
|
{
|
||||||
$commande->print_title_list();
|
$commande->print_title_list();
|
||||||
@ -1766,15 +1766,22 @@ 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)
|
||||||
{
|
{
|
||||||
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