mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
New: Can reopen a closed customer order (removed a deadlock feature)
This commit is contained in:
parent
daeab33c0d
commit
d6ff0f9176
|
|
@ -3,6 +3,7 @@ English Dolibarr ChangeLog
|
|||
***** ChangeLog for 2.9 compared to 2.8 *****
|
||||
|
||||
For users:
|
||||
- New: Can reopen a closed customer order.
|
||||
- New: Add module externalsite to add a web site/tools inside
|
||||
menu and a Dolibarr frame.
|
||||
- New: Can link trips and fees to a project.
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ class Commande extends CommonObject
|
|||
var $ref_client;
|
||||
var $contactid;
|
||||
var $fk_project;
|
||||
var $statut; // -1=Annulee, 0=Brouillon, 1=Validee, 2=Acceptee, 3=Envoyee/Recue (facturee ou non)
|
||||
var $statut; // -1=Canceled, 0=Draft, 1=Validated, 2=Accepted, 3=Closed (Envoyee/Recue facturee ou non)
|
||||
var $facturee; // Facturee ou non
|
||||
var $brouillon;
|
||||
var $cond_reglement_id;
|
||||
|
|
@ -423,6 +423,63 @@ class Commande extends CommonObject
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Tag the order as opened
|
||||
* Function used when order is reopend after being closed.
|
||||
* \param user Object user that change status
|
||||
* \return int <0 if KO, 0 if nothing is done, >0 if OK
|
||||
*/
|
||||
function set_reopen($user)
|
||||
{
|
||||
global $conf,$langs;
|
||||
$error=0;
|
||||
|
||||
if ($this->statut == 3)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande';
|
||||
$sql.= ' SET fk_statut=2';
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
|
||||
dol_syslog("Commande::set_reopen sql=".$sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$this->use_webcal=($conf->global->PHPWEBCALENDAR_BILLSTATUS=='always'?1:0);
|
||||
|
||||
// Appel des triggers
|
||||
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('BILL_REOPEN',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$this->error=$this->db->error();
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Cloture la commande
|
||||
* \param user Objet utilisateur qui cloture
|
||||
|
|
|
|||
|
|
@ -89,6 +89,26 @@ if ($_REQUEST["action"] == 'confirm_clone' && $_REQUEST['confirm'] == 'yes')
|
|||
}
|
||||
}
|
||||
|
||||
// Reopen a closed order
|
||||
if ($_GET['action'] == 'reopen' && $user->rights->commande->creer)
|
||||
{
|
||||
$commande = new Commande($db);
|
||||
$commande->fetch($_GET['id']);
|
||||
if ($commande->statut == 3)
|
||||
{
|
||||
$result = $commande->set_reopen($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET['id']);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$fac->error.'</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Suppression de la commande
|
||||
if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes')
|
||||
{
|
||||
|
|
@ -2131,7 +2151,7 @@ else
|
|||
}
|
||||
}
|
||||
|
||||
// Cloturer
|
||||
// Close
|
||||
if ($commande->statut == 1 || $commande->statut == 2)
|
||||
{
|
||||
if ($user->rights->commande->cloturer)
|
||||
|
|
@ -2141,6 +2161,12 @@ 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
|
||||
if ($user->rights->commande->creer)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user