Merge remote-tracking branch 'origin/3.4' into develop

Conflicts:
	htdocs/product/class/product.class.php
This commit is contained in:
Laurent Destailleur 2013-08-27 09:36:54 +02:00
commit 1f6d0ab3ef
4 changed files with 88 additions and 92 deletions

View File

@ -114,6 +114,7 @@ Fix: [ bug #1037 ] Consumption> Supplier invoices related
Fix: User group name do not display in card (view or edit mode) 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: Link "Show all supplier invoice" on suplier card not working
Fix: [ bug #1039 ] Pre-defined invoices conversion 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.* ***** ***** ChangeLog for 3.4 compared to 3.3.* *****
For users: For users:

View File

@ -181,6 +181,7 @@ class ProductFournisseur extends Product
{ {
$sql = "UPDATE ".MAIN_DB_PREFIX."product_fournisseur_price"; $sql = "UPDATE ".MAIN_DB_PREFIX."product_fournisseur_price";
$sql.= " SET fk_user = " . $user->id." ,"; $sql.= " SET fk_user = " . $user->id." ,";
$sql.= " ref_fourn = \"" . $this->db->escape($ref_fourn) . "\",";
$sql.= " price = ".price2num($buyprice).","; $sql.= " price = ".price2num($buyprice).",";
$sql.= " quantity = ".$qty.","; $sql.= " quantity = ".$qty.",";
$sql.= " remise_percent = ".$remise_percent.","; $sql.= " remise_percent = ".$remise_percent.",";

View File

@ -597,7 +597,7 @@ class Product extends CommonObject
$error=0; $error=0;
if (($this->type==0 && !$user->rights->produit->supprimer) || ($this->type==1 && !$user->rights->service->supprimer)) if (($this->type == 0 && empty($user->rights->produit->supprimer)) || ($this->type == 1 && empty($user->rights->service->supprimer)))
{ {
$this->error = "ErrorForbidden"; $this->error = "ErrorForbidden";
return 0; return 0;
@ -633,23 +633,12 @@ class Product extends CommonObject
if (! $result) if (! $result)
{ {
$error++; $error++;
$this->error = $this->db->lasterror(); $this->errors[] = $this->db->lasterror();
dol_syslog(get_class($this).'::delete error '.$this->error, LOG_ERR); 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 // Delete product
if (! $error) if (! $error)
{ {
@ -660,7 +649,7 @@ class Product extends CommonObject
if ( ! $resultz ) if ( ! $resultz )
{ {
$error++; $error++;
$this->error = $this->db->lasterror(); $this->errors[] = $this->db->lasterror();
dol_syslog(get_class($this).'::delete error '.$this->error, LOG_ERR); dol_syslog(get_class($this).'::delete error '.$this->error, LOG_ERR);
} }
} }
@ -677,7 +666,7 @@ class Product extends CommonObject
$res=@dol_delete_dir_recursive($dir); $res=@dol_delete_dir_recursive($dir);
if (! $res) if (! $res)
{ {
$this->error='ErrorFailToDeleteDir'; $this->errors[] = 'ErrorFailToDeleteDir';
$error++; $error++;
} }
} }
@ -702,6 +691,11 @@ class Product extends CommonObject
} }
else else
{ {
foreach($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg);
}
$this->db->rollback(); $this->db->rollback();
return -$error; return -$error;
} }