diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 7c8ce40e3e9..f3de1a7cbe1 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -559,9 +559,9 @@ class FactureFournisseur extends Facture } /** - * \brief Set invoice status as validated - * \param user Object user - * \return int <0 if KO, =0 if nothing to do, >0 if OK + * Set invoice status as validated + * @param user Object user + * @return int <0 if KO, =0 if nothing to do, >0 if OK */ function validate($user) { @@ -576,6 +576,13 @@ class FactureFournisseur extends Facture 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(); $sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn"; diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 294d1fdc632..c7b049134da 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -89,6 +89,10 @@ if ($_REQUEST['action'] == 'confirm_valid' && $_REQUEST['confirm'] == 'yes' && $ $facturefourn=new FactureFournisseur($db); $facturefourn->fetch($_GET['facid']); $result = $facturefourn->validate($user); + if ($result < 0) + { + $mesg='