diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index 904a4182f4c..7f1621651df 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -43,7 +43,7 @@ $langs->load("other"); if ($conf->stock->enabled) $langs->load("stocks"); if ($conf->facture->enabled) $langs->load("bills"); -$mesg = ''; $error=0; $errors=array(); +$mesg=''; $error=0; $errors=array(); $id=GETPOST('id'); $ref=GETPOST('ref'); @@ -89,393 +89,394 @@ if (empty($reshook)) { if ($action == 'setproductaccountancycodebuy') { - $product = new Product($db); - $result=$product->fetch($id,$ref); - $product->accountancy_code_buy=$_POST["productaccountancycodebuy"]; - $result=$product->update($product->id,$user,1,0,1); - if ($result < 0) - { - $mesg=join(',',$product->errors); - } - $action=""; - $id=$_POST["id"]; - $_GET["id"]=$_POST["id"]; + $product = new Product($db); + $result=$product->fetch($id,$ref); + $product->accountancy_code_buy=$_POST["productaccountancycodebuy"]; + $result=$product->update($product->id,$user,1,0,1); + if ($result < 0) + { + $mesg=join(',',$product->errors); + } + $action=""; + $id=$_POST["id"]; + $_GET["id"]=$_POST["id"]; } if ($action == 'setproductaccountancycodesell') { - $product = new Product($db); - $result=$product->fetch($id,$ref); - $product->accountancy_code_sell=$_POST["productaccountancycodesell"]; - $result=$product->update($product->id,$user,1,0,1); - if ($result < 0) - { - $mesg=join(',',$product->errors); - } - $action=""; + $product = new Product($db); + $result=$product->fetch($id,$ref); + $product->accountancy_code_sell=$_POST["productaccountancycodesell"]; + $result=$product->update($product->id,$user,1,0,1); + if ($result < 0) + { + $mesg=join(',',$product->errors); + } + $action=""; } if ($action == 'fastappro') { - $product = new Product($db); - $result=$product->fetch($id,$ref); - $result=$product->fastappro($user); - Header("Location: fiche.php?id=".$product->id); - exit; + $product = new Product($db); + $result=$product->fetch($id,$ref); + $result=$product->fastappro($user); + Header("Location: fiche.php?id=".$product->id); + exit; } // Add a product or service if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service->creer)) { - $error=0; + $error=0; - if (empty($_POST["libelle"])) - { - $mesg='
'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Label')).'
'; - $action = "create"; - $_GET["canvas"] = $_POST["canvas"]; - $_GET["type"] = $_POST["type"]; - $error++; - } - if (empty($ref)) - { - $mesg='
'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Ref')).'
'; - $action = "create"; - $_GET["canvas"] = $_POST["canvas"]; - $_GET["type"] = $_POST["type"]; - $error++; - } + if (empty($_POST["libelle"])) + { + $mesg='
'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Label')).'
'; + $action = "create"; + $_GET["canvas"] = $_POST["canvas"]; + $_GET["type"] = $_POST["type"]; + $error++; + } + if (empty($ref)) + { + $mesg='
'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Ref')).'
'; + $action = "create"; + $_GET["canvas"] = $_POST["canvas"]; + $_GET["type"] = $_POST["type"]; + $error++; + } - $product=new Product($db); + $product=new Product($db); - if (! $error) - { - $product->ref = $ref; - $product->libelle = $_POST["libelle"]; - $product->price_base_type = $_POST["price_base_type"]; - if ($product->price_base_type == 'TTC') $product->price_ttc = $_POST["price"]; - else $product->price = $_POST["price"]; - if ($product->price_base_type == 'TTC') $product->price_min_ttc = $_POST["price_min"]; - else $product->price_min = $_POST["price_min"]; - $product->tva_tx = $_POST["tva_tx"]; + if (! $error) + { + $product->ref = $ref; + $product->libelle = $_POST["libelle"]; + $product->price_base_type = $_POST["price_base_type"]; + if ($product->price_base_type == 'TTC') $product->price_ttc = $_POST["price"]; + else $product->price = $_POST["price"]; + if ($product->price_base_type == 'TTC') $product->price_min_ttc = $_POST["price_min"]; + else $product->price_min = $_POST["price_min"]; + $product->tva_tx = $_POST["tva_tx"]; - // local taxes. - $product->localtax1_tx = get_localtax($product->tva_tx,1); - $product->localtax2_tx = get_localtax($product->tva_tx,2); + // local taxes. + $product->localtax1_tx = get_localtax($product->tva_tx,1); + $product->localtax2_tx = get_localtax($product->tva_tx,2); - $product->type = $_POST["type"]; - $product->status = $_POST["statut"]; - $product->status_buy = $_POST["statut_buy"]; - $product->description = dol_htmlcleanlastbr($_POST["desc"]); - $product->note = dol_htmlcleanlastbr($_POST["note"]); + $product->type = $_POST["type"]; + $product->status = $_POST["statut"]; + $product->status_buy = $_POST["statut_buy"]; + $product->description = dol_htmlcleanlastbr($_POST["desc"]); + $product->note = dol_htmlcleanlastbr($_POST["note"]); $product->customcode = $_POST["customcode"]; $product->country_id = $_POST["country_id"]; - $product->duration_value = $_POST["duration_value"]; - $product->duration_unit = $_POST["duration_unit"]; - $product->seuil_stock_alerte = $_POST["seuil_stock_alerte"]?$_POST["seuil_stock_alerte"]:0; - $product->canvas = $_POST["canvas"]; - $product->weight = $_POST["weight"]; - $product->weight_units = $_POST["weight_units"]; - $product->length = $_POST["size"]; - $product->length_units = $_POST["size_units"]; - $product->surface = $_POST["surface"]; - $product->surface_units = $_POST["surface_units"]; - $product->volume = $_POST["volume"]; - $product->volume_units = $_POST["volume_units"]; - $product->finished = $_POST["finished"]; - $product->hidden = $_POST["hidden"]=='yes'?1:0; + $product->duration_value = $_POST["duration_value"]; + $product->duration_unit = $_POST["duration_unit"]; + $product->seuil_stock_alerte = $_POST["seuil_stock_alerte"]?$_POST["seuil_stock_alerte"]:0; + $product->canvas = $_POST["canvas"]; + $product->weight = $_POST["weight"]; + $product->weight_units = $_POST["weight_units"]; + $product->length = $_POST["size"]; + $product->length_units = $_POST["size_units"]; + $product->surface = $_POST["surface"]; + $product->surface_units = $_POST["surface_units"]; + $product->volume = $_POST["volume"]; + $product->volume_units = $_POST["volume_units"]; + $product->finished = $_POST["finished"]; + $product->hidden = $_POST["hidden"]=='yes'?1:0; - // MultiPrix - if($conf->global->PRODUIT_MULTIPRICES) - { - for($i=2;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++) - { - if($_POST["price_".$i]) - { - $product->multiprices["$i"] = price2num($_POST["price_".$i],'MU'); - $product->multiprices_base_type["$i"] = $_POST["multiprices_base_type_".$i]; - } - else - { - $product->multiprices["$i"] = ""; - } - } - } + // MultiPrix + if($conf->global->PRODUIT_MULTIPRICES) + { + for($i=2;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++) + { + if($_POST["price_".$i]) + { + $product->multiprices["$i"] = price2num($_POST["price_".$i],'MU'); + $product->multiprices_base_type["$i"] = $_POST["multiprices_base_type_".$i]; + } + else + { + $product->multiprices["$i"] = ""; + } + } + } - $id = $product->create($user); + $id = $product->create($user); - if ($id > 0) - { - Header("Location: fiche.php?id=".$id); - exit; - } - else - { - $mesg='
'.$langs->trans($product->error).'
'; - $action = "create"; - $_GET["type"] = $_POST["type"]; - } - } + if ($id > 0) + { + Header("Location: fiche.php?id=".$id); + exit; + } + else + { + $mesg='
'.$langs->trans($product->error).'
'; + $action = "create"; + $_GET["type"] = $_POST["type"]; + } + } } // Update a product or service if ($action == 'update' && ($user->rights->produit->creer || $user->rights->service->creer)) { - if (! empty($_POST["cancel"])) - { - $action = ''; - } - else - { - $product=new Product($db); - if ($product->fetch($id,$ref)) - { - $product->ref = $ref; - $product->libelle = $_POST["libelle"]; - $product->description = dol_htmlcleanlastbr($_POST["desc"]); - $product->note = dol_htmlcleanlastbr($_POST["note"]); + if (! empty($_POST["cancel"])) + { + $action = ''; + } + else + { + $product=new Product($db); + if ($product->fetch($id,$ref)) + { + $product->ref = $ref; + $product->libelle = $_POST["libelle"]; + $product->description = dol_htmlcleanlastbr($_POST["desc"]); + $product->note = dol_htmlcleanlastbr($_POST["note"]); $product->customcode = $_POST["customcode"]; $product->country_id = $_POST["country_id"]; - $product->status = $_POST["statut"]; - $product->status_buy = $_POST["statut_buy"]; - $product->seuil_stock_alerte = $_POST["seuil_stock_alerte"]; - $product->duration_value = $_POST["duration_value"]; - $product->duration_unit = $_POST["duration_unit"]; - $product->canvas = $_POST["canvas"]; - $product->weight = $_POST["weight"]; - $product->weight_units = $_POST["weight_units"]; - $product->length = $_POST["size"]; - $product->length_units = $_POST["size_units"]; - $product->surface = $_POST["surface"]; - $product->surface_units = $_POST["surface_units"]; - $product->volume = $_POST["volume"]; - $product->volume_units = $_POST["volume_units"]; - $product->finished = $_POST["finished"]; - $product->hidden = $_POST["hidden"]=='yes'?1:0; + $product->status = $_POST["statut"]; + $product->status_buy = $_POST["statut_buy"]; + $product->seuil_stock_alerte = $_POST["seuil_stock_alerte"]; + $product->duration_value = $_POST["duration_value"]; + $product->duration_unit = $_POST["duration_unit"]; + $product->canvas = $_POST["canvas"]; + $product->weight = $_POST["weight"]; + $product->weight_units = $_POST["weight_units"]; + $product->length = $_POST["size"]; + $product->length_units = $_POST["size_units"]; + $product->surface = $_POST["surface"]; + $product->surface_units = $_POST["surface_units"]; + $product->volume = $_POST["volume"]; + $product->volume_units = $_POST["volume_units"]; + $product->finished = $_POST["finished"]; + $product->hidden = $_POST["hidden"]=='yes'?1:0; - if ($product->check()) - { - if ($product->update($product->id, $user) > 0) - { - $action = ''; - } - else - { - $action = 'edit'; - $mesg = $product->error; - } - } - else - { - $action = 'edit'; - $mesg = $langs->trans("ErrorProductBadRefOrLabel"); - } - } - } + if ($product->check()) + { + if ($product->update($product->id, $user) > 0) + { + $action = ''; + } + else + { + $action = 'edit'; + $mesg = $product->error; + } + } + else + { + $action = 'edit'; + $mesg = $langs->trans("ErrorProductBadRefOrLabel"); + } + } + } } // Action clone object if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->produit->creer || $user->rights->service->creer)) { - if (! GETPOST('clone_content') && ! GETPOST('clone_prices') ) - { - $mesg='
'.$langs->trans("NoCloneOptionsSpecified").'
'; - } - else - { - $db->begin(); + if (! GETPOST('clone_content') && ! GETPOST('clone_prices') ) + { + $mesg='
'.$langs->trans("NoCloneOptionsSpecified").'
'; + } + else + { + $db->begin(); - $product = new Product($db); - $originalId = $id; - if ($product->fetch($id,$ref) > 0) - { - $product->ref = GETPOST('clone_ref'); - $product->status = 0; - $product->status_buy = 0; - $product->finished = 1; - $product->id = null; + $product = new Product($db); + $originalId = $id; + if ($product->fetch($id,$ref) > 0) + { + $product->ref = GETPOST('clone_ref'); + $product->status = 0; + $product->status_buy = 0; + $product->finished = 1; + $product->id = null; - if ($product->check()) - { - $id = $product->create($user); - if ($id > 0) - { - // $product->clone_fournisseurs($originalId, $id); + if ($product->check()) + { + $id = $product->create($user); + if ($id > 0) + { + // $product->clone_fournisseurs($originalId, $id); - $db->commit(); - $db->close(); + $db->commit(); + $db->close(); - Header("Location: fiche.php?id=$id"); - exit; - } - else - { - if ($product->error == 'ErrorProductAlreadyExists') - { - $db->rollback(); + Header("Location: fiche.php?id=$id"); + exit; + } + else + { + if ($product->error == 'ErrorProductAlreadyExists') + { + $db->rollback(); - $_error = 1; - $action = ""; + $_error = 1; + $action = ""; - $mesg='
'.$langs->trans("ErrorProductAlreadyExists",$product->ref); - $mesg.=' '.$langs->trans("ShowCardHere").'.'; - $mesg.='
'; - //dol_print_error($product->db); - } - else - { - $db->rollback(); - dol_print_error($product->db); - } - } - } - } - else - { - $db->rollback(); - dol_print_error($product->db); - } - } + $mesg='
'.$langs->trans("ErrorProductAlreadyExists",$product->ref); + $mesg.=' '.$langs->trans("ShowCardHere").'.'; + $mesg.='
'; + //dol_print_error($product->db); + } + else + { + $db->rollback(); + dol_print_error($product->db); + } + } + } + } + else + { + $db->rollback(); + dol_print_error($product->db); + } + } } // Delete a product if ($action == 'confirm_delete' && $confirm == 'yes') { - $object = new Product($db); - $object->fetch($id,$ref); + $object = new Product($db); + $object->fetch($id,$ref); - if ( ($object->type == 0 && $user->rights->produit->supprimer) || ($object->type == 1 && $user->rights->service->supprimer) ) - { - $result = $object->delete($id); - } + if ( ($object->type == 0 && $user->rights->produit->supprimer) || ($object->type == 1 && $user->rights->service->supprimer) ) + { + $result = $object->delete($id); + } - if ($result > 0) - { - Header('Location: '.DOL_URL_ROOT.'/product/liste.php?delprod='.urlencode($object->ref)); - exit; - } - else - { - $mesg=$object->error; - $reload = 0; - $action=''; - } + if ($result > 0) + { + Header('Location: '.DOL_URL_ROOT.'/product/liste.php?delprod='.urlencode($object->ref)); + exit; + } + else + { + $mesg=$object->error; + $reload = 0; + $action=''; + } } // Add product into proposal if ($action == 'addinpropal') { - $propal = new Propal($db); - $result=$propal->fetch($_POST["propalid"]); - if ($result <= 0) - { - dol_print_error($db,$propal->error); - exit; - } + $propal = new Propal($db); + $result=$propal->fetch($_POST["propalid"]); + if ($result <= 0) + { + dol_print_error($db,$propal->error); + exit; + } - $soc = new Societe($db); - $result=$soc->fetch($propal->socid); - if ($result <= 0) - { - dol_print_error($db,$soc->error); - exit; - } + $soc = new Societe($db); + $result=$soc->fetch($propal->socid); + if ($result <= 0) + { + dol_print_error($db,$soc->error); + exit; + } - $prod = new Product($db); - $result=$prod->fetch($id,$ref); - if ($result <= 0) - { - dol_print_error($db,$prod->error); - exit; - } + $prod = new Product($db); + $result=$prod->fetch($id,$ref); + if ($result <= 0) + { + dol_print_error($db,$prod->error); + exit; + } - $desc = $prod->description; + $desc = $prod->description; - $tva_tx = get_default_tva($mysoc, $soc, $prod->id); - $localtax1_tx= get_localtax($tva_tx, 1, $soc); - $localtax2_tx= get_localtax($tva_tx, 2, $soc); + $tva_tx = get_default_tva($mysoc, $soc, $prod->id); + $localtax1_tx= get_localtax($tva_tx, 1, $soc); + $localtax2_tx= get_localtax($tva_tx, 2, $soc); $pu_ht = $prod->price; $pu_ttc = $prod->price_ttc; $price_base_type = $prod->price_base_type; - // If multiprice - if ($conf->global->PRODUIT_MULTIPRICES && $soc->price_level) - { - $pu_ht = $prod->multiprices[$soc->price_level]; - $pu_ttc = $prod->multiprices_ttc[$soc->price_level]; - $price_base_type = $prod->multiprices_base_type[$soc->price_level]; - } + // If multiprice + if ($conf->global->PRODUIT_MULTIPRICES && $soc->price_level) + { + $pu_ht = $prod->multiprices[$soc->price_level]; + $pu_ttc = $prod->multiprices_ttc[$soc->price_level]; + $price_base_type = $prod->multiprices_base_type[$soc->price_level]; + } - // On reevalue prix selon taux tva car taux tva transaction peut etre different - // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). - if ($tva_tx != $prod->tva_tx) - { - if ($price_base_type != 'HT') - { - $pu_ht = price2num($pu_ttc / (1 + ($tva_tx/100)), 'MU'); - } - else - { - $pu_ttc = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU'); - } - } + // On reevalue prix selon taux tva car taux tva transaction peut etre different + // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). + if ($tva_tx != $prod->tva_tx) + { + if ($price_base_type != 'HT') + { + $pu_ht = price2num($pu_ttc / (1 + ($tva_tx/100)), 'MU'); + } + else + { + $pu_ttc = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU'); + } + } - $result = $propal->addline($propal->id, - $desc, - $pu_ht, - $_POST["qty"], - $tva_tx, - $localtax1_tx, // localtax1 - $localtax2_tx, // localtax2 - $prod->id, - $_POST["remise_percent"], - $price_base_type, - $pu_ttc - ); - if ($result > 0) - { - Header("Location: ".DOL_URL_ROOT."/comm/propal.php?id=".$propal->id); - return; - } + $result = $propal->addline( + $propal->id, + $desc, + $pu_ht, + $_POST["qty"], + $tva_tx, + $localtax1_tx, // localtax1 + $localtax2_tx, // localtax2 + $prod->id, + $_POST["remise_percent"], + $price_base_type, + $pu_ttc + ); + if ($result > 0) + { + Header("Location: ".DOL_URL_ROOT."/comm/propal.php?id=".$propal->id); + return; + } - $mesg = $langs->trans("ErrorUnknown").": $result"; + $mesg = $langs->trans("ErrorUnknown").": $result"; } // Add product into order if ($action == 'addincommande') { - $commande = new Commande($db); - $result=$commande->fetch($_POST["commandeid"]); - if ($result <= 0) - { - dol_print_error($db,$commande->error); - exit; - } + $commande = new Commande($db); + $result=$commande->fetch($_POST["commandeid"]); + if ($result <= 0) + { + dol_print_error($db,$commande->error); + exit; + } - $soc = new Societe($db); - $result=$soc->fetch($commande->socid); - if ($result <= 0) - { - dol_print_error($db,$soc->error); - exit; - } + $soc = new Societe($db); + $result=$soc->fetch($commande->socid); + if ($result <= 0) + { + dol_print_error($db,$soc->error); + exit; + } - $prod = new Product($db); - $result=$prod->fetch($id,$ref); - if ($result <= 0) - { - dol_print_error($db,$prod->error); - exit; - } + $prod = new Product($db); + $result=$prod->fetch($id,$ref); + if ($result <= 0) + { + dol_print_error($db,$prod->error); + exit; + } - $desc = $prod->description; + $desc = $prod->description; - $tva_tx = get_default_tva($mysoc, $soc, $prod->id); - $localtax1_tx= get_localtax($tva_tx, 1, $soc); - $localtax2_tx= get_localtax($tva_tx, 2, $soc); + $tva_tx = get_default_tva($mysoc, $soc, $prod->id); + $localtax1_tx= get_localtax($tva_tx, 1, $soc); + $localtax2_tx= get_localtax($tva_tx, 2, $soc); $pu_ht = $prod->price; @@ -490,74 +491,75 @@ if (empty($reshook)) $price_base_type = $prod->multiprices_base_type[$soc->price_level]; } - // On reevalue prix selon taux tva car taux tva transaction peut etre different - // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). - if ($tva_tx != $prod->tva_tx) - { - if ($price_base_type != 'HT') - { - $pu_ht = price2num($pu_ttc / (1 + ($tva_tx/100)), 'MU'); - } - else - { - $pu_ttc = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU'); - } - } + // On reevalue prix selon taux tva car taux tva transaction peut etre different + // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). + if ($tva_tx != $prod->tva_tx) + { + if ($price_base_type != 'HT') + { + $pu_ht = price2num($pu_ttc / (1 + ($tva_tx/100)), 'MU'); + } + else + { + $pu_ttc = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU'); + } + } - $result = $commande->addline($commande->id, - $desc, - $pu_ht, - $_POST["qty"], - $tva_tx, - $localtax1_tx, // localtax1 - $localtax2_tx, // localtax2 - $prod->id, - $_POST["remise_percent"], - '', - '', //Todo: voir si fk_remise_except est encore valable car n'apparait plus dans les propales - $price_base_type, - $pu_ttc - ); + $result = $commande->addline( + $commande->id, + $desc, + $pu_ht, + $_POST["qty"], + $tva_tx, + $localtax1_tx, // localtax1 + $localtax2_tx, // localtax2 + $prod->id, + $_POST["remise_percent"], + '', + '', //Todo: voir si fk_remise_except est encore valable car n'apparait plus dans les propales + $price_base_type, + $pu_ttc + ); - if ($result > 0) - { - Header("Location: ".DOL_URL_ROOT."/commande/fiche.php?id=".$commande->id); - exit; - } + if ($result > 0) + { + Header("Location: ".DOL_URL_ROOT."/commande/fiche.php?id=".$commande->id); + exit; + } } // Add product into invoice if ($action == 'addinfacture' && $user->rights->facture->creer) { - $facture = New Facture($db); - $result=$facture->fetch($_POST["factureid"]); - if ($result <= 0) - { - dol_print_error($db,$facture->error); - exit; - } + $facture = New Facture($db); + $result=$facture->fetch($_POST["factureid"]); + if ($result <= 0) + { + dol_print_error($db,$facture->error); + exit; + } - $soc = new Societe($db); - $soc->fetch($facture->socid); - if ($result <= 0) - { - dol_print_error($db,$soc->error); - exit; - } + $soc = new Societe($db); + $soc->fetch($facture->socid); + if ($result <= 0) + { + dol_print_error($db,$soc->error); + exit; + } - $prod = new Product($db); - $result = $prod->fetch($id,$ref); - if ($result <= 0) - { - dol_print_error($db,$prod->error); - exit; - } + $prod = new Product($db); + $result = $prod->fetch($id,$ref); + if ($result <= 0) + { + dol_print_error($db,$prod->error); + exit; + } - $desc = $prod->description; + $desc = $prod->description; - $tva_tx = get_default_tva($mysoc, $soc, $prod->id); - $localtax1_tx= get_localtax($tva_tx, 1, $soc); - $localtax2_tx= get_localtax($tva_tx, 2, $soc); + $tva_tx = get_default_tva($mysoc, $soc, $prod->id); + $localtax1_tx= get_localtax($tva_tx, 1, $soc); + $localtax2_tx= get_localtax($tva_tx, 2, $soc); $pu_ht = $prod->price; $pu_ttc = $prod->price_ttc; @@ -571,51 +573,52 @@ if (empty($reshook)) $price_base_type = $prod->multiprices_base_type[$soc->price_level]; } - // On reevalue prix selon taux tva car taux tva transaction peut etre different - // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). - if ($tva_tx != $prod->tva_tx) - { - if ($price_base_type != 'HT') - { - $pu_ht = price2num($pu_ttc / (1 + ($tva_tx/100)), 'MU'); - } - else - { - $pu_ttc = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU'); - } - } + // On reevalue prix selon taux tva car taux tva transaction peut etre different + // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). + if ($tva_tx != $prod->tva_tx) + { + if ($price_base_type != 'HT') + { + $pu_ht = price2num($pu_ttc / (1 + ($tva_tx/100)), 'MU'); + } + else + { + $pu_ttc = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU'); + } + } - $result = $facture->addline($facture->id, - $desc, - $pu_ht, - $_POST["qty"], - $tva_tx, - $localtax1_tx, - $localtax2_tx, - $prod->id, - $_POST["remise_percent"], - '', - '', - '', - '', - '', - $price_base_type, - $pu_ttc - ); + $result = $facture->addline( + $facture->id, + $desc, + $pu_ht, + $_POST["qty"], + $tva_tx, + $localtax1_tx, + $localtax2_tx, + $prod->id, + $_POST["remise_percent"], + '', + '', + '', + '', + '', + $price_base_type, + $pu_ttc + ); - if ($result > 0) - { - Header("Location: ".DOL_URL_ROOT."/compta/facture.php?facid=".$facture->id); - exit; - } + if ($result > 0) + { + Header("Location: ".DOL_URL_ROOT."/compta/facture.php?facid=".$facture->id); + exit; + } } } if (GETPOST("cancel") == $langs->trans("Cancel")) { - $action = ''; - Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$_POST["id"]); - exit; + $action = ''; + Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$_POST["id"]); + exit; } @@ -641,10 +644,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) // When used with CANVAS // ----------------------------------------- if (! $objcanvas->hasActions() && ($id || $ref)) - { - $object = new Product($db); - $object->fetch($id, $ref); // For use with "pure canvas" (canvas that contains templates only) - } + { + $object = new Product($db); + $object->fetch($id, $ref); // For use with "pure canvas" (canvas that contains templates only) + } $objcanvas->assign_values($action, $id, $ref); // Set value for templates $objcanvas->display_canvas(); // Show template } @@ -655,106 +658,106 @@ else // ----------------------------------------- if ($action == 'create' && ($user->rights->produit->creer || $user->rights->service->creer)) { - print '
'; - print ''; - print ''; - print ''."\n"; + print ''; + print ''; + print ''; + print ''."\n"; - if ($_GET["type"]==1) $title=$langs->trans("NewService"); - else $title=$langs->trans("NewProduct"); - print_fiche_titre($title); + if ($_GET["type"]==1) $title=$langs->trans("NewService"); + else $title=$langs->trans("NewProduct"); + print_fiche_titre($title); - dol_htmloutput_mesg($mesg); + dol_htmloutput_mesg($mesg); - print ''; - print ''; - print ''; + print '
'.$langs->trans("Ref").''; - if ($_error == 1) - { - print $langs->trans("RefAlreadyExists"); - } - print '
'; + print ''; + print ''; - // Label - print ''; + // Label + print ''; - // On sell - print ''; + // On sell + print ''; - // To buy - print ''; + // To buy + print ''; - // Stock min level - if ($_GET["type"] != 1 && $conf->stock->enabled) - { - print ''; - } - else - { - print ''; - } + // Stock min level + if ($_GET["type"] != 1 && $conf->stock->enabled) + { + print ''; + } + else + { + print ''; + } - // Description (used in invoice, propal...) - print '"; + print ""; - // Nature - if ($_GET["type"] != 1) - { - print ''; - } + // Nature + if ($_GET["type"] != 1) + { + print ''; + } - //Duration - if ($_GET["type"] == 1) - { - print ''; - } + //Duration + if ($_GET["type"] == 1) + { + print ''; + } - if ($_GET["type"] != 1) // Le poids et le volume ne concerne que les produits et pas les services - { - // Weight - print ''; - // Length - print ''; - // Surface - print ''; - // Volume - print ''; - } + if ($_GET["type"] != 1) // Le poids et le volume ne concerne que les produits et pas les services + { + // Weight + print ''; + // Length + print ''; + // Surface + print ''; + // Volume + print ''; + } // Custom code print ''; @@ -765,50 +768,50 @@ else if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); print ''; - // Note (invisible sur facture, propales...) - print '"; - print '
'.$langs->trans("Ref").''; + if ($_error == 1) + { + print $langs->trans("RefAlreadyExists"); + } + print '
'.$langs->trans("Label").'
'.$langs->trans("Label").'
'.$langs->trans("Status").' ('.$langs->trans("Sell").')'.''; - $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell")); - print $html->selectarray('statut',$statutarray,$_POST["statut"]); - print '
'.$langs->trans("Status").' ('.$langs->trans("Sell").')'; + $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell")); + print $html->selectarray('statut',$statutarray,$_POST["statut"]); + print '
'.$langs->trans("Status").' ('.$langs->trans("Buy").')'.''; - $statutarray=array('1' => $langs->trans("ProductStatusOnBuy"), '0' => $langs->trans("ProductStatusNotOnBuy")); - print $html->selectarray('statut_buy',$statutarray,$_POST["statut_buy"]); - print '
'.$langs->trans("Status").' ('.$langs->trans("Buy").')'; + $statutarray=array('1' => $langs->trans("ProductStatusOnBuy"), '0' => $langs->trans("ProductStatusNotOnBuy")); + print $html->selectarray('statut_buy',$statutarray,$_POST["statut_buy"]); + print '
'.$langs->trans("StockLimit").''; - print ''; - print '
'.$langs->trans("StockLimit").''; + print ''; + print '
'.$langs->trans("Description").''; + // Description (used in invoice, propal...) + print '
'.$langs->trans("Description").''; - require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); - $doleditor=new DolEditor('desc',$_POST["desc"],'',160,'dolibarr_notes','',false,true,$conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,4,90); - $doleditor->Create(); + require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); + $doleditor=new DolEditor('desc',$_POST["desc"],'',160,'dolibarr_notes','',false,true,$conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,4,90); + $doleditor->Create(); - print "
'.$langs->trans("Nature").''; - $statutarray=array('1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial")); - print $html->selectarray('finished',$statutarray,$_POST["finished"]); - print '
'.$langs->trans("Nature").''; + $statutarray=array('1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial")); + print $html->selectarray('finished',$statutarray,$_POST["finished"]); + print '
'.$langs->trans("Duration").'  '; - print ''.$langs->trans("Hour").' '; - print ''.$langs->trans("Day").' '; - print ''.$langs->trans("Week").' '; - print ''.$langs->trans("Month").' '; - print ''.$langs->trans("Year").' '; - print '
'.$langs->trans("Duration").'  '; + print ''.$langs->trans("Hour").' '; + print ''.$langs->trans("Day").' '; + print ''.$langs->trans("Week").' '; + print ''.$langs->trans("Month").' '; + print ''.$langs->trans("Year").' '; + print '
'.$langs->trans("Weight").''; - print ''; - print $formproduct->select_measuring_units("weight_units","weight"); - print '
'.$langs->trans("Length").''; - print ''; - print $formproduct->select_measuring_units("size_units","size"); - print '
'.$langs->trans("Surface").''; - print ''; - print $formproduct->select_measuring_units("surface_units","surface"); - print '
'.$langs->trans("Volume").''; - print ''; - print $formproduct->select_measuring_units("volume_units","volume"); - print '
'.$langs->trans("Weight").''; + print ''; + print $formproduct->select_measuring_units("weight_units","weight"); + print '
'.$langs->trans("Length").''; + print ''; + print $formproduct->select_measuring_units("size_units","size"); + print '
'.$langs->trans("Surface").''; + print ''; + print $formproduct->select_measuring_units("surface_units","surface"); + print '
'.$langs->trans("Volume").''; + print ''; + print $formproduct->select_measuring_units("volume_units","volume"); + print '
'.$langs->trans("CustomCode").'
'.$langs->trans("NoteNotVisibleOnBill").''; - require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); - $doleditor=new DolEditor('note',$_POST["note"],'',180,'dolibarr_notes','',false,true,$conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,8,70); - $doleditor->Create(); + // Note (invisible sur facture, propales...) + print '
'.$langs->trans("NoteNotVisibleOnBill").''; + require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); + $doleditor=new DolEditor('note',$_POST["note"],'',180,'dolibarr_notes','',false,true,$conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,8,70); + $doleditor->Create(); - print "
'; + print ""; + print ''; - print '
'; + print '
'; - if ($conf->global->PRODUIT_MULTIPRICES) - { - // We do no show price array on create when multiprices enabled. - // We must set them on prices tab. - } - else - { - print ''; + if ($conf->global->PRODUIT_MULTIPRICES) + { + // We do no show price array on create when multiprices enabled. + // We must set them on prices tab. + } + else + { + print '
'; - // PRIX - print ''; - print ''; + // PRIX + print ''; + print ''; - // MIN PRICE - print ''; - print ''; + // MIN PRICE + print ''; + print ''; - // VAT - print ''; + // VAT + print ''; - print '
'.$langs->trans("SellingPrice").''; - print $html->select_PriceBaseType($product->price_base_type, "price_base_type"); - print '
'.$langs->trans("SellingPrice").''; + print $html->select_PriceBaseType($product->price_base_type, "price_base_type"); + print '
'.$langs->trans("MinPrice").''; - print '
'.$langs->trans("MinPrice").''; + print '
'.$langs->trans("VATRate").''; - print $html->load_tva("tva_tx",-1,$mysoc,''); - print '
'.$langs->trans("VATRate").''; + print $html->load_tva("tva_tx",-1,$mysoc,''); + print '
'; + print ''; - print '
'; - } + print '
'; + } - print '
'; + print '
'; - print '
'; + print ''; } /** @@ -817,134 +820,134 @@ else if ($id || $ref) { - $object=new Product($db); - $object->fetch($id,$ref); + $object=new Product($db); + $object->fetch($id,$ref); - /* - * Fiche en mode edition - */ - if ($action == 'edit' && ($user->rights->produit->creer || $user->rights->service->creer)) - { - $type = $langs->trans('Product'); - if ($object->isservice()) $type = $langs->trans('Service'); - print_fiche_titre($langs->trans('Modify').' '.$type.' : '.$object->ref, ""); + /* + * Fiche en mode edition + */ + if ($action == 'edit' && ($user->rights->produit->creer || $user->rights->service->creer)) + { + $type = $langs->trans('Product'); + if ($object->isservice()) $type = $langs->trans('Service'); + print_fiche_titre($langs->trans('Modify').' '.$type.' : '.$object->ref, ""); - dol_htmloutput_errors($mesg); + dol_htmloutput_errors($mesg); - // Main official, simple, and not duplicated code - print '
'."\n"; - print ''; - print ''; - print ''; - print ''; - print ''; + // Main official, simple, and not duplicated code + print ''."\n"; + print ''; + print ''; + print ''; + print ''; + print '
'; - // Ref - print ''; + // Ref + print ''; - // Label - print ''; + // Label + print ''; - // Status - print ''; + // Status + print ''; - // To Buy - print ''; + // To Buy + print ''; - // Description (used in invoice, propal...) - print '"; - print "\n"; + // Description (used in invoice, propal...) + print '"; + print "\n"; - // Nature - if($object->type!=1) - { - print ''; - } + // Nature + if($object->type!=1) + { + print ''; + } - if ($object->isproduct() && $conf->stock->enabled) - { - print "".''; - } - else - { - print ''; - } + if ($object->isproduct() && $conf->stock->enabled) + { + print "".''; + } + else + { + print ''; + } - if ($object->isservice()) - { - // Duration - print ''; - } - else - { - // Weight - print ''; - // Length - print ''; - // Surface - print ''; - // Volume - print ''; - } + print ''; + } + else + { + // Weight + print ''; + // Length + print ''; + // Surface + print ''; + // Volume + print ''; + } // Custom code print ''; @@ -955,162 +958,162 @@ else if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); print ''; - // Note - print '"; - print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").'
'.$langs->trans("Label").'
'.$langs->trans("Label").'
'.$langs->trans("Status").' ('.$langs->trans("Sell").')'.''; - print ''; - print '
'.$langs->trans("Status").' ('.$langs->trans("Sell").')'; + print ''; + print '
'.$langs->trans("Status").' ('.$langs->trans("Buy").')'.''; - print ''; - print '
'.$langs->trans("Status").' ('.$langs->trans("Buy").')'; + print ''; + print '
'.$langs->trans("Description").''; - require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); - $doleditor=new DolEditor('desc',$object->description,'',160,'dolibarr_notes','',false,true,$conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,4,90); - $doleditor->Create(); - print "
'.$langs->trans("Description").''; + require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); + $doleditor=new DolEditor('desc',$object->description,'',160,'dolibarr_notes','',false,true,$conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,4,90); + $doleditor->Create(); + print "
'.$langs->trans("Nature").''; - $statutarray=array('-1'=>' ', '1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial")); - print $html->selectarray('finished',$statutarray,$object->finished); - print '
'.$langs->trans("Nature").''; + $statutarray=array('-1'=>' ', '1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial")); + print $html->selectarray('finished',$statutarray,$object->finished); + print '
'.$langs->trans("StockLimit").''; - print ''; - print '
'.$langs->trans("StockLimit").''; + print ''; + print '
'.$langs->trans("Duration").''; - print '  '; - print 'duration_unit=='h'?' checked':'').'>'.$langs->trans("Hour"); - print '  '; - print 'duration_unit=='d'?' checked':'').'>'.$langs->trans("Day"); - print '  '; - print 'duration_unit=='w'?' checked':'').'>'.$langs->trans("Week"); - print '  '; - print 'duration_unit=='m'?' checked':'').'>'.$langs->trans("Month"); - print '  '; - print 'duration_unit=='y'?' checked':'').'>'.$langs->trans("Year"); + if ($object->isservice()) + { + // Duration + print '
'.$langs->trans("Duration").''; + print '  '; + print 'duration_unit=='h'?' checked':'').'>'.$langs->trans("Hour"); + print '  '; + print 'duration_unit=='d'?' checked':'').'>'.$langs->trans("Day"); + print '  '; + print 'duration_unit=='w'?' checked':'').'>'.$langs->trans("Week"); + print '  '; + print 'duration_unit=='m'?' checked':'').'>'.$langs->trans("Month"); + print '  '; + print 'duration_unit=='y'?' checked':'').'>'.$langs->trans("Year"); - print '
'.$langs->trans("Weight").''; - print ' '; - print $formproduct->select_measuring_units("weight_units", "weight", $object->weight_units); - print '
'.$langs->trans("Length").''; - print ' '; - print $formproduct->select_measuring_units("size_units", "size", $object->length_units); - print '
'.$langs->trans("Surface").''; - print ' '; - print $formproduct->select_measuring_units("surface_units", "surface", $object->surface_units); - print '
'.$langs->trans("Volume").''; - print ' '; - print $formproduct->select_measuring_units("volume_units", "volume", $object->volume_units); - print '
'.$langs->trans("Weight").''; + print ' '; + print $formproduct->select_measuring_units("weight_units", "weight", $object->weight_units); + print '
'.$langs->trans("Length").''; + print ' '; + print $formproduct->select_measuring_units("size_units", "size", $object->length_units); + print '
'.$langs->trans("Surface").''; + print ' '; + print $formproduct->select_measuring_units("surface_units", "surface", $object->surface_units); + print '
'.$langs->trans("Volume").''; + print ' '; + print $formproduct->select_measuring_units("volume_units", "volume", $object->volume_units); + print '
'.$langs->trans("CustomCode").'
'.$langs->trans("NoteNotVisibleOnBill").''; - require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); - $doleditor=new DolEditor('note',$object->note,'',200,'dolibarr_notes','',false,true,$conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,8,70); - $doleditor->Create(); - print "
'; + // Note + print ''.$langs->trans("NoteNotVisibleOnBill").''; + require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); + $doleditor=new DolEditor('note',$object->note,'',200,'dolibarr_notes','',false,true,$conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,8,70); + $doleditor->Create(); + print ""; + print ''; - print '
'; + print '
'; - print '
    '; - print '
'; + print '
    '; + print '
'; - print '
'; - } - /* - * Fiche en mode visu - */ - else - { - $head=product_prepare_head($object, $user); - $titre=$langs->trans("CardProduct".$object->type); - $picto=($object->type==1?'service':'product'); - dol_fiche_head($head, 'card', $titre, 0, $picto); + print ''; + } + /* + * Fiche en mode visu + */ + else + { + $head=product_prepare_head($object, $user); + $titre=$langs->trans("CardProduct".$object->type); + $picto=($object->type==1?'service':'product'); + dol_fiche_head($head, 'card', $titre, 0, $picto); - // Confirm delete product - if ($action == 'delete' || $conf->use_javascript_ajax) - { - $ret=$html->form_confirm("fiche.php?id=".$object->id,$langs->trans("DeleteProduct"),$langs->trans("ConfirmDeleteProduct"),"confirm_delete",'',0,"action-delete"); - if ($ret == 'html') print '
'; - } + // Confirm delete product + if ($action == 'delete' || $conf->use_javascript_ajax) + { + $ret=$html->form_confirm("fiche.php?id=".$object->id,$langs->trans("DeleteProduct"),$langs->trans("ConfirmDeleteProduct"),"confirm_delete",'',0,"action-delete"); + if ($ret == 'html') print '
'; + } $isphoto=$object->is_photo_available($conf->product->dir_output); - // En mode visu - print ''; + // En mode visu + print '
'; - // Ref - print ''; + // Ref + print ''; - print ''; + print ''; - // Label - print ''; + // Label + print ''; - $nblignes=9; - if ($object->type!=1) $nblignes++; - if ($object->isservice()) $nblignes++; - else $nblignes+=4; + $nblignes=9; + if ($object->type!=1) $nblignes++; + if ($object->isservice()) $nblignes++; + else $nblignes+=4; - if ($isphoto) - { - // Photo - print ''; - } + if ($isphoto) + { + // Photo + print ''; + } - print ''; + print ''; - // Accountancy sell code - print ''; + // Accountancy sell code + print ''; - // Accountancy buy code - print ''; + // Accountancy buy code + print ''; - // Status (to sell) - print ''; + // Status (to sell) + print ''; - // Status (to buy) - print ''; + // Status (to buy) + print ''; - // Description - print ''; + // Description + print ''; - // Nature - if($object->type!=1) - { - print ''; - } + // Nature + if($object->type!=1) + { + print ''; + } - if ($object->isservice()) - { - // Duration - print ''; - } - else - { - // Weight - print '\n"; - // Length - print '\n"; - // Surface - print '\n"; - // Volume - print '\n"; - } + print ''; + } + else + { + // Weight + print '\n"; + // Length + print '\n"; + // Surface + print '\n"; + // Volume + print '\n"; + } // Custom code print ''; @@ -1119,19 +1122,19 @@ else print ''; - // Note - print ''; + // Note + print ''; - print "
'.$langs->trans("Ref").''; - print $html->showrefnav($object,'ref','',1,'ref'); - print ''.$langs->trans("Ref").''; + print $html->showrefnav($object,'ref','',1,'ref'); + print '
'.$langs->trans("Label").''.$object->libelle.'
'.$langs->trans("Label").''.$object->libelle.''; - print $object->show_photos($conf->product->dir_output,1,1,0,0,0,80); - print ''; + print $object->show_photos($conf->product->dir_output,1,1,0,0,0,80); + print '
'.$html->editfieldkey("ProductAccountancySellCode",'productaccountancycodesell',$object->accountancy_code_sell,'id',$object->id,$user->rights->produit->creer).''; - print $html->editfieldval("ProductAccountancySellCode",'productaccountancycodesell',$object->accountancy_code_sell,'id',$object->id,$user->rights->produit->creer); - print '
'.$html->editfieldkey("ProductAccountancySellCode",'productaccountancycodesell',$object->accountancy_code_sell,'id',$object->id,$user->rights->produit->creer).''; + print $html->editfieldval("ProductAccountancySellCode",'productaccountancycodesell',$object->accountancy_code_sell,'id',$object->id,$user->rights->produit->creer); + print '
'.$html->editfieldkey("ProductAccountancyBuyCode",'productaccountancycodebuy',$object->accountancy_code_buy,'id',$object->id,$user->rights->produit->creer).''; - print $html->editfieldval("ProductAccountancyBuyCode",'productaccountancycodebuy',$object->accountancy_code_buy,'id',$object->id,$user->rights->produit->creer); - print '
'.$html->editfieldkey("ProductAccountancyBuyCode",'productaccountancycodebuy',$object->accountancy_code_buy,'id',$object->id,$user->rights->produit->creer).''; + print $html->editfieldval("ProductAccountancyBuyCode",'productaccountancycodebuy',$object->accountancy_code_buy,'id',$object->id,$user->rights->produit->creer); + print '
'.$langs->trans("Status").' ('.$langs->trans("Sell").')'.''; - print $object->getLibStatut(2,0); - print '
'.$langs->trans("Status").' ('.$langs->trans("Sell").')'; + print $object->getLibStatut(2,0); + print '
'.$langs->trans("Status").' ('.$langs->trans("Buy").')'.''; - print $object->getLibStatut(2,1); - print '
'.$langs->trans("Status").' ('.$langs->trans("Buy").')'; + print $object->getLibStatut(2,1); + print '
'.$langs->trans("Description").''.(dol_textishtml($object->description)?$object->description:dol_nl2br($object->description,1,true)).'
'.$langs->trans("Description").''.(dol_textishtml($object->description)?$object->description:dol_nl2br($object->description,1,true)).'
'.$langs->trans("Nature").''; - print $object->getLibFinished(); - print '
'.$langs->trans("Nature").''; + print $object->getLibFinished(); + print '
'.$langs->trans("Duration").''.$object->duration_value.' '; - if ($object->duration_value > 1) - { - $dur=array("h"=>$langs->trans("Hours"),"d"=>$langs->trans("Days"),"w"=>$langs->trans("Weeks"),"m"=>$langs->trans("Months"),"y"=>$langs->trans("Years")); - } - else if ($object->duration_value > 0) - { - $dur=array("h"=>$langs->trans("Hour"),"d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year")); - } - print $langs->trans($dur[$object->duration_unit])." "; + if ($object->isservice()) + { + // Duration + print '
'.$langs->trans("Duration").''.$object->duration_value.' '; + if ($object->duration_value > 1) + { + $dur=array("h"=>$langs->trans("Hours"),"d"=>$langs->trans("Days"),"w"=>$langs->trans("Weeks"),"m"=>$langs->trans("Months"),"y"=>$langs->trans("Years")); + } + else if ($object->duration_value > 0) + { + $dur=array("h"=>$langs->trans("Hour"),"d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year")); + } + print $langs->trans($dur[$object->duration_unit])." "; - print '
'.$langs->trans("Weight").''; - if ($object->weight != '') - { - print $object->weight." ".measuring_units_string($object->weight_units,"weight"); - } - else - { - print ' '; - } - print "
'.$langs->trans("Length").''; - if ($object->length != '') - { - print $object->length." ".measuring_units_string($object->length_units,"size"); - } - else - { - print ' '; - } - print "
'.$langs->trans("Surface").''; - if ($object->surface != '') - { - print $object->surface." ".measuring_units_string($object->surface_units,"surface"); - } - else - { - print ' '; - } - print "
'.$langs->trans("Volume").''; - if ($object->volume != '') - { - print $object->volume." ".measuring_units_string($object->volume_units,"volume"); - } - else - { - print ' '; - } - print "
'.$langs->trans("Weight").''; + if ($object->weight != '') + { + print $object->weight." ".measuring_units_string($object->weight_units,"weight"); + } + else + { + print ' '; + } + print "
'.$langs->trans("Length").''; + if ($object->length != '') + { + print $object->length." ".measuring_units_string($object->length_units,"size"); + } + else + { + print ' '; + } + print "
'.$langs->trans("Surface").''; + if ($object->surface != '') + { + print $object->surface." ".measuring_units_string($object->surface_units,"surface"); + } + else + { + print ' '; + } + print "
'.$langs->trans("Volume").''; + if ($object->volume != '') + { + print $object->volume." ".measuring_units_string($object->volume_units,"volume"); + } + else + { + print ' '; + } + print "
'.$langs->trans("CustomCode").''.$object->customcode.'
'.$langs->trans("CountryOrigin").''.getCountry($object->country_id,0,$db).'
'.$langs->trans("Note").''.(dol_textishtml($object->note)?$object->note:dol_nl2br($object->note,1,true)).'
'.$langs->trans("Note").''.(dol_textishtml($object->note)?$object->note:dol_nl2br($object->note,1,true)).'
\n"; + print "\n"; - dol_fiche_end(); - } + dol_fiche_end(); + } } else if ($action != 'create') { - Header("Location: index.php"); - exit; + Header("Location: index.php"); + exit; } } @@ -1139,15 +1142,15 @@ else // Clone confirmation if ($action == 'clone' || $conf->use_javascript_ajax) { - // Create an array for form - $formquestion=array( + // Create an array for form + $formquestion=array( 'text' => $langs->trans("ConfirmClone"), - array('type' => 'text', 'name' => 'clone_ref','label' => $langs->trans("NewRefForClone"), 'value' => $langs->trans("CopyOf").' '.$object->ref, 'size'=>24), - array('type' => 'checkbox', 'name' => 'clone_content','label' => $langs->trans("CloneContentProduct"), 'value' => 1), - array('type' => 'checkbox', 'name' => 'clone_prices', 'label' => $langs->trans("ClonePricesProduct").' ('.$langs->trans("FeatureNotYetAvailable").')', 'value' => 0, 'disabled' => true) - ); - // Paiement incomplet. On demande si motif = escompte ou autre - $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneProduct'),$langs->trans('ConfirmCloneProduct',$object->ref),'confirm_clone',$formquestion,'yes','action-clone',230,600); + array('type' => 'text', 'name' => 'clone_ref','label' => $langs->trans("NewRefForClone"), 'value' => $langs->trans("CopyOf").' '.$object->ref, 'size'=>24), + array('type' => 'checkbox', 'name' => 'clone_content','label' => $langs->trans("CloneContentProduct"), 'value' => 1), + array('type' => 'checkbox', 'name' => 'clone_prices', 'label' => $langs->trans("ClonePricesProduct").' ('.$langs->trans("FeatureNotYetAvailable").')', 'value' => 0, 'disabled' => true) + ); + // Paiement incomplet. On demande si motif = escompte ou autre + $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneProduct'),$langs->trans('ConfirmCloneProduct',$object->ref),'confirm_clone',$formquestion,'yes','action-clone',230,600); } @@ -1159,46 +1162,49 @@ if ($action == 'clone' || $conf->use_javascript_ajax) print "\n".'
'."\n"; -if ($action == '') +if ($action == '' || $action == 'view') { - if ($user->rights->produit->creer || $user->rights->service->creer) - { - if ($object->no_button_edit <> 1) - print 'id.'">'.$langs->trans("Modify").''; + if ($user->rights->produit->creer || $user->rights->service->creer) + { + if ($object->no_button_edit <> 1) print 'id.'">'.$langs->trans("Modify").''; - if ($object->no_button_copy <> 1) { - if ($conf->use_javascript_ajax) { - print ''.$langs->trans('ToClone').''."\n"; - } else { - print 'id.'">'.$langs->trans("ToClone").''; - } - } - } + if ($object->no_button_copy <> 1) + { + if ($conf->use_javascript_ajax) + { + print ''.$langs->trans('ToClone').''."\n"; + } + else + { + print 'id.'">'.$langs->trans("ToClone").''; + } + } + } - $object_is_used = $object->isObjectUsed($object->id); - if (($object->type == 0 && $user->rights->produit->supprimer) - || ($object->type == 1 && $user->rights->service->supprimer)) - { - if (! $object_is_used && $object->no_button_delete <> 1) - { - if ($conf->use_javascript_ajax) - { - print ''.$langs->trans('Delete').''."\n"; - } - else - { - print 'id.'">'.$langs->trans("Delete").''; - } - } - else - { - print ''.$langs->trans("Delete").''; - } - } - else - { - print ''.$langs->trans("Delete").''; - } + $object_is_used = $object->isObjectUsed($object->id); + if (($object->type == 0 && $user->rights->produit->supprimer) + || ($object->type == 1 && $user->rights->service->supprimer)) + { + if (! $object_is_used && $object->no_button_delete <> 1) + { + if ($conf->use_javascript_ajax) + { + print ''.$langs->trans('Delete').''."\n"; + } + else + { + print 'id.'">'.$langs->trans("Delete").''; + } + } + else + { + print ''.$langs->trans("Delete").''; + } + } + else + { + print ''.$langs->trans("Delete").''; + } } print "\n

\n"; @@ -1208,394 +1214,394 @@ print "\n
\n"; * All the "Add to" areas */ -if ($object->id && $action == '' && $object->status) +if ($object->id && ($action == '' || $action == 'view') && $object->status) { - print ''; + print '
'; - // Propals - if($conf->propal->enabled && $user->rights->propale->creer) - { - $propal = new Propal($db); + // Propals + if($conf->propal->enabled && $user->rights->propale->creer) + { + $propal = new Propal($db); - $langs->load("propal"); + $langs->load("propal"); - print ''; + print ''; - if ($user->rights->societe->client->voir) - { - print ''; - } - else - { - print ''; - } + if ($user->rights->societe->client->voir) + { + print ''; + } + else + { + print ''; + } - print ''; + print ''; - // Liste de "Mes propals" - print 'rights->societe->client->voir?' width="50%"':'').' valign="top">'; + // Liste de "Mes propals" + print 'rights->societe->client->voir?' width="50%"':'').' valign="top">'; - $sql = "SELECT s.nom, s.rowid as socid, p.rowid as propalid, p.ref, p.datep as dp"; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p"; - $sql.= " WHERE p.fk_soc = s.rowid"; - $sql.= " AND p.entity = ".$conf->entity; - $sql.= " AND p.fk_statut = 0"; - $sql.= " AND p.fk_user_author = ".$user->id; - $sql.= " ORDER BY p.datec DESC, p.tms DESC"; + $sql = "SELECT s.nom, s.rowid as socid, p.rowid as propalid, p.ref, p.datep as dp"; + $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p"; + $sql.= " WHERE p.fk_soc = s.rowid"; + $sql.= " AND p.entity = ".$conf->entity; + $sql.= " AND p.fk_statut = 0"; + $sql.= " AND p.fk_user_author = ".$user->id; + $sql.= " ORDER BY p.datec DESC, p.tms DESC"; - $result=$db->query($sql); - if ($result) - { - $var=true; - $num = $db->num_rows($result); - print '
'; - print $langs->trans("AddToMyProposals") . '
'; + print $langs->trans("AddToMyProposals") . ''; - print $langs->trans("AddToOtherProposals").' '; + print $langs->trans("AddToOtherProposals").' 
'; - if ($num) - { - $i = 0; - while ($i < $num) - { - $objp = $db->fetch_object($result); - $var=!$var; - print ''; - print ''; - print ''; - print ""; - print '\n"; - print "\n"; - print "\n"; - print ''; - print ''; - print ''; - $i++; - } - } - else { - print ""; - } - print "
'; - print "propalid."\">".img_object($langs->trans("ShowPropal"),"propal")." ".$objp->ref."socid."\">".dol_trunc($objp->nom,18)."".dol_print_date($objp->dp,"%d %b")."'; - print ''.$langs->trans("ReductionShort"); - print '%'; - print " ".$object->stock_proposition; - print ''; - print ''; - print '
"; - print $langs->trans("NoOpenedPropals"); - print "
"; - $db->free($result); - } + $result=$db->query($sql); + if ($result) + { + $var=true; + $num = $db->num_rows($result); + print ''; + if ($num) + { + $i = 0; + while ($i < $num) + { + $objp = $db->fetch_object($result); + $var=!$var; + print ''; + print ''; + print ''; + print ""; + print '\n"; + print "\n"; + print "\n"; + print ''; + print ''; + print ''; + $i++; + } + } + else { + print ""; + } + print "
'; + print "propalid."\">".img_object($langs->trans("ShowPropal"),"propal")." ".$objp->ref."socid."\">".dol_trunc($objp->nom,18)."".dol_print_date($objp->dp,"%d %b")."'; + print ''.$langs->trans("ReductionShort"); + print '%'; + print " ".$object->stock_proposition; + print ''; + print ''; + print '
"; + print $langs->trans("NoOpenedPropals"); + print "
"; + $db->free($result); + } - print ''; + print ''; - if ($user->rights->societe->client->voir) - { - // Liste de "Other propals" - print ''; + if ($user->rights->societe->client->voir) + { + // Liste de "Other propals" + print ''; - $var=true; - $otherprop = $propal->liste_array(1,1,1); - print '
'; - print ''; - print ''; - if (is_array($otherprop) && count($otherprop)) - { - $var=!$var; - print ''; - print ''; - } - else - { - print "'; - } - print '
'; - print ''; - print $langs->trans("OtherPropals").''; - print $html->selectarray("propalid", $otherprop); - print '
'.$langs->trans("Qty"); - print ''.$langs->trans("ReductionShort"); - print '%'; - print ''; - print ''; - print '
"; - print $langs->trans("NoOtherOpenedPropals"); - print '
'; - print '
'; + $var=true; + $otherprop = $propal->liste_array(1,1,1); + print '
'; + print ''; + print ''; + if (is_array($otherprop) && count($otherprop)) + { + $var=!$var; + print ''; + print ''; + } + else + { + print "'; + } + print '
'; + print ''; + print $langs->trans("OtherPropals").''; + print $html->selectarray("propalid", $otherprop); + print '
'.$langs->trans("Qty"); + print ''.$langs->trans("ReductionShort"); + print '%'; + print ''; + print ''; + print '
"; + print $langs->trans("NoOtherOpenedPropals"); + print '
'; + print '
'; - print ''; - } + print ''; + } - print ''; - } + print ''; + } - // Commande - if($conf->commande->enabled && $user->rights->commande->creer) - { - $commande = new Commande($db); + // Commande + if($conf->commande->enabled && $user->rights->commande->creer) + { + $commande = new Commande($db); - $langs->load("orders"); + $langs->load("orders"); - print ''; - print $langs->trans("AddToMyOrders").''; + print ''; + print $langs->trans("AddToMyOrders").''; - if ($user->rights->societe->client->voir) - { - print ''; - print $langs->trans("AddToOtherOrders").''; - } - else - { - print ' '; - } + if ($user->rights->societe->client->voir) + { + print ''; + print $langs->trans("AddToOtherOrders").''; + } + else + { + print ' '; + } - print ''; + print ''; - // Liste de "Mes commandes" - print 'rights->societe->client->voir?' width="50%"':'').' valign="top">'; + // Liste de "Mes commandes" + print 'rights->societe->client->voir?' width="50%"':'').' valign="top">'; - $sql = "SELECT s.nom, s.rowid as socid, c.rowid as commandeid, c.ref, c.date_commande as dc"; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c"; - $sql.= " WHERE c.fk_soc = s.rowid"; - $sql.= " AND c.entity = ".$conf->entity; - $sql.= " AND c.fk_statut = 0"; - $sql.= " AND c.fk_user_author = ".$user->id; - $sql.= " ORDER BY c.date_creation DESC"; + $sql = "SELECT s.nom, s.rowid as socid, c.rowid as commandeid, c.ref, c.date_commande as dc"; + $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c"; + $sql.= " WHERE c.fk_soc = s.rowid"; + $sql.= " AND c.entity = ".$conf->entity; + $sql.= " AND c.fk_statut = 0"; + $sql.= " AND c.fk_user_author = ".$user->id; + $sql.= " ORDER BY c.date_creation DESC"; - $result=$db->query($sql); - if ($result) - { - $num = $db->num_rows($result); - $var=true; - print ''; - if ($num) - { - $i = 0; - while ($i < $num) - { - $objc = $db->fetch_object($result); - $var=!$var; - print ''; - print ''; - print ''; - print ""; - print '\n"; - print "\n"; - print "\n"; - print ''; - print ''; - print ''; - $i++; - } - } - else - { - print "'; - } - print "
'; - print "commandeid."\">".img_object($langs->trans("ShowOrder"),"order")." ".$objc->ref."socid."\">".dol_trunc($objc->nom,18)."".dol_print_date($db->jdate($objc->dc),"%d %b")."'; - print ''.$langs->trans("ReductionShort"); - print '%'; - print " ".$object->stock_proposition; - print ''; - print ''; - print '
"; - print $langs->trans("NoOpenedOrders"); - print '
"; - $db->free($result); - } + $result=$db->query($sql); + if ($result) + { + $num = $db->num_rows($result); + $var=true; + print ''; + if ($num) + { + $i = 0; + while ($i < $num) + { + $objc = $db->fetch_object($result); + $var=!$var; + print ''; + print ''; + print ''; + print ""; + print '\n"; + print "\n"; + print "\n"; + print ''; + print ''; + print ''; + $i++; + } + } + else + { + print "'; + } + print "
'; + print "commandeid."\">".img_object($langs->trans("ShowOrder"),"order")." ".$objc->ref."socid."\">".dol_trunc($objc->nom,18)."".dol_print_date($db->jdate($objc->dc),"%d %b")."'; + print ''.$langs->trans("ReductionShort"); + print '%'; + print " ".$object->stock_proposition; + print ''; + print ''; + print '
"; + print $langs->trans("NoOpenedOrders"); + print '
"; + $db->free($result); + } - print ''; + print ''; - if ($user->rights->societe->client->voir) - { - // Liste de "Other orders" - print ''; + if ($user->rights->societe->client->voir) + { + // Liste de "Other orders" + print ''; - $var=true; - $othercom = $commande->liste_array(1, $user); - print '
'; - print ''; - print ''; - if (is_array($othercom) && count($othercom)) - { - $var=!$var; - print ''; - print ''; - } - else - { - print "'; - } - print '
'; - print ''; - print $langs->trans("OtherOrders").''; - print $html->selectarray("commandeid", $othercom); - print '
'.$langs->trans("Qty"); - print ''.$langs->trans("ReductionShort"); - print '%'; - print ''; - print ''; - print '
"; - print $langs->trans("NoOtherOpenedOrders"); - print '
'; - print '
'; + $var=true; + $othercom = $commande->liste_array(1, $user); + print '
'; + print ''; + print ''; + if (is_array($othercom) && count($othercom)) + { + $var=!$var; + print ''; + print ''; + } + else + { + print "'; + } + print '
'; + print ''; + print $langs->trans("OtherOrders").''; + print $html->selectarray("commandeid", $othercom); + print '
'.$langs->trans("Qty"); + print ''.$langs->trans("ReductionShort"); + print '%'; + print ''; + print ''; + print '
"; + print $langs->trans("NoOtherOpenedOrders"); + print '
'; + print '
'; - print ''; - } + print ''; + } - print ''; - } + print ''; + } - // Factures - if ($conf->facture->enabled && $user->rights->facture->creer) - { - print ''; - print $langs->trans("AddToMyBills").''; + // Factures + if ($conf->facture->enabled && $user->rights->facture->creer) + { + print ''; + print $langs->trans("AddToMyBills").''; - if ($user->rights->societe->client->voir) - { - print ''; - print $langs->trans("AddToOtherBills").''; - } - else - { - print ' '; - } + if ($user->rights->societe->client->voir) + { + print ''; + print $langs->trans("AddToOtherBills").''; + } + else + { + print ' '; + } - print ''; + print ''; - // Liste de Mes factures - print 'rights->societe->client->voir?' width="50%"':'').' valign="top">'; + // Liste de Mes factures + print 'rights->societe->client->voir?' width="50%"':'').' valign="top">'; - $sql = "SELECT s.nom, s.rowid as socid, f.rowid as factureid, f.facnumber, f.datef as df"; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as f"; - $sql.= " WHERE f.fk_soc = s.rowid"; - $sql.= " AND f.entity = ".$conf->entity; - $sql.= " AND f.fk_statut = 0"; - $sql.= " AND f.fk_user_author = ".$user->id; - $sql.= " ORDER BY f.datec DESC, f.rowid DESC"; + $sql = "SELECT s.nom, s.rowid as socid, f.rowid as factureid, f.facnumber, f.datef as df"; + $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as f"; + $sql.= " WHERE f.fk_soc = s.rowid"; + $sql.= " AND f.entity = ".$conf->entity; + $sql.= " AND f.fk_statut = 0"; + $sql.= " AND f.fk_user_author = ".$user->id; + $sql.= " ORDER BY f.datec DESC, f.rowid DESC"; - $result=$db->query($sql); - if ($result) - { - $num = $db->num_rows($result); - $var=true; - print ''; - if ($num) - { - $i = 0; - while ($i < $num) - { - $objp = $db->fetch_object($result); - $var=!$var; - print ''; - print ''; - print ''; - print ""; - print "\n"; - print "\n"; - print "\n"; - print ''; - print ''; - print ''; - $i++; - } - } - else { - print "'; - } - print "
"; - print "factureid."\">".img_object($langs->trans("ShowBills"),"bill")." ".$objp->facnumber."socid."\">".dol_trunc($objp->nom,18)."".dol_print_date($db->jdate($objp->df),"%d %b")."'; - print ''.$langs->trans("ReductionShort"); - print '%'; - print ''; - print ''; - print '
"; - print $langs->trans("NoDraftBills"); - print '
"; - $db->free($result); - } - else - { - dol_print_error($db); - } + $result=$db->query($sql); + if ($result) + { + $num = $db->num_rows($result); + $var=true; + print ''; + if ($num) + { + $i = 0; + while ($i < $num) + { + $objp = $db->fetch_object($result); + $var=!$var; + print ''; + print ''; + print ''; + print ""; + print "\n"; + print "\n"; + print "\n"; + print ''; + print ''; + print ''; + $i++; + } + } + else { + print "'; + } + print "
"; + print "factureid."\">".img_object($langs->trans("ShowBills"),"bill")." ".$objp->facnumber."socid."\">".dol_trunc($objp->nom,18)."".dol_print_date($db->jdate($objp->df),"%d %b")."'; + print ''.$langs->trans("ReductionShort"); + print '%'; + print ''; + print ''; + print '
"; + print $langs->trans("NoDraftBills"); + print '
"; + $db->free($result); + } + else + { + dol_print_error($db); + } - print ''; + print ''; - if ($user->rights->societe->client->voir) - { + if ($user->rights->societe->client->voir) + { $facture = new Facture($db); - print ''; + print ''; // Liste de Autres factures - $var=true; + $var=true; - $sql = "SELECT s.nom, s.rowid as socid, f.rowid as factureid, f.facnumber, f.datef as df"; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as f"; - $sql.= " WHERE f.fk_soc = s.rowid"; - $sql.= " AND f.entity = ".$conf->entity; - $sql.= " AND f.fk_statut = 0"; - $sql.= " AND f.fk_user_author <> ".$user->id; - $sql.= " ORDER BY f.datec DESC, f.rowid DESC"; + $sql = "SELECT s.nom, s.rowid as socid, f.rowid as factureid, f.facnumber, f.datef as df"; + $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as f"; + $sql.= " WHERE f.fk_soc = s.rowid"; + $sql.= " AND f.entity = ".$conf->entity; + $sql.= " AND f.fk_statut = 0"; + $sql.= " AND f.fk_user_author <> ".$user->id; + $sql.= " ORDER BY f.datec DESC, f.rowid DESC"; - $result=$db->query($sql); - if ($result) - { - $num = $db->num_rows($result); - $var=true; - print ''; - if ($num) - { - $i = 0; - while ($i < $num) - { - $objp = $db->fetch_object($result); + $result=$db->query($sql); + if ($result) + { + $num = $db->num_rows($result); + $var=true; + print '
'; + if ($num) + { + $i = 0; + while ($i < $num) + { + $objp = $db->fetch_object($result); - $var=!$var; - print ''; - print ''; - print ''; - print ""; - print "\n"; - print "\n"; - print ""; - print ''; - print ''; - print ''; - $i++; - } - } - else - { - print "'; - } - print "
factureid."\">$objp->facnumbersocid."\">".dol_trunc($objp->nom,24)."".$langs->trans("Qty"); - print "'; - print ''.$langs->trans("ReductionShort"); - print '%'; - print ''; - print ''; - print '
"; - print $langs->trans("NoOtherDraftBills"); - print '
"; - $db->free($result); - } - else - { - dol_print_error($db); - } + $var=!$var; + print '
'; + print ''; + print ''; + print ""; + print "factureid."\">$objp->facnumber\n"; + print "socid."\">".dol_trunc($objp->nom,24)."\n"; + print "".$langs->trans("Qty"); + print ""; + print ''; + print ''.$langs->trans("ReductionShort"); + print '%'; + print ''; + print ''; + print ''; + print ''; + print '
'; + $i++; + } + } + else + { + print ""; + print $langs->trans("NoOtherDraftBills"); + print ''; + } + print ""; + $db->free($result); + } + else + { + dol_print_error($db); + } - print ''; - } + print ''; + } - print ''; - } + print ''; + } - print ''; + print ''; - print '
'; + print '
'; } diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php index a692ad5328f..5be0bee72fc 100644 --- a/htdocs/product/liste.php +++ b/htdocs/product/liste.php @@ -258,7 +258,7 @@ else print ""; print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label",$param,"","",$sortfield,$sortorder); - if ($conf->barcode->enabled) print_liste_field_titre($langs->trans("BarCode"), $_SERVER["PHP_SELF"], "p.barcode",$param,"","",$sortfield,$sortorder); + if ($conf->barcode->enabled) print_liste_field_titre($langs->trans("BarCode"), $_SERVER["PHP_SELF"], "p.barcode",$param,'','',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateModification"), $_SERVER["PHP_SELF"], "p.tms",$param,"",'align="center"',$sortfield,$sortorder); if ($conf->service->enabled && $type != 0) print_liste_field_titre($langs->trans("Duration"), $_SERVER["PHP_SELF"], "p.duration",$param,"",'align="center"',$sortfield,$sortorder); if (empty($conf->global->PRODUIT_MULTIPRICES)) print_liste_field_titre($langs->trans("SellingPrice"), $_SERVER["PHP_SELF"], "p.price",$param,"",'align="right"',$sortfield,$sortorder); @@ -368,7 +368,7 @@ else // Barcode if ($conf->barcode->enabled) { - print ''.$objp->barcode.''; + print ''.$objp->barcode.''; } // Date diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 475d5430c0a..e7de512ade1 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -345,9 +345,10 @@ if ($_GET["id"] || $_GET["ref"]) print ''; print ''; - print ' '; - print ''; print ''; + + print '
 '; + print '
'; print ''; } @@ -381,9 +382,11 @@ if ($_GET["id"] || $_GET["ref"]) print ''; print ''; - print ' '; - print ''; print ''; + + print '
 '; + print '
'; + print ''; }