diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 72d5b228e6b..9d1b114367c 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -108,15 +108,15 @@ if ($_POST['action'] == 'addligne' && $user->rights->fournisseur->commande->cree // Ecrase $txtva par celui du produit if ($_POST["idprodfournprice"]) // >0 or -1 { - $prodfournprice = new ProductFournisseur($db); - $idprod=$prodfournprice->get_buyprice($_POST['idprodfournprice'], $_POST['qty']); + $product = new ProductFournisseur($db); + $idprod=$product->get_buyprice($_POST['idprodfournprice'], $_POST['qty']); if ($idprod > 0) { - $prodfournprice->fetch($idprod); + $product->fetch($idprod); // cas special pour lequel on a les meme reference que le fournisseur // $label = '['.$nv_prod->ref.'] - '. $nv_prod->libelle; - $label = $prodfournprice->libelle; + $label = $product->libelle; $societe=''; if ($commande->socid) @@ -125,24 +125,25 @@ if ($_POST['action'] == 'addligne' && $user->rights->fournisseur->commande->cree $societe->fetch($commande->socid); } - $desc = $prodfournprice->description; - $desc.= $prodfournprice->description && $_POST['np_desc'] ? "\n" : ""; + $desc = $product->description; + $desc.= $product->description && $_POST['np_desc'] ? "\n" : ""; $desc.= $_POST['np_desc']; - $tva_tx = get_default_tva($societe,$mysoc,$prodfournprice->tva_tx,$prodfournprice->id); + $tva_tx = get_default_tva($societe,$mysoc,$product->tva_tx,$product->id); + $type = $product->type; $result=$commande->addline( $desc, $pu, $_POST['qty'], $tva_tx, - $prodfournprice->id, + $product->id, $_POST['idprodfournprice'], - $prodfournprice->fourn_ref, + $product->fourn_ref, $_POST['remise_percent'], - 'HT' - ); - + 'HT', + $type + ); } if ($idprod == -1) { @@ -152,7 +153,9 @@ if ($_POST['action'] == 'addligne' && $user->rights->fournisseur->commande->cree } else { - $tauxtva = price2num($_POST['tva_tx']); + $type=$_POST["type"]; + $desc=$_POST['dp_desc']; + $tva_tx = price2num($_POST['tva_tx']); if (! $_POST['dp_desc']) { $mesg='
| '; if ($commandline->fk_product > 0) { - print ' | ';
print ''; // ancre pour retourner sur la ligne
- // Affiche ligne produit
- $text = '';
- $text.= img_object($langs->trans('ShowProduct'),'product');
- $text.= ' '.$commandline->ref_fourn.'';
- $text.= ' ('.$commandline->ref.')';
- $text.= ' - '.$commandline->libelle;
- $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($commandline->product_desc));
+ $product_static=new ProductFournisseur($db);
+ $product_static->fetch($commandline->fk_product);
+ $text=$product_static->getNomUrl(1);
+ $text.= ' - '.$product_static->libelle;
+ $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($commandline->description));
print $html->textwithtooltip($text,$description,3,'','',$i);
- if ($conf->global->PRODUIT_DESC_IN_FORM)
- {
- print ($commandline->product_desc && $commandline->product_desc!=$commandline->libelle)?' '.dol_htmlentitiesbr($commandline->product_desc):''; - } - print " | ";
+ // Show range
+ print_date_range($commandline->date_start,$commandline->date_end);
+
+ // Add description in form
+ if ($conf->global->PRODUIT_DESC_IN_FORM) print ($objp->description && $objp->description!=$objp->product)?''; - print ''; // ancre pour retourner sur la ligne - print nl2br($commandline->product_desc); - print ' | '; + if ($type==1) $text = img_object($langs->trans('Service'),'service'); + else $text = img_object($langs->trans('Product'),'product'); + print $text.' '.nl2br($commandline->description); + + // Show range + print_date_range($commandline->date_start,$commandline->date_end); } + + print ''; + print ''.vatrate($commandline->tva_tx).'% | '; + print ''.price($commandline->subprice)." | \n"; + print ''.$commandline->qty.' | '; + if ($commandline->remise_percent > 0) { print ''.dol_print_reduction($commandline->remise_percent,$langs)." | \n"; @@ -766,14 +778,14 @@ if ($id > 0 || ! empty($ref)) // Ligne en mode update if ($_GET["action"] == 'editline' && $user->rights->fournisseur->commande->creer && ($_GET["rowid"] == $commandline->id)) { - print '