Fix: wrong permission

This commit is contained in:
Regis Houssin
2012-09-16 21:12:55 +02:00
parent df3227ef7e
commit ada85df649
2 changed files with 15 additions and 9 deletions

View File

@@ -255,7 +255,7 @@ class Product extends CommonObject
return -2;
}
dol_syslog(get_class($this)."::create ref=".$this->ref." price=".$this->price." price_ttc=".$this->price_ttc." tva_tx=".$this->tva_tx." price_base_type=".$this->price_base_type." Category : ".$this->catid, LOG_DEBUG);
dol_syslog(get_class($this)."::create ref=".$this->ref." price=".$this->price." price_ttc=".$this->price_ttc." tva_tx=".$this->tva_tx." price_base_type=".$this->price_base_type, LOG_DEBUG);
$now=dol_now();
@@ -294,10 +294,10 @@ class Product extends CommonObject
$sql.= $this->db->idate($now);
$sql.= ", ".$conf->entity;
$sql.= ", '".$this->db->escape($this->ref)."'";
$sql.= ", ".($this->ref_ext?"'".$this->db->escape($this->ref_ext)."'":"null");
$sql.= ", ".(! empty($this->ref_ext)?"'".$this->db->escape($this->ref_ext)."'":"null");
$sql.= ", ".price2num($price_min_ht);
$sql.= ", ".price2num($price_min_ttc);
$sql.= ", ".($this->libelle?"'".$this->db->escape($this->libelle)."'":"null");
$sql.= ", ".(! empty($this->libelle)?"'".$this->db->escape($this->libelle)."'":"null");
$sql.= ", ".$user->id;
$sql.= ", ".$this->type;
$sql.= ", ".price2num($price_ht);
@@ -328,12 +328,15 @@ class Product extends CommonObject
{
if ($this->update($id, $user, true) > 0)
{
// FIXME: not use here
/*
if ($this->catid > 0)
{
require_once DOL_DOCUMENT_ROOT .'/categories/class/categorie.class.php';
$cat = new Categorie($this->db, $this->catid);
$cat->add_type($this,"product");
}
*/
}
else
{
@@ -1027,12 +1030,12 @@ class Product extends CommonObject
$this->localtax2_tx = $localtax2;
$this->_log_price($user,$level);
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('PRODUCT_PRICE_MODIFY',$this,$user,$langs,$conf);
if ($result < 0)
if ($result < 0)
{
$error++; $this->errors=$interface->errors;
}

View File

@@ -200,7 +200,7 @@ if (empty($reshook))
{
for($i=2;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++)
{
if($_POST["price_".$i])
if (isset($_POST["price_".$i]))
{
$object->multiprices["$i"] = price2num($_POST["price_".$i],'MU');
$object->multiprices_base_type["$i"] = $_POST["multiprices_base_type_".$i];
@@ -710,7 +710,8 @@ else
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="type" value="'.$type.'">'."\n";
if (! empty($modCodeProduct->code_auto)) print '<input type="hidden" name="code_auto" value="1">';
if (! empty($modCodeProduct->code_auto))
print '<input type="hidden" name="code_auto" value="1">';
if ($type==1) $title=$langs->trans("NewService");
else $title=$langs->trans("NewProduct");
@@ -720,7 +721,9 @@ else
print '<table class="border" width="100%">';
print '<tr>';
if (! empty($modCodeProduct->code_auto)) $tmpcode=$modCodeProduct->getNextValue($object,$type);
$tmpcode='';
if (! empty($modCodeProduct->code_auto))
$tmpcode=$modCodeProduct->getNextValue($object,$type);
print '<td class="fieldrequired" width="20%">'.$langs->trans("Ref").'</td><td><input name="ref" size="40" maxlength="32" value="'.$tmpcode.'">';
if ($_error)
{
@@ -1340,7 +1343,7 @@ if ($action == '' || $action == 'view')
if (($object->type == 0 && $user->rights->produit->supprimer)
|| ($object->type == 1 && $user->rights->service->supprimer))
{
if (! $object_is_used && isset($object->no_button_delete) && $object->no_button_delete <> 1)
if (empty($object_is_used) && (! isset($object->no_button_delete) || $object->no_button_delete <> 1))
{
if (! empty($conf->use_javascript_ajax))
{