New: Add protection to avoid to valid supplier invoice with a ref supplier with value "Copy of ..."
This commit is contained in:
parent
5e046a91cf
commit
3fdc5f1957
@ -559,9 +559,9 @@ class FactureFournisseur extends Facture
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Set invoice status as validated
|
* Set invoice status as validated
|
||||||
* \param user Object user
|
* @param user Object user
|
||||||
* \return int <0 if KO, =0 if nothing to do, >0 if OK
|
* @return int <0 if KO, =0 if nothing to do, >0 if OK
|
||||||
*/
|
*/
|
||||||
function validate($user)
|
function validate($user)
|
||||||
{
|
{
|
||||||
@ -576,6 +576,13 @@ class FactureFournisseur extends Facture
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check parameters
|
||||||
|
if (preg_match('/^'.preg_quote($langs->trans("CopyOf").' ').'/', $this->ref_supplier))
|
||||||
|
{
|
||||||
|
$this->error=$langs->trans("ErrorFieldFormat",$langs->transnoentities("RefSupplier"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn";
|
||||||
|
|||||||
@ -89,6 +89,10 @@ if ($_REQUEST['action'] == 'confirm_valid' && $_REQUEST['confirm'] == 'yes' && $
|
|||||||
$facturefourn=new FactureFournisseur($db);
|
$facturefourn=new FactureFournisseur($db);
|
||||||
$facturefourn->fetch($_GET['facid']);
|
$facturefourn->fetch($_GET['facid']);
|
||||||
$result = $facturefourn->validate($user);
|
$result = $facturefourn->validate($user);
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$mesg='<div class="error">'.$facturefourn->error.'</div>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes')
|
if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes')
|
||||||
@ -626,7 +630,7 @@ else
|
|||||||
/* */
|
/* */
|
||||||
/* *************************************************************************** */
|
/* *************************************************************************** */
|
||||||
|
|
||||||
$now=gmmktime();
|
$now=dol_now();
|
||||||
|
|
||||||
$productstatic = new Product($db);
|
$productstatic = new Product($db);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user