diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 50034059727..10809b99952 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -579,6 +579,7 @@ class Product extends CommonObject $prod_use = $this->verif_prod_use($id); if ($prod_use == 0) { + // TODO possibility to add external module constraint $elements = array('product_price','product_price_min','product_lang','categorie_product'); foreach($elements as $table) @@ -588,13 +589,14 @@ class Product extends CommonObject $result = $this->db->query($sql); } - $sqlz = "DELETE from ".MAIN_DB_PREFIX."product"; + $sqlz = "DELETE FROM ".MAIN_DB_PREFIX."product"; $sqlz.= " WHERE rowid = ".$id; $resultz = $this->db->query($sqlz); - if ( !$resultz ) + if ( ! $resultz ) { dol_syslog('Product::delete error sqlz='.$sqlz, LOG_ERR); + $error++; } // Appel des triggers diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index 551f87a203b..3b550aeca74 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -1028,7 +1028,7 @@ if ($id || $ref) $picto=($product->type==1?'service':'product'); dol_fiche_head($head, 'card', $titre, 0, $picto); - // Confirmation de la suppression de la facture + // Confirm delete product if ($action == 'delete' || ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX)) { $ret=$html->form_confirm("fiche.php?id=".$product->id,$langs->trans("DeleteProduct"),$langs->trans("ConfirmDeleteProduct"),"confirm_delete",'',0,"action-delete"); diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php index 1605189bb41..dabfe86c10c 100644 --- a/htdocs/product/liste.php +++ b/htdocs/product/liste.php @@ -234,10 +234,7 @@ if ($resql) llxHeader('',$title,$helpurl,''); // Displays product removal confirmation - if (!empty($_GET['delprod'])) - { - print '
'.$langs->trans("ProductDeleted",$_GET['delprod']).'

'; - } + if (GETPOST('delprod')) dol_htmloutput_mesg($langs->trans("ProductDeleted",GETPOST('delprod'))); $param="&sref=".$sref.($sbarcode?"&sbarcode=".$sbarcode:"")."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy; $param.=($fourn_id?"&fourn_id=".$fourn_id:"");