forked from Wavyzz/dolibarr
bugfix
This commit is contained in:
@@ -449,7 +449,7 @@ class Commande extends CommonObject
|
||||
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,taux_produit)
|
||||
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue)
|
||||
*/
|
||||
function addline($commandeid, $desc, $pu, $qty, $txtva, $fk_product=0, $remise_percent=0)
|
||||
function addline($commandeid, $libelle, $desc, $pu, $qty, $txtva, $fk_product=0, $remise_percent=0)
|
||||
{
|
||||
dolibarr_syslog("Commande.class.php::addline this->id=$this->id, $commandeid, $desc, $pu, $qty, $txtva, $fk_product, $remise_percent");
|
||||
include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php');
|
||||
@@ -503,6 +503,7 @@ class Commande extends CommonObject
|
||||
$ligne=new CommandeLigne($this->db);
|
||||
|
||||
$ligne->fk_commande=$commandeid;
|
||||
$ligne->libelle=$libelle;
|
||||
$ligne->desc=$desc;
|
||||
$ligne->price=$price;
|
||||
$ligne->qty=$qty;
|
||||
@@ -1934,11 +1935,12 @@ class CommandeLigne
|
||||
|
||||
// Insertion dans base de la ligne
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commandedet';
|
||||
$sql.= ' (fk_commande, description, price, qty, tva_tx,';
|
||||
$sql.= ' (fk_commande, label, description, price, qty, tva_tx,';
|
||||
$sql.= ' fk_product, remise_percent, subprice, remise, fk_remise_except, ';
|
||||
$sql.= ' rang, coef,';
|
||||
$sql.= ' info_bits, total_ht, total_tva, total_ttc)';
|
||||
$sql.= " VALUES (".$this->fk_commande.",";
|
||||
$sql.= " '".addslashes($this->libelle)."',";
|
||||
$sql.= " '".addslashes($this->desc)."',";
|
||||
$sql.= " '".price2num($this->price)."',";
|
||||
$sql.= " '".price2num($this->qty)."',";
|
||||
|
||||
@@ -221,6 +221,8 @@ if ($_POST['action'] == 'addligne' && $user->rights->commande->creer)
|
||||
$prod = new Product($db, $_POST['idprod']);
|
||||
$prod->fetch($_POST['idprod']);
|
||||
|
||||
$libelle = $prod->libelle;
|
||||
|
||||
// multiprix
|
||||
if ($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||
{
|
||||
@@ -250,6 +252,7 @@ if ($_POST['action'] == 'addligne' && $user->rights->commande->creer)
|
||||
|
||||
$commande->addline(
|
||||
$_POST['id'],
|
||||
$libelle,
|
||||
$desc,
|
||||
$pu,
|
||||
$_POST['qty'],
|
||||
|
||||
@@ -206,11 +206,11 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$libelleproduitservice.=$com->lignes[$i]->desc;
|
||||
}
|
||||
// Si ligne associ<63>e <20> un code produit
|
||||
if ($com->lignes[$i]->product_id)
|
||||
if ($com->lignes[$i]->fk_product)
|
||||
{
|
||||
$prodser = new Product($this->db);
|
||||
|
||||
$prodser->fetch($com->lignes[$i]->product_id);
|
||||
$prodser->fetch($com->lignes[$i]->fk_product);
|
||||
if ($prodser->ref)
|
||||
{
|
||||
$libelleproduitservice=$langs->trans("Product")." ".$prodser->ref." - ".$libelleproduitservice;
|
||||
|
||||
@@ -1722,14 +1722,14 @@ function get_default_tva($societe_vendeuse, $societe_acheteuse, $taux_produit)
|
||||
{
|
||||
dolibarr_syslog("get_default_tva vendeur_assujeti=$societe_vendeuse->tva_assuj pays_vendeur=$societe_vendeuse->pays_id, pays_acheteur=$societe_acheteuse->pays_id, taux_produit=$taux_produit");
|
||||
|
||||
if (!is_object($societe_vendeuse))
|
||||
return 0;
|
||||
if (!is_object($societe_vendeuse)) return 0;
|
||||
|
||||
// Si vendeur non assujeti <20> TVA (tva_assuj vaut 0/1 ou franchise/reel)
|
||||
if (is_numeric($societe_vendeuse->tva_assuj) && ! $societe_vendeuse->tva_assuj) return 0;
|
||||
if (! is_numeric($societe_vendeuse->tva_assuj) && $societe_vendeuse->tva_assuj=='franchise') return 0;
|
||||
|
||||
// Si le (pays vendeur = pays acheteur) alors la TVA par d<>faut=TVA du produit vendu. Fin de r<>gle.
|
||||
if (($societe_vendeuse->pays_id == $societe_acheteuse->pays_id) && $societe_acheteuse->tva_assuj == 1)
|
||||
if (is_object($societe_acheteuse) && ($societe_vendeuse->pays_id == $societe_acheteuse->pays_id) && $societe_acheteuse->tva_assuj == 1)
|
||||
{
|
||||
return $taux_produit;
|
||||
}
|
||||
@@ -1738,7 +1738,7 @@ function get_default_tva($societe_vendeuse, $societe_acheteuse, $taux_produit)
|
||||
// Non g<>r<EFBFBD>
|
||||
|
||||
// Si vendeur et acheteur dans Communaut<75> europ<6F>enne et bien vendu autre que transport neuf alors la TVA par d<>faut=TVA du produit vendu. Fin de r<>gle.
|
||||
if (($societe_vendeuse->isInEEC() && $societe_acheteuse->isInEEC()) && $societe_acheteuse->tva_assuj == 1)
|
||||
if (is_object($societe_acheteuse) && ($societe_vendeuse->isInEEC() && $societe_acheteuse->isInEEC()) && $societe_acheteuse->tva_assuj == 1)
|
||||
{
|
||||
return $taux_produit;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user