allow chaining and remove header exit

This commit is contained in:
frederic34 2015-11-07 09:49:25 +01:00
parent 80ec28f9c0
commit becce332dd
2 changed files with 11 additions and 4 deletions

View File

@ -946,16 +946,24 @@ class CommandeFournisseur extends CommonOrder
dol_syslog(get_class($this)."::commande", LOG_DEBUG);
if ($this->db->query($sql))
{
$this->statut = 3;
$this->methode_commande_id = $methode;
$this->date_commande = $this->db->idate($date);
$result = 1;
$this->log($user, 3, $date, $comment);
}
else
{
$this->error = $this->db->lasterror();
$this->errors[] = $this->db->lasterror();
$result = -1;
}
}
else
{
$result = -1;
$this->error = 'Not Authorized';
$this->errors[] = 'Not Authorized';
dol_syslog(get_class($this)."::commande User not Authorized", LOG_ERR);
}
return $result ;

View File

@ -704,15 +704,14 @@ if (empty($reshook))
if ($action == 'confirm_commande' && $confirm == 'yes' && $user->rights->fournisseur->commande->commander)
{
$result = $object->commande($user, $_REQUEST["datecommande"], $_REQUEST["methode"], $_REQUEST['comment']);
$result = $object->commande($user, $_REQUEST["datecommande"], $_REQUEST["methode"], $_REQUEST['comment']);
if ($result > 0)
{
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id);
exit;
}
$action = '';
}
else
{
setEventMessages($object->error, $object->errors, 'errors');