Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2012-09-17 01:39:49 +02:00
commit 9ab0653902
2 changed files with 15 additions and 9 deletions

View File

@ -255,7 +255,7 @@ class Product extends CommonObject
return -2; 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(); $now=dol_now();
@ -294,10 +294,10 @@ class Product extends CommonObject
$sql.= $this->db->idate($now); $sql.= $this->db->idate($now);
$sql.= ", ".$conf->entity; $sql.= ", ".$conf->entity;
$sql.= ", '".$this->db->escape($this->ref)."'"; $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_ht);
$sql.= ", ".price2num($price_min_ttc); $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.= ", ".$user->id;
$sql.= ", ".$this->type; $sql.= ", ".$this->type;
$sql.= ", ".price2num($price_ht); $sql.= ", ".price2num($price_ht);
@ -328,12 +328,15 @@ class Product extends CommonObject
{ {
if ($this->update($id, $user, true) > 0) if ($this->update($id, $user, true) > 0)
{ {
// FIXME: not use here
/*
if ($this->catid > 0) if ($this->catid > 0)
{ {
require_once DOL_DOCUMENT_ROOT .'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT .'/categories/class/categorie.class.php';
$cat = new Categorie($this->db, $this->catid); $cat = new Categorie($this->db, $this->catid);
$cat->add_type($this,"product"); $cat->add_type($this,"product");
} }
*/
} }
else else
{ {

View File

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