Merge remote-tracking branch 'origin/3.8' into develop

This commit is contained in:
Juanjo Menent 2015-09-13 00:31:21 +02:00
commit 339b558b6b
2 changed files with 154 additions and 161 deletions

View File

@ -296,3 +296,4 @@ PropalMergePdfProductActualFile=Files use to add into PDF Azur are/is
PropalMergePdfProductChooseFile=Select PDF files PropalMergePdfProductChooseFile=Select PDF files
IncludingProductWithTag=Including product with tag IncludingProductWithTag=Including product with tag
DefaultPriceRealPriceMayDependOnCustomer=Default price, real price may depend on customer DefaultPriceRealPriceMayDependOnCustomer=Default price, real price may depend on customer
WarningSelectOneDocument=Please select at least one document

View File

@ -5,7 +5,7 @@
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2006 Auguria SARL <info@auguria.org> * Copyright (C) 2006 Auguria SARL <info@auguria.org>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013-2014 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2013-2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012-2013 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012-2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2011-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2011-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
@ -529,6 +529,7 @@ if (empty($reshook))
// Add product into object // Add product into object
if ($object->id > 0 && $action == 'addin') if ($object->id > 0 && $action == 'addin')
{ {
$thirpdartyid =0 ;
if (GETPOST('propalid') > 0) if (GETPOST('propalid') > 0)
{ {
$propal = new Propal($db); $propal = new Propal($db);
@ -563,10 +564,10 @@ if (empty($reshook))
$thirpdartyid = $facture->socid; $thirpdartyid = $facture->socid;
} }
if ( $thirpdartyid > 0) {
$soc = new Societe($db); $soc = new Societe($db);
$result = $soc->fetch($thirpdartyid); $result = $soc->fetch($thirpdartyid);
if ($result <= 0) if ($result <= 0) {
{
dol_print_error($db, $soc->error); dol_print_error($db, $soc->error);
exit; exit;
} }
@ -582,14 +583,11 @@ if (empty($reshook))
$price_base_type = $object->price_base_type; $price_base_type = $object->price_base_type;
// If multiprice // If multiprice
if ($conf->global->PRODUIT_MULTIPRICES && $soc->price_level) if ($conf->global->PRODUIT_MULTIPRICES && $soc->price_level) {
{
$pu_ht = $object->multiprices[$soc->price_level]; $pu_ht = $object->multiprices[$soc->price_level];
$pu_ttc = $object->multiprices_ttc[$soc->price_level]; $pu_ttc = $object->multiprices_ttc[$soc->price_level];
$price_base_type = $object->multiprices_base_type[$soc->price_level]; $price_base_type = $object->multiprices_base_type[$soc->price_level];
} } elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
{
require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php';
$prodcustprice = new Productcustomerprice($db); $prodcustprice = new Productcustomerprice($db);
@ -609,20 +607,15 @@ if (empty($reshook))
// On reevalue prix selon taux tva car taux tva transaction peut etre different // 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). // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
if ($tva_tx != $object->tva_tx) if ($tva_tx != $object->tva_tx) {
{ if ($price_base_type != 'HT') {
if ($price_base_type != 'HT')
{
$pu_ht = price2num($pu_ttc / (1 + ($tva_tx / 100)), 'MU'); $pu_ht = price2num($pu_ttc / (1 + ($tva_tx / 100)), 'MU');
} } else {
else
{
$pu_ttc = price2num($pu_ht * (1 + ($tva_tx / 100)), 'MU'); $pu_ttc = price2num($pu_ht * (1 + ($tva_tx / 100)), 'MU');
} }
} }
if (GETPOST('propalid') > 0) if (GETPOST('propalid') > 0) {
{
$result = $propal->addline( $result = $propal->addline(
$desc, $desc,
$pu_ht, $pu_ht,
@ -647,16 +640,13 @@ if (empty($reshook))
0, 0,
$object->fk_unit $object->fk_unit
); );
if ($result > 0) if ($result > 0) {
{
header("Location: " . DOL_URL_ROOT . "/comm/propal.php?id=" . $propal->id); header("Location: " . DOL_URL_ROOT . "/comm/propal.php?id=" . $propal->id);
return; return;
} }
setEventMessage($langs->trans("ErrorUnknown") . ": $result", 'errors'); setEventMessage($langs->trans("ErrorUnknown") . ": $result", 'errors');
} } elseif (GETPOST('commandeid') > 0) {
elseif (GETPOST('commandeid') > 0)
{
$result = $commande->addline( $result = $commande->addline(
$desc, $desc,
$pu_ht, $pu_ht,
@ -683,14 +673,11 @@ if (empty($reshook))
$object->fk_unit $object->fk_unit
); );
if ($result > 0) if ($result > 0) {
{
header("Location: " . DOL_URL_ROOT . "/commande/card.php?id=" . $commande->id); header("Location: " . DOL_URL_ROOT . "/commande/card.php?id=" . $commande->id);
exit; exit;
} }
} } elseif (GETPOST('factureid') > 0) {
elseif (GETPOST('factureid') > 0)
{
$result = $facture->addline( $result = $facture->addline(
$desc, $desc,
$pu_ht, $pu_ht,
@ -722,13 +709,18 @@ if (empty($reshook))
$object->fk_unit $object->fk_unit
); );
if ($result > 0) if ($result > 0) {
{
header("Location: " . DOL_URL_ROOT . "/compta/facture.php?facid=" . $facture->id); header("Location: " . DOL_URL_ROOT . "/compta/facture.php?facid=" . $facture->id);
exit; exit;
} }
} }
} }
else {
$action="";
setEventMessage($langs->trans("WarningSelectOneDocument"), 'warnings');
}
}
} }