diff --git a/ChangeLog b/ChangeLog index f2b6dd6477181..119aaa13a6296 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,7 @@ Fix: [ bug #1037 ] Consumption> Supplier invoices related Fix: User group name do not display in card (view or edit mode) Fix: Link "Show all supplier invoice" on suplier card not working Fix: [ bug #1039 ] Pre-defined invoices conversion +Fix: If only service module is activated, it's impossible to delete service ***** ChangeLog for 3.4 compared to 3.3.* ***** For users: diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 8d5a3474bf88e..f24c7bf28c622 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -181,6 +181,7 @@ function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn, $avai { $sql = "UPDATE ".MAIN_DB_PREFIX."product_fournisseur_price"; $sql.= " SET fk_user = " . $user->id." ,"; + $sql.= " ref_fourn = \"" . $this->db->escape($ref_fourn) . "\","; $sql.= " price = ".price2num($buyprice).","; $sql.= " quantity = ".$qty.","; $sql.= " remise_percent = ".$remise_percent.","; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 0a45a94e7c8b5..715bbcbdba8cf 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -585,7 +585,7 @@ function delete($id) $error=0; - if ($user->rights->produit->supprimer) + if (($this->type == 0 && $user->rights->produit->supprimer) || ($this->type == 1 && $user->rights->service->supprimer)) { $objectisused = $this->isObjectUsed($id); if (empty($objectisused)) @@ -617,23 +617,12 @@ function delete($id) if (! $result) { $error++; - $this->error = $this->db->lasterror(); + $this->errors[] = $this->db->lasterror(); dol_syslog(get_class($this).'::delete error '.$this->error, LOG_ERR); } } } - // Removed extrafields - if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used - { - $result=$this->deleteExtraFields(); - if ($result < 0) - { - $error++; - dol_syslog(get_class($this).'::delete error '.$this->error, LOG_ERR); - } - } - // Delete product if (! $error) { @@ -644,7 +633,7 @@ function delete($id) if ( ! $resultz ) { $error++; - $this->error = $this->db->lasterror(); + $this->errors[] = $this->db->lasterror(); dol_syslog(get_class($this).'::delete error '.$this->error, LOG_ERR); } } @@ -661,7 +650,7 @@ function delete($id) $res=@dol_delete_dir_recursive($dir); if (! $res) { - $this->error='ErrorFailToDeleteDir'; + $this->errors[] = 'ErrorFailToDeleteDir'; $error++; } } @@ -686,6 +675,11 @@ function delete($id) } else { + foreach($this->errors as $errmsg) + { + dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } $this->db->rollback(); return -$error; } diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index 315ea66b184db..2b23ba4722b9f 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -369,7 +369,7 @@ { $result = $object->delete($object->id); } - + if ($result > 0) { header('Location: '.DOL_URL_ROOT.'/product/liste.php?delprod='.urlencode($object->ref));