New: Some changes to support the type of line in entities.

This commit is contained in:
Laurent Destailleur 2009-03-12 22:16:22 +00:00
parent 6b4228aefa
commit 446c92c484
6 changed files with 150 additions and 101 deletions

View File

@ -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='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")).'</div>';
@ -161,14 +164,16 @@ if ($_POST['action'] == 'addligne' && $user->rights->fournisseur->commande->cree
{
if (!empty($_POST['pu']))
{
$price_base_type = 'HT';
$ht = price2num($_POST['pu']);
$result=$commande->addline($_POST['dp_desc'], $ht, $_POST['qty'], $tauxtva);
$result=$commande->addline($desc, $ht, $_POST['qty'], $tva_tx, 0, 0, '', $_POST['remise_percent'], $price_base_type, 0, $type);
}
else
{
$ttc = price2num($_POST['amountttc']);
$ht = $ttc / (1 + ($tauxtva / 100));
$result=$commande->addline($_POST['dp_desc'], $ht, $_POST['qty'], $tauxtva);
$price_base_type = 'HT';
$result=$commande->addline($desc, $ht, $_POST['qty'], $tva_tx, 0, 0, '', $_POST['remise_percent'], $price_base_type, $ttc, $type);
}
}
}
@ -204,7 +209,10 @@ if ($_POST['action'] == 'updateligne' && $user->rights->fournisseur->commande->c
$_POST['pu'],
$_POST['qty'],
$_POST['remise_percent'],
$_POST['tva_tx']
$_POST['tva_tx'],
'HT',
0,
$_POST["type"]
);
if ($result >= 0)
@ -224,12 +232,6 @@ if ($_POST['action'] == 'updateligne' && $user->rights->fournisseur->commande->c
}
}
if ($_POST['action'] == 'updateligne' && $user->rights->fournisseur->commande->creer && $_POST['cancel'] == $langs->trans('Cancel'))
{
Header('Location: fiche.php?id='.$id); // Pour reaffichage de la fiche en cours d'edition
exit;
}
if ($_REQUEST['action'] == 'confirm_deleteproductline' && ($_POST['confirm'] == 'yes' || empty($conf->global->PRODUIT_CONFIRM_DELETE_LINE)))
{
if ($user->rights->fournisseur->commande->creer)
@ -246,8 +248,6 @@ if ($_REQUEST['action'] == 'confirm_deleteproductline' && ($_POST['confirm'] ==
}
supplier_order_pdf_create($db, $id, $commande->modelpdf, $outputlangs);
}
Header('Location: fiche.php?id='.$id);
exit;
}
if ($_REQUEST['action'] == 'confirm_valid' && $_REQUEST['confirm'] == 'yes' && $user->rights->fournisseur->commande->valider)
@ -479,15 +479,17 @@ $formorder = new FormOrder($db);
$now=gmmktime();
$id = $_GET['id'];
$ref= $_GET['ref'];
$productstatic = new Product($db);
$id = $_REQUEST['id'];
$ref= $_REQUEST['ref'];
if ($id > 0 || ! empty($ref))
{
//if ($mesg) print $mesg.'<br>';
$commande = new CommandeFournisseur($db);
$result=$commande->fetch($_GET['id'],$_GET['ref']);
$result=$commande->fetch($_REQUEST['id'],$_REQUEST['ref']);
if ($result >= 0)
{
$soc = new Societe($db);
@ -516,7 +518,7 @@ if ($id > 0 || ! empty($ref))
*/
if ($_GET['action'] == 'valid')
{
$commande->date_commande=time();
$commande->date_commande=gmmktime();
// We check if number is temporary number
if (eregi('^\(PROV',$commande->ref)) $newref = $commande->getNextNumRef($soc);
@ -668,7 +670,7 @@ if ($id > 0 || ! empty($ref))
else print '<br>';
/*
* Lignes de commandes
* Lines
*/
print '<table class="noborder" width="100%">';
@ -704,36 +706,46 @@ if ($id > 0 || ! empty($ref))
if ($_GET['action'] != 'editline' || $_GET['rowid'] != $commandline->id)
{
print '<tr '.$bc[$var].'>';
// Show product and description
print '<td>';
if ($commandline->fk_product > 0)
{
print '<td>';
print '<a name="'.$commandline->id.'"></a>'; // ancre pour retourner sur la ligne
// Affiche ligne produit
$text = '<a href="'.DOL_URL_ROOT.'/product/fournisseurs.php?id='.$commandline->fk_product.'">';
$text.= img_object($langs->trans('ShowProduct'),'product');
$text.= ' '.$commandline->ref_fourn.'</a>';
$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)?'<br>'.dol_htmlentitiesbr($commandline->product_desc):'';
}
print "</td>";
// 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)?'<br>'.dol_htmlentitiesbr($objp->description):'';
}
else
// Description - Editor wysiwyg
if (! $commandline->fk_product)
{
print '<td>';
print '<a name="'.$commandline->id.'"></a>'; // ancre pour retourner sur la ligne
print nl2br($commandline->product_desc);
print '</td>';
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 '</td>';
print '<td align="right" nowrap="nowrap">'.vatrate($commandline->tva_tx).'%</td>';
print '<td align="right" nowrap="nowrap">'.price($commandline->subprice)."</td>\n";
print '<td align="right" nowrap="nowrap">'.$commandline->qty.'</td>';
if ($commandline->remise_percent > 0)
{
print '<td align="right" nowrap="nowrap">'.dol_print_reduction($commandline->remise_percent,$langs)."</td>\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 '<form action="'.$_SERVER["PHP_SELF"].'#'.$commandline->id.'" method="post">';
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'&amp;etat=1&amp;ligne_id='.$commandline->id.'" method="post">';
print '<input type="hidden" name="action" value="updateligne">';
print '<input type="hidden" name="id" value="'.$_REQUEST["id"].'">';
print '<input type="hidden" name="elrowid" value="'.$_GET['rowid'].'">';
print '<tr '.$bc[$var].'>';
print '<td>';
print '<a name="'.$commandline->id.'"></a>'; // ancre pour retourner sur la ligne
if ($commandline->fk_product > 0)
if ($conf->produit->enabled && $commandline->fk_product > 0)
{
print '<a href="'.DOL_URL_ROOT.'/product/fournisseurs.php?id='.$commandline->product_id.'">';
print img_object($langs->trans('ShowProduct'),'product');
@ -782,7 +794,13 @@ if ($id > 0 || ! empty($ref))
print ' - '.nl2br($commandline->product);
print '<br>';
}
// Editor wysiwyg
else
{
print $html->select_type_of_lines($commandline->product_type,'type',1);
if ($conf->produit->enabled && $conf->service->enabled) print '<br>';
}
// Description - Editor wysiwyg
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS)
{
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
@ -791,7 +809,7 @@ if ($id > 0 || ! empty($ref))
}
else
{
print '<textarea name="eldesc" class="flat" cols="70" rows="1">'.dol_htmlentitiesbr_decode($commandline->description).'</textarea>';
print '<textarea name="eldesc" class="flat" cols="70" rows="'.ROWS_2.'">'.dol_htmlentitiesbr_decode($commandline->description).'</textarea>';
}
print '</td>';
print '<td>';
@ -827,7 +845,7 @@ if ($id > 0 || ! empty($ref))
// Add free products/services form
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'#add" method="post">';
print '<input type="hidden" name="action" value="addligne">';
print '<input type="hidden" name="id" value="'.$comid.'">';
print '<input type="hidden" name="id" value="'.$commande->id.'">';
$var=true;
print '<tr '.$bc[$var].'>';
@ -883,8 +901,8 @@ if ($id > 0 || ! empty($ref))
print '</tr>';
print '<form id="addpredefinedproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'#add" method="post">';
print '<input type="hidden" name="id" value="'.$id.'">';
print '<input type="hidden" name="action" value="addligne">';
print '<input type="hidden" name="id" value="'.$commande->id.'">';
$var=!$var;
print '<tr '.$bc[$var].'>';

View File

@ -297,15 +297,15 @@ if ($_GET['action'] == 'add_ligne')
if ($_POST['prodfournpriceid']) // > 0 or -1
{
$nv_prod = new ProductFournisseur($db);
$idprod=$nv_prod->get_buyprice($_POST['prodfournpriceid'], $_POST['qty']);
$product = new ProductFournisseur($db);
$idprod=$product->get_buyprice($_POST['prodfournpriceid'], $_POST['qty']);
if ($idprod > 0)
{
$result=$nv_prod->fetch($idprod);
$result=$product->fetch($idprod);
// cas special pour lequel on a les meme reference que le fournisseur
// $label = '['.$nv_prod->ref.'] - '. $nv_prod->libelle;
$label = $nv_prod->libelle;
// $label = '['.$product->ref.'] - '. $product->libelle;
$label = $product->libelle;
$societe='';
if ($facfou->socid)
@ -314,10 +314,10 @@ if ($_GET['action'] == 'add_ligne')
$societe->fetch($facfou->socid);
}
$tvatx=get_default_tva($societe,$mysoc,$nv_prod->tva_tx);
$type = $nv_prod->type;
$tvatx=get_default_tva($societe,$mysoc,$product->tva_tx);
$type = $product->type;
$result=$facfou->addline($label, $nv_prod->fourn_pu, $tvatx, $_POST['qty'], $idprod);
$result=$facfou->addline($label, $product->fourn_pu, $tvatx, $_POST['qty'], $idprod);
}
if ($idprod == -1)
{
@ -781,7 +781,7 @@ else
/*
* Lines of invoice
* Lines
*/
print '<br>';
print '<table class="noborder" width="100%">';
@ -836,9 +836,15 @@ else
}
// Description - Editor wysiwyg
if (! $conf->produit->enabled || ! $fac->lignes[$i]->fk_product)
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS)
{
print '<textarea class="flat" cols="70" rows="'.ROWS_2.'" name="label">'.$fac->lignes[$i]->description.'</textarea>';
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
$doleditor=new DolEditor('label',$fac->lignes[$i]->description,200,'dolibarr_details');
$doleditor->Create();
}
else
{
print '<textarea name="eldesc" class="flat" cols="70" rows="'.ROWS_2.'">'.dol_htmlentitiesbr_decode($fac->lignes[$i]->description).'</textarea>';
}
print '</td>';

View File

@ -78,7 +78,7 @@ class CommandeFournisseur extends Commande
*/
function fetch($id,$ref='')
{
$sql = "SELECT c.rowid, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_statut, c.amount_ht, c.total_ht, c.total_ttc, c.tva,";
$sql = "SELECT c.rowid, c.ref, c.date_creation, c.fk_soc, c.fk_user_author, c.fk_statut, c.amount_ht, c.total_ht, c.total_ttc, c.tva,";
$sql .= " ".$this->db->pdate("c.date_commande")." as date_commande, c.fk_projet as fk_project, c.remise_percent, c.source, c.fk_methode_commande,";
$sql .= " c.note, c.note_public, c.model_pdf,";
$sql .= " cm.libelle as methode_commande";
@ -123,10 +123,11 @@ class CommandeFournisseur extends Commande
// Now load lines
$this->lignes = array();
$sql = "SELECT l.rowid, l.ref as ref_fourn, l.fk_product, l.label, l.description, l.qty,";
$sql = "SELECT l.rowid, l.ref as ref_fourn, l.fk_product, l.product_type, l.label, l.description,";
$sql.= " l.qty,";
$sql.= " l.tva_tx, l.remise_percent, l.subprice,";
$sql.= " l.total_ht, l.total_tva, l.total_ttc,";
$sql.= " p.rowid as product_id, p.ref, p.label as product";
$sql.= " p.rowid as product_id, p.ref, p.label as label, p.description as product_desc";
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l";
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
$sql.= " WHERE l.fk_commande = ".$this->id;
@ -148,6 +149,7 @@ class CommandeFournisseur extends Commande
$ligne->id = $objp->rowid;
$ligne->desc = $objp->description; // Description ligne
$ligne->description = $objp->description; // Description ligne
$ligne->qty = $objp->qty;
$ligne->tva_tx = $objp->tva_tx;
$ligne->subprice = $objp->subprice;
@ -155,10 +157,11 @@ class CommandeFournisseur extends Commande
$ligne->total_ht = $objp->total_ht;
$ligne->total_tva = $objp->total_tva;
$ligne->total_ttc = $objp->total_ttc;
$ligne->product_type = $objp->product_type;
$ligne->fk_product = $objp->product_id; // Id du produit
$ligne->fk_product = $objp->fk_product; // Id du produit
$ligne->libelle = $objp->label; // Label produit
$ligne->product_desc = $objp->description; // Description produit
$ligne->product_desc = $objp->product_desc; // Description produit
$ligne->ref = $objp->ref; // Reference
$ligne->ref_fourn = $objp->ref_fourn; // Reference supplier
@ -745,19 +748,21 @@ class CommandeFournisseur extends Commande
/**
* \brief Ajoute une ligne de commande
* \param desc Description
* \param pu Prix unitaire
* \param qty Quantit<EFBFBD>
* \param pu Unit price
* \param qty Quantity
* \param txtva Taux tva
* \param fk_product Id produit
* \param remise_percent Remise
* \param price_base_type HT or TTC
* \param int <=0 si ko, >0 si ok
* \param price_base_type HT or TTC
* \param pu_ttc Unit price TTC
* \param type Type of line (0=product, 1=service)
* \return int <=0 if KO, >0 if OK
*/
function addline($desc, $pu_ht, $qty, $txtva, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0, $price_base_type='HT', $pu_ttc=0)
function addline($desc, $pu_ht, $qty, $txtva, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $type=0)
{
global $langs,$mysoc;
dol_syslog("FournisseurCommande::addline $desc, $pu_ht, $qty, $txtva, $fk_product, $fk_prod_fourn_price, $fourn_ref, $remise_percent, $price_base_type, $pu_ttc");
dol_syslog("FournisseurCommande::addline $desc, $pu_ht, $qty, $txtva, $fk_product, $fk_prod_fourn_price, $fourn_ref, $remise_percent, $price_base_type, $pu_ttc, $type");
include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php');
// Clean parameters
@ -778,11 +783,14 @@ class CommandeFournisseur extends Commande
}
$desc=trim($desc);
// Check parameters
if ($qty < 1 && ! $fk_product)
{
$this->error=$langs->trans("ErrorFieldRequired",$langs->trans("Product"));
return -1;
}
if ($type < 0) return -1;
if ($this->statut == 0)
{
@ -799,6 +807,7 @@ class CommandeFournisseur extends Commande
$label = $prod->libelle;
$pu = $prod->fourn_pu;
$ref = $prod->ref_fourn;
$product_type = $prod->type;
}
if ($result == 0 || $result == -1)
{
@ -821,6 +830,10 @@ class CommandeFournisseur extends Commande
return -1;
}
}
else
{
$product_type = $type;
}
// Calcul du total TTC et de la TVA pour la ligne a partir de
// qty, pu, remise_percent et txtva
@ -843,13 +856,14 @@ class CommandeFournisseur extends Commande
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseurdet";
$sql.= " (fk_commande,label, description,";
$sql.= " fk_product,";
$sql.= " fk_product, product_type,";
$sql.= " qty, tva_tx, remise_percent, subprice, remise, ref,";
$sql.= " total_ht, total_tva, total_ttc";
$sql.= ")";
$sql.= " VALUES (".$this->id.", '" . addslashes($label) . "','" . addslashes($desc) . "',";
if ($fk_product) { $sql.= $fk_product.","; }
else { $sql.= "null,"; }
$sql.= "'".$product_type."',";
$sql.= "'".$qty."', ".$txtva.", ".$remise_percent.",'".price2num($subprice,'MU')."','".price2num($remise)."','".$ref."',";
$sql.= "'".price2num($total_ht)."',";
$sql.= "'".price2num($total_tva)."',";
@ -1230,32 +1244,36 @@ class CommandeFournisseur extends Commande
/**
* \brief Mets <EFBFBD> jour une ligne de commande
* \param rowid Id de la ligne de facture
* \param desc Description de la ligne
* \param pu Prix unitaire
* \param qty Quantit<EFBFBD>
* \param remise_percent Pourcentage de remise de la ligne
* \param tva_tx Taux TVA
* \param info_bits Miscellanous informations
* \return int < 0 si erreur, > 0 si ok
* \brief Update line
* \param rowid Id de la ligne de facture
* \param desc Description de la ligne
* \param pu Prix unitaire
* \param qty Quantity
* \param remise_percent Pourcentage de remise de la ligne
* \param tva_tx Taux TVA
* \param info_bits Miscellanous informations
* \param type Type of line (0=product, 1=service)
* \return int < 0 si erreur, > 0 si ok
*/
function updateline($rowid, $desc, $pu, $qty, $remise_percent=0, $txtva, $price_base_type='HT', $info_bits=0)
function updateline($rowid, $desc, $pu, $qty, $remise_percent=0, $txtva, $price_base_type='HT', $info_bits=0, $type=0)
{
dol_syslog("CommandeFournisseur::UpdateLine $rowid, $desc, $pu, $qty, $remise_percent, $txtva");
dol_syslog("CommandeFournisseur::UpdateLine $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $price_base_type, $info_bits, $type");
include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php');
if ($this->brouillon)
{
$this->db->begin();
// Nettoyage param<61>tres
// Clean parameters
$remise_percent=price2num($remise_percent);
$qty=price2num($qty);
if (! $qty) $qty=1;
$pu = price2num($pu);
$txtva=price2num($txtva);
// Check parameters
if ($type < 0) return -1;
// Calcul du total TTC et de la TVA pour la ligne a partir de
// qty, pu, remise_percent et txtva
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
@ -1282,14 +1300,15 @@ class CommandeFournisseur extends Commande
$sql.= ",remise_percent='".price2num($remise_percent)."'";
$sql.= ",tva_tx='".price2num($txtva)."'";
$sql.= ",qty='".price2num($qty)."'";
//if ($date_end) { $sql.= ",date_start='$date_end'"; }
//else { $sql.=',date_start=null'; }
//if ($date_end) { $sql.= ",date_end='$date_end'"; }
//else { $sql.=',date_end=null'; }
if ($date_end) { $sql.= ",date_start='$date_end'"; }
else { $sql.=',date_start=null'; }
if ($date_end) { $sql.= ",date_end='$date_end'"; }
else { $sql.=',date_end=null'; }
$sql.= ",info_bits='".$info_bits."'";
$sql.= ",total_ht='".price2num($total_ht)."'";
$sql.= ",total_tva='".price2num($total_tva)."'";
$sql.= ",total_ttc='".price2num($total_ttc)."'";
$sql.= ",product_type='".$type."'";
$sql.= " WHERE rowid = ".$rowid;
dol_syslog("CommandeFournisseur::updateline sql=".$sql);

View File

@ -277,7 +277,7 @@ class FactureFournisseur extends Facture
{
$sql = 'SELECT f.rowid, f.description, f.pu_ht, f.pu_ttc, f.qty, f.tva_taux, f.tva';
$sql.= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_product, f.product_type';
$sql.= ', p.ref, p.label as label, p.description as product_desc';
$sql.= ', p.rowid as product_id, p.ref, p.label as label, p.description as product_desc';
//$sql.= ', pf.ref_fourn';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det as f';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON f.fk_product = p.rowid';
@ -491,12 +491,15 @@ class FactureFournisseur extends Facture
dol_syslog("FactureFourn::Addline $desc,$pu,$qty,$txtva,$fk_product,$remise_percent,$date_start,$date_end,$ventil,$info_bits,$price_base_type,$type", LOG_DEBUG);
include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php');
$this->db->begin();
// Nettoyage param<61>tres
// Clean parameters
if ($txtva == '') $txtva=0;
$txtva=price2num($txtva);
// Check parameters
if ($type < 0) return -1;
$this->db->begin();
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det (fk_facture_fourn)';
$sql .= ' VALUES ('.$this->id.');';
@ -569,7 +572,7 @@ class FactureFournisseur extends Facture
{
$product=new Product($this->db);
$result=$product->fetch($idproduct);
$product_type=$product->type;
$product_type = $product->type;
}
else
{

View File

@ -92,9 +92,12 @@ alter table llx_propaldet add column product_type integer DEFAULT 0 after
alter table llx_propaldet add column date_start datetime DEFAULT NULL after product_type;
alter table llx_propaldet add column date_end datetime DEFAULT NULL after date_start;
alter table llx_commande_fournisseur add column product_type integer DEFAULT 0 after total_ttc;
alter table llx_commande_fournisseur add column date_start datetime DEFAULT NULL after product_type;
alter table llx_commande_fournisseur add column date_end datetime DEFAULT NULL after date_start;
alter table llx_commande_fournisseurdet add column product_type integer DEFAULT 0 after total_ttc;
alter table llx_commande_fournisseurdet add column date_start datetime DEFAULT NULL after product_type;
alter table llx_commande_fournisseurdet add column date_end datetime DEFAULT NULL after date_start;
alter table llx_commande_fournisseur drop column product_type;
alter table llx_commande_fournisseur drop column date_start;
alter table llx_commande_fournisseur drop column date_end;
-- V4.1 delete from llx_projet_task where fk_projet not in (select rowid from llx_projet);
-- V4.1 ALTER TABLE llx_projet_task ADD CONSTRAINT fk_projet_task_fk_projet FOREIGN KEY (fk_projet) REFERENCES llx_projet (rowid);

View File

@ -35,7 +35,7 @@ create table llx_commandedet
total_ht double(24,8) DEFAULT 0, -- Total HT de la ligne toute quantité et incluant remise ligne et globale
total_tva double(24,8) DEFAULT 0, -- Total TVA de la ligne toute quantité et incluant remise ligne et globale
total_ttc double(24,8) DEFAULT 0, -- Total TTC de la ligne toute quantité et incluant remise ligne et globale
product_type integer DEFAULT 0,
product_type integer DEFAULT 0,
date_start datetime DEFAULT NULL, -- date debut si service
date_end datetime DEFAULT NULL, -- date fin si service
info_bits integer DEFAULT 0, -- TVA NPR ou non