Merge pull request #168 from grandoc/develop

update approve function
This commit is contained in:
Regis Houssin 2012-04-16 03:20:00 -07:00
commit 65b9d6281d

View File

@ -658,6 +658,7 @@ class CommandeFournisseur extends Commande
function approve($user, $idwarehouse=0)
{
global $langs,$conf;
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
$error=0;
@ -667,6 +668,20 @@ class CommandeFournisseur extends Commande
{
$this->db->begin();
// Definition du nom de modele de numerotation de commande
$soc = new Societe($this->db);
$soc->fetch($this->fourn_id);
// Check if object has a temporary ref
if (preg_match('/^[\(]?PROV/i', $this->ref))
{
$num = $this->getNextNumRef($soc);
}
else
{
$num = $this->ref;
}
$sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur";
$sql.= " SET ref='".$this->db->escape($num)."',";
$sql.= " fk_statut = 2,";
@ -1885,4 +1900,4 @@ class CommandeFournisseurLigne extends OrderLine
}
}
?>
?>