Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/3.4' into 3.4_backported
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Aug 27, 2013
2 parents 94cc966 + 9cf2d8c commit 126d239
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 16 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions htdocs/fourn/class/fournisseur.product.class.php
Expand Up @@ -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.",";
Expand Down
24 changes: 9 additions & 15 deletions htdocs/product/class/product.class.php
Expand Up @@ -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))
Expand Down Expand Up @@ -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)
{
Expand All @@ -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);
}
}
Expand All @@ -661,7 +650,7 @@ function delete($id)
$res=@dol_delete_dir_recursive($dir);
if (! $res)
{
$this->error='ErrorFailToDeleteDir';
$this->errors[] = 'ErrorFailToDeleteDir';
$error++;
}
}
Expand All @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion htdocs/product/fiche.php
Expand Up @@ -369,7 +369,7 @@
{
$result = $object->delete($object->id);
}

if ($result > 0)
{
header('Location: '.DOL_URL_ROOT.'/product/liste.php?delprod='.urlencode($object->ref));
Expand Down

0 comments on commit 126d239

Please sign in to comment.