2
0
forked from Wavyzz/dolibarr

Fix: removed print of function making print.

Fix: default vat rate must be -1 to be automatic instead of deprecated conf->defaulttx
This commit is contained in:
Laurent Destailleur
2011-08-04 21:46:50 +00:00
parent 6c85906753
commit d246b87c1a
13 changed files with 57 additions and 55 deletions

View File

@@ -21,7 +21,7 @@
* \file htdocs/comm/remx.php * \file htdocs/comm/remx.php
* \ingroup societe * \ingroup societe
* \brief Page to edit absolute discounts for a customer * \brief Page to edit absolute discounts for a customer
* \version $Id: remx.php,v 1.52 2011/08/03 00:46:26 eldy Exp $ * \version $Id: remx.php,v 1.53 2011/08/04 21:46:51 eldy Exp $
*/ */
require("../main.inc.php"); require("../main.inc.php");
@@ -270,7 +270,7 @@ if ($_socid > 0)
print '<td><input type="text" size="5" name="amount_ht" value="'.$_POST["amount_ht"].'">&nbsp;'.$langs->trans("Currency".$conf->monnaie).'</td></tr>'; print '<td><input type="text" size="5" name="amount_ht" value="'.$_POST["amount_ht"].'">&nbsp;'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
print '<tr><td width="38%">'.$langs->trans("VAT").'</td>'; print '<tr><td width="38%">'.$langs->trans("VAT").'</td>';
print '<td>'; print '<td>';
$form->select_tva('tva_tx','0','',$mysoc,''); print $form->load_tva('tva_tx','0','',$mysoc,'');
print '</td></tr>'; print '</td></tr>';
print '<tr><td>'.$langs->trans("NoteReason").'</td>'; print '<tr><td>'.$langs->trans("NoteReason").'</td>';
print '<td><input type="text" size="60" name="desc" value="'.$_POST["desc"].'"></td></tr>'; print '<td><input type="text" size="60" name="desc" value="'.$_POST["desc"].'"></td></tr>';
@@ -538,5 +538,5 @@ if ($_socid > 0)
$db->close(); $db->close();
llxFooter('$Date: 2011/08/03 00:46:26 $ - $Revision: 1.52 $'); llxFooter('$Date: 2011/08/04 21:46:51 $ - $Revision: 1.53 $');
?> ?>

View File

@@ -23,7 +23,7 @@
* \file htdocs/contrat/fiche.php * \file htdocs/contrat/fiche.php
* \ingroup contrat * \ingroup contrat
* \brief Page of a contract * \brief Page of a contract
* \version $Id: fiche.php,v 1.198 2011/08/02 12:44:20 simnandez Exp $ * \version $Id: fiche.php,v 1.199 2011/08/04 21:46:51 eldy Exp $
*/ */
require ("../main.inc.php"); require ("../main.inc.php");
@@ -875,7 +875,7 @@ else
} }
print '<textarea name="eldesc" cols="70" rows="1">'.$objp->description.'</textarea></td>'; print '<textarea name="eldesc" cols="70" rows="1">'.$objp->description.'</textarea></td>';
print '<td align="right">'; print '<td align="right">';
print $form->select_tva("eltva_tx",$objp->tva_tx,$mysoc,$object->societe); print $form->load_tva("eltva_tx",$objp->tva_tx,$mysoc,$object->societe);
print '</td>'; print '</td>';
print '<td align="right"><input size="5" type="text" name="elprice" value="'.price($objp->subprice).'"></td>'; print '<td align="right"><input size="5" type="text" name="elprice" value="'.price($objp->subprice).'"></td>';
print '<td align="center"><input size="2" type="text" name="elqty" value="'.$objp->qty.'"></td>'; print '<td align="center"><input size="2" type="text" name="elqty" value="'.$objp->qty.'"></td>';
@@ -1195,7 +1195,7 @@ else
print '<td><textarea name="desc" cols="70" rows="'.ROWS_2.'"></textarea></td>'; print '<td><textarea name="desc" cols="70" rows="'.ROWS_2.'"></textarea></td>';
print '<td>'; print '<td>';
$form->select_tva("tva_tx",$conf->defaulttx,$mysoc,$object->societe); print $form->load_tva("tva_tx",-1,$mysoc,$object->societe);
print '</td>'; print '</td>';
print '<td align="right"><input type="text" class="flat" size="4" name="pu" value=""></td>'; print '<td align="right"><input type="text" class="flat" size="4" name="pu" value=""></td>';
print '<td align="center"><input type="text" class="flat" size="2" name="pqty" value="1"></td>'; print '<td align="center"><input type="text" class="flat" size="2" name="pqty" value="1"></td>';
@@ -1286,5 +1286,5 @@ else
$db->close(); $db->close();
llxFooter('$Date: 2011/08/02 12:44:20 $ - $Revision: 1.198 $'); llxFooter('$Date: 2011/08/04 21:46:51 $ - $Revision: 1.199 $');
?> ?>

View File

@@ -24,7 +24,7 @@
* \ingroup core * \ingroup core
* \brief File of class to manage storage of current setup * \brief File of class to manage storage of current setup
* Config is stored into file conf.php * Config is stored into file conf.php
* \version $Id: conf.class.php,v 1.64 2011/08/01 13:26:22 hregis Exp $ * \version $Id: conf.class.php,v 1.65 2011/08/04 21:46:51 eldy Exp $
*/ */
@@ -325,15 +325,6 @@ class Conf
$this->compta->mode = 'RECETTES-DEPENSES'; // By default $this->compta->mode = 'RECETTES-DEPENSES'; // By default
if (isset($this->global->COMPTA_MODE)) $this->compta->mode = $this->global->COMPTA_MODE; // Can be 'RECETTES-DEPENSES' ou 'CREANCES-DETTES' if (isset($this->global->COMPTA_MODE)) $this->compta->mode = $this->global->COMPTA_MODE; // Can be 'RECETTES-DEPENSES' ou 'CREANCES-DETTES'
// $this->defaulttx
if (isset($this->global->FACTURE_TVAOPTION) && $this->global->FACTURE_TVAOPTION == 'franchise')
{
$this->defaulttx='0'; // Taux par defaut des factures clients
}
else {
$this->defaulttx=''; // Pas de taux par defaut des factures clients, le plus élevé sera pris
}
// $this->liste_limit = constante de taille maximale des listes // $this->liste_limit = constante de taille maximale des listes
if (empty($this->global->MAIN_SIZE_LISTE_LIMIT)) $this->global->MAIN_SIZE_LISTE_LIMIT=25; if (empty($this->global->MAIN_SIZE_LISTE_LIMIT)) $this->global->MAIN_SIZE_LISTE_LIMIT=25;
$this->liste_limit=$this->global->MAIN_SIZE_LISTE_LIMIT; $this->liste_limit=$this->global->MAIN_SIZE_LISTE_LIMIT;

View File

@@ -30,7 +30,7 @@
* \file htdocs/core/class/html.form.class.php * \file htdocs/core/class/html.form.class.php
* \ingroup core * \ingroup core
* \brief File of class with all html predefined components * \brief File of class with all html predefined components
* \version $Id: html.form.class.php,v 1.193 2011/07/31 23:45:14 eldy Exp $ * \version $Id: html.form.class.php,v 1.194 2011/08/04 21:46:51 eldy Exp $
*/ */
@@ -2669,11 +2669,10 @@ class Form
* Si (vendeur et acheteur dans Communaute europeenne) et bien vendu = moyen de transports neuf (auto, bateau, avion), TVA par defaut=0 (La TVA doit etre paye par l'acheteur au centre d'impots de son pays et non au vendeur). Fin de regle. * Si (vendeur et acheteur dans Communaute europeenne) et bien vendu = moyen de transports neuf (auto, bateau, avion), TVA par defaut=0 (La TVA doit etre paye par l'acheteur au centre d'impots de son pays et non au vendeur). Fin de regle.
* Si (vendeur et acheteur dans Communaute europeenne) et bien vendu autre que transport neuf alors la TVA par defaut=TVA du produit vendu. Fin de regle. * Si (vendeur et acheteur dans Communaute europeenne) et bien vendu autre que transport neuf alors la TVA par defaut=TVA du produit vendu. Fin de regle.
* Sinon la TVA proposee par defaut=0. Fin de regle. * Sinon la TVA proposee par defaut=0. Fin de regle.
* @deprecated
*/ */
function select_tva($htmlname='tauxtva', $selectedrate='', $societe_vendeuse='', $societe_acheteuse='', $idprod=0, $info_bits=0, $type='') function select_tva($htmlname='tauxtva', $selectedrate='', $societe_vendeuse='', $societe_acheteuse='', $idprod=0, $info_bits=0, $type='')
{ {
// TODO size of field is too large
//print '<script>jQuery(function() { jQuery( "#'.$htmlname.'" ).combobox(); });</script>';
print $this->load_tva($htmlname, $selectedrate, $societe_vendeuse, $societe_acheteuse, $idprod, $info_bits, $type); print $this->load_tva($htmlname, $selectedrate, $societe_vendeuse, $societe_acheteuse, $idprod, $info_bits, $type);
} }
@@ -2800,6 +2799,7 @@ class Form
$defaulttx=get_default_tva($societe_vendeuse,$societe_acheteuse,$idprod); $defaulttx=get_default_tva($societe_vendeuse,$societe_acheteuse,$idprod);
$defaultnpr=get_default_npr($societe_vendeuse,$societe_acheteuse,$idprod); $defaultnpr=get_default_npr($societe_vendeuse,$societe_acheteuse,$idprod);
} }
// Si taux par defaut n'a pu etre determine, on prend dernier de la liste. // Si taux par defaut n'a pu etre determine, on prend dernier de la liste.
// Comme ils sont tries par ordre croissant, dernier = plus eleve = taux courant // Comme ils sont tries par ordre croissant, dernier = plus eleve = taux courant
if ($defaulttx < 0 || dol_strlen($defaulttx) == 0) if ($defaulttx < 0 || dol_strlen($defaulttx) == 0)

View File

@@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* $Id: freeproductline_create.tpl.php,v 1.15 2011/07/31 23:45:13 eldy Exp $ * $Id: freeproductline_create.tpl.php,v 1.16 2011/08/04 21:46:50 eldy Exp $
* *
* Need to have following variables defined: * Need to have following variables defined:
* $conf * $conf
@@ -46,7 +46,7 @@
<?php <?php
echo $html->select_type_of_lines(isset($_POST["type"])?$_POST["type"]:-1,'type',1); echo $html->select_type_of_lines(isset($_POST["type"])?$_POST["type"]:-1,'type',1);
if (($conf->product->enabled && $conf->service->enabled) || (empty($conf->product->enabled) && empty($conf->service->enabled))) echo '<br>'; if (($conf->product->enabled && $conf->service->enabled) || (empty($conf->product->enabled) && empty($conf->service->enabled))) echo '<br>';
if (! empty($this->hooks)) { if (! empty($this->hooks)) {
foreach($this->hooks as $hook) { foreach($this->hooks as $hook) {
if (! empty($hook['modules'])) { if (! empty($hook['modules'])) {
@@ -59,7 +59,7 @@
} }
} }
} }
// Editor wysiwyg // Editor wysiwyg
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
$nbrows=ROWS_2; $nbrows=ROWS_2;
@@ -72,7 +72,7 @@
<td align="right"> <td align="right">
<?php <?php
if ($buyer->tva_assuj == "0") echo '<input type="hidden" name="np_tva_tx" value="0">0'; if ($buyer->tva_assuj == "0") echo '<input type="hidden" name="np_tva_tx" value="0">0';
else $html->select_tva('np_tva_tx', $conf->defaulttx, $seller, $buyer); else echo $html->load_tva('np_tva_tx', -1, $seller, $buyer);
?> ?>
</td> </td>
<td align="right"><input type="text" size="5" name="np_price"></td> <td align="right"><input type="text" size="5" name="np_price"></td>

View File

@@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* $Id: freeproductline_edit.tpl.php,v 1.15 2011/07/31 23:45:11 eldy Exp $ * $Id: freeproductline_edit.tpl.php,v 1.16 2011/08/04 21:46:50 eldy Exp $
* *
* Need to have following variables defined: * Need to have following variables defined:
* $conf * $conf
@@ -37,7 +37,7 @@
<tr <?php echo $bc[$var]; ?>> <tr <?php echo $bc[$var]; ?>>
<td> <td>
<a name="<?php echo $line->id; ?>"></a> <a name="<?php echo $line->id; ?>"></a>
<?php <?php
if (! empty($this->hooks)) { if (! empty($this->hooks)) {
foreach($this->hooks as $hook) { foreach($this->hooks as $hook) {
@@ -61,7 +61,7 @@
?> ?>
</td> </td>
<td align="right"><?php echo $html->select_tva('tva_tx',$line->tva_tx,$seller,$buyer,0,$line->info_bits,$line->product_type); ?></td> <td align="right"><?php echo $html->load_tva('tva_tx',$line->tva_tx,$seller,$buyer,0,$line->info_bits,$line->product_type); ?></td>
<td align="right"><input size="6" type="text" class="flat" name="subprice" value="<?php echo price($line->subprice,0,'',0); ?>"></td> <td align="right"><input size="6" type="text" class="flat" name="subprice" value="<?php echo price($line->subprice,0,'',0); ?>"></td>

View File

@@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* $Id: predefinedproductline_edit.tpl.php,v 1.14 2011/07/31 23:45:11 eldy Exp $ * $Id: predefinedproductline_edit.tpl.php,v 1.15 2011/08/04 21:46:50 eldy Exp $
* *
* Need to have following variables defined: * Need to have following variables defined:
* $conf * $conf
@@ -69,7 +69,7 @@
?> ?>
</td> </td>
<td align="right"><?php echo $html->select_tva('tva_tx',$line->tva_tx,$seller,$buyer,'',$line->info_bits); ?></td> <td align="right"><?php echo $html->load_tva('tva_tx',$line->tva_tx,$seller,$buyer,'',$line->info_bits); ?></td>
<td align="right"><input size="6" type="text" class="flat" name="subprice" value="<?php echo price($line->subprice,0,'',0); ?>"></td> <td align="right"><input size="6" type="text" class="flat" name="subprice" value="<?php echo price($line->subprice,0,'',0); ?>"></td>

View File

@@ -25,7 +25,7 @@
* \file htdocs/fourn/commande/fiche.php * \file htdocs/fourn/commande/fiche.php
* \ingroup supplier, order * \ingroup supplier, order
* \brief Card supplier order * \brief Card supplier order
* \version $Id: fiche.php,v 1.232 2011/07/10 20:03:40 eldy Exp $ * \version $Id: fiche.php,v 1.233 2011/08/04 21:46:51 eldy Exp $
*/ */
require("../../main.inc.php"); require("../../main.inc.php");
@@ -1174,7 +1174,7 @@ if ($id > 0 || ! empty($ref))
print '</td>'; print '</td>';
print '<td>'; print '<td>';
$html->select_tva('tva_tx',$line->tva_tx); print $html->load_tva('tva_tx',$line->tva_tx);
print '</td>'; print '</td>';
print '<td align="right"><input size="5" type="text" name="pu" value="'.price($line->subprice).'"></td>'; print '<td align="right"><input size="5" type="text" name="pu" value="'.price($line->subprice).'"></td>';
print '<td align="right"><input size="2" type="text" name="qty" value="'.$line->qty.'"></td>'; print '<td align="right"><input size="2" type="text" name="qty" value="'.$line->qty.'"></td>';
@@ -1227,10 +1227,7 @@ if ($id > 0 || ! empty($ref))
print '</td>'; print '</td>';
print '<td align="center">'; print '<td align="center">';
//if($soc->tva_assuj == "0") print $html->load_tva('tva_tx',($_POST["tva_tx"]?$_POST["tva_tx"]:-1),$soc,$mysoc);
//print '<input type="hidden" name="tva_tx" value="0">0';
//else
print $html->select_tva('tva_tx',($_POST["tva_tx"]?$_POST["tva_tx"]:$conf->defaulttx),$soc,$mysoc);
print '</td>'; print '</td>';
print '<td align="right"><input type="text" name="pu" size="5" value="'.$_POST["pu"].'"></td>'; print '<td align="right"><input type="text" name="pu" size="5" value="'.$_POST["pu"].'"></td>';
print '<td align="right"><input type="text" name="qty" value="'.($_POST["qty"]?$_POST["qty"]:'1').'" size="2"></td>'; print '<td align="right"><input type="text" name="qty" value="'.($_POST["qty"]?$_POST["qty"]:'1').'" size="2"></td>';
@@ -1545,5 +1542,5 @@ if ($id > 0 || ! empty($ref))
$db->close(); $db->close();
llxFooter('$Date: 2011/07/10 20:03:40 $ - $Revision: 1.232 $'); llxFooter('$Date: 2011/08/04 21:46:51 $ - $Revision: 1.233 $');
?> ?>

View File

@@ -24,7 +24,7 @@
* \file htdocs/fourn/facture/fiche.php * \file htdocs/fourn/facture/fiche.php
* \ingroup facture, fournisseur * \ingroup facture, fournisseur
* \brief Page for supplier invoice card (view, edit, validate) * \brief Page for supplier invoice card (view, edit, validate)
* \version $Id: fiche.php,v 1.262 2011/07/31 23:57:00 eldy Exp $ * \version $Id: fiche.php,v 1.263 2011/08/04 21:46:50 eldy Exp $
*/ */
require("../../main.inc.php"); require("../../main.inc.php");
@@ -1114,7 +1114,7 @@ if ($_GET['action'] == 'create')
print '<td><input size="50" name="label'.$i.'" value="'.$value_label.'" type="text"></td>'; print '<td><input size="50" name="label'.$i.'" value="'.$value_label.'" type="text"></td>';
print '<td align="right"><input type="text" size="8" name="amount'.$i.'" value="'.$value_pu.'"></td>'; print '<td align="right"><input type="text" size="8" name="amount'.$i.'" value="'.$value_pu.'"></td>';
print '<td align="right">'; print '<td align="right">';
$html->select_tva('tauxtva'.$i,$value_tauxtva,$societe,$mysoc); print $html->load_tva('tauxtva'.$i,$value_tauxtva,$societe,$mysoc);
print '</td>'; print '</td>';
print '<td align="right"><input type="text" size="3" name="qty'.$i.'" value="'.$value_qty.'"></td>'; print '<td align="right"><input type="text" size="3" name="qty'.$i.'" value="'.$value_qty.'"></td>';
print '<td align="right"><input type="text" size="8" name="amountttc'.$i.'" value=""></td></tr>'; print '<td align="right"><input type="text" size="8" name="amountttc'.$i.'" value=""></td></tr>';
@@ -1549,7 +1549,7 @@ else
// VAT // VAT
print '<td align="right">'; print '<td align="right">';
$html->select_tva('tauxtva',$fac->lines[$i]->tva_tx,$societe,$mysoc); print $html->load_tva('tauxtva',$fac->lines[$i]->tva_tx,$societe,$mysoc);
print '</td>'; print '</td>';
// Unit price // Unit price
@@ -1678,7 +1678,7 @@ else
print '</td>'; print '</td>';
print '<td align="right">'; print '<td align="right">';
print $html->select_tva('tauxtva',$conf->defaulttx,$societe,$mysoc); print $html->load_tva('tauxtva',($_POST["tauxtva"]?$_POST["tauxtva"]:-1),$societe,$mysoc);
print '</td>'; print '</td>';
print '<td align="right">'; print '<td align="right">';
print '<input size="4" name="amount" type="text">'; print '<input size="4" name="amount" type="text">';
@@ -1915,5 +1915,5 @@ else
$db->close(); $db->close();
llxFooter('$Date: 2011/07/31 23:57:00 $ - $Revision: 1.262 $'); llxFooter('$Date: 2011/08/04 21:46:50 $ - $Revision: 1.263 $');
?> ?>

View File

@@ -28,7 +28,7 @@
* \file htdocs/lib/functions.lib.php * \file htdocs/lib/functions.lib.php
* \brief A set of functions for Dolibarr * \brief A set of functions for Dolibarr
* This file contains all frequently used functions. * This file contains all frequently used functions.
* \version $Id: functions.lib.php,v 1.550 2011/08/04 07:50:25 hregis Exp $ * \version $Id: functions.lib.php,v 1.551 2011/08/04 21:46:50 eldy Exp $
*/ */
// For compatibility during upgrade // For compatibility during upgrade
@@ -3150,14 +3150,24 @@ function get_default_tva($societe_vendeuse, $societe_acheteuse, $idprod=0)
dol_syslog("get_default_tva: seller use vat=".$societe_vendeuse->tva_assuj.", seller country=".$societe_vendeuse->pays_code.", seller in cee=".$societe_vendeuse->isInEEC().", buyer country=".$societe_acheteuse->pays_code.", buyer in cee=".$societe_acheteuse->isInEEC().", idprod=".$idprod.", SERVICE_ARE_ECOMMERCE_200238EC=".$conf->global->SERVICES_ARE_ECOMMERCE_200238EC); dol_syslog("get_default_tva: seller use vat=".$societe_vendeuse->tva_assuj.", seller country=".$societe_vendeuse->pays_code.", seller in cee=".$societe_vendeuse->isInEEC().", buyer country=".$societe_acheteuse->pays_code.", buyer in cee=".$societe_acheteuse->isInEEC().", idprod=".$idprod.", SERVICE_ARE_ECOMMERCE_200238EC=".$conf->global->SERVICES_ARE_ECOMMERCE_200238EC);
// Si vendeur non assujeti a TVA (tva_assuj vaut 0/1 ou franchise/reel) // Si vendeur non assujeti a 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)
if (! is_numeric($societe_vendeuse->tva_assuj) && $societe_vendeuse->tva_assuj=='franchise') return 0; {
//print 'VATRULE 1';
return 0;
}
if (! is_numeric($societe_vendeuse->tva_assuj) && $societe_vendeuse->tva_assuj=='franchise')
{
//print 'VATRULE 2';
return 0;
}
// Si le (pays vendeur = pays acheteur) alors la TVA par defaut=TVA du produit vendu. Fin de regle.
//if (is_object($societe_acheteuse) && ($societe_vendeuse->pays_id == $societe_acheteuse->pays_id) && ($societe_acheteuse->tva_assuj == 1 || $societe_acheteuse->tva_assuj == 'reel')) //if (is_object($societe_acheteuse) && ($societe_vendeuse->pays_id == $societe_acheteuse->pays_id) && ($societe_acheteuse->tva_assuj == 1 || $societe_acheteuse->tva_assuj == 'reel'))
// Le test ci-dessus ne devrait pas etre necessaire. Me signaler l'exemple du cas juridique concerne si le test suivant n'est pas suffisant. // Le test ci-dessus ne devrait pas etre necessaire. Me signaler l'exemple du cas juridique concerne si le test suivant n'est pas suffisant.
if ($societe_vendeuse->pays_code == $societe_acheteuse->pays_code) // Warning ->pays_id not always defined
// Si le (pays vendeur = pays acheteur) alors la TVA par defaut=TVA du produit vendu. Fin de regle.
if ($societe_vendeuse->pays_code == $societe_acheteuse->pays_code) // Warning ->pays_code not always defined
{ {
//print 'VATRULE 3';
return get_product_vat_for_country($idprod,$societe_vendeuse->pays_code); return get_product_vat_for_country($idprod,$societe_vendeuse->pays_code);
} }
@@ -3171,10 +3181,12 @@ function get_default_tva($societe_vendeuse, $societe_acheteuse, $idprod=0)
$isacompany=$societe_acheteuse->isACompany(); $isacompany=$societe_acheteuse->isACompany();
if ($isacompany) if ($isacompany)
{ {
//print 'VATRULE 4';
return 0; return 0;
} }
else else
{ {
//print 'VATRULE 5';
return get_product_vat_for_country($idprod,$societe_vendeuse->pays_code); return get_product_vat_for_country($idprod,$societe_vendeuse->pays_code);
} }
} }
@@ -3186,12 +3198,14 @@ function get_default_tva($societe_vendeuse, $societe_acheteuse, $idprod=0)
//print "eee".$societe_acheteuse->isACompany();exit; //print "eee".$societe_acheteuse->isACompany();exit;
if (! $societe_vendeuse->isInEEC() && $societe_acheteuse->isInEEC() && ! $societe_acheteuse->isACompany()) if (! $societe_vendeuse->isInEEC() && $societe_acheteuse->isInEEC() && ! $societe_acheteuse->isACompany())
{ {
//print 'VATRULE 6';
return get_product_vat_for_country($idprod,$societe_acheteuse->pays_code); return get_product_vat_for_country($idprod,$societe_acheteuse->pays_code);
} }
} }
// Sinon la TVA proposee par defaut=0. Fin de regle. // Sinon la TVA proposee par defaut=0. Fin de regle.
// Rem: Cela signifie qu'au moins un des 2 est hors Communaute europeenne et que le pays differe // Rem: Cela signifie qu'au moins un des 2 est hors Communaute europeenne et que le pays differe
//print 'VATRULE 7';
return 0; return 0;
} }

View File

@@ -24,7 +24,7 @@
* \file htdocs/product/class/product.class.php * \file htdocs/product/class/product.class.php
* \ingroup produit * \ingroup produit
* \brief Fichier de la classe des produits predefinis * \brief Fichier de la classe des produits predefinis
* \version $Id: product.class.php,v 1.48 2011/07/31 23:24:03 eldy Exp $ * \version $Id: product.class.php,v 1.49 2011/08/04 21:46:51 eldy Exp $
*/ */
require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php"); require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
@@ -2861,7 +2861,7 @@ class Product extends CommonObject
$this->tpl['price_base_type'] = $html->load_PriceBaseType($this->price_base_type, "price_base_type"); $this->tpl['price_base_type'] = $html->load_PriceBaseType($this->price_base_type, "price_base_type");
// VAT // VAT
$this->tpl['tva_tx'] = $html->load_tva("tva_tx",$conf->defaulttx,$mysoc,''); $this->tpl['tva_tx'] = $html->load_tva("tva_tx",-1,$mysoc,'');
} }
if ($action == 'create' || $action == 'edit') if ($action == 'create' || $action == 'edit')

View File

@@ -25,7 +25,7 @@
* \file htdocs/product/fiche.php * \file htdocs/product/fiche.php
* \ingroup product * \ingroup product
* \brief Page to show product * \brief Page to show product
* \version $Id: fiche.php,v 1.374 2011/07/31 23:19:26 eldy Exp $ * \version $Id: fiche.php,v 1.375 2011/08/04 21:46:50 eldy Exp $
*/ */
require("../main.inc.php"); require("../main.inc.php");
@@ -793,7 +793,7 @@ if ($action == 'create' && ($user->rights->produit->creer || $user->rights->serv
// VAT // VAT
print '<tr><td width="20%">'.$langs->trans("VATRate").'</td><td>'; print '<tr><td width="20%">'.$langs->trans("VATRate").'</td><td>';
print $html->select_tva("tva_tx",$conf->defaulttx,$mysoc,''); print $html->load_tva("tva_tx",-1,$mysoc,'');
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
@@ -1645,6 +1645,6 @@ if ($product->id && $action == '' && $product->status)
$db->close(); $db->close();
llxFooter('$Date: 2011/07/31 23:19:26 $ - $Revision: 1.374 $'); llxFooter('$Date: 2011/08/04 21:46:50 $ - $Revision: 1.375 $');
?> ?>

View File

@@ -23,7 +23,7 @@
* \file htdocs/product/price.php * \file htdocs/product/price.php
* \ingroup product * \ingroup product
* \brief Page to show product prices * \brief Page to show product prices
* \version $Id: price.php,v 1.110 2011/07/31 23:19:25 eldy Exp $ * \version $Id: price.php,v 1.111 2011/08/04 21:46:50 eldy Exp $
*/ */
require("../main.inc.php"); require("../main.inc.php");
@@ -317,7 +317,7 @@ if ($_GET["action"] == 'edit_price' && ($user->rights->produit->creer || $user->
// VAT // VAT
print '<tr><td>'.$langs->trans("VATRate").'</td><td>'; print '<tr><td>'.$langs->trans("VATRate").'</td><td>';
print $html->select_tva("tva_tx",$product->tva_tx,$mysoc,'',$product->id); print $html->load_tva("tva_tx",$product->tva_tx,$mysoc,'',$product->id);
print '</td></tr>'; print '</td></tr>';
// Price base // Price base
@@ -377,7 +377,7 @@ if ($_GET["action"] == 'edit_price' && ($user->rights->produit->creer || $user->
if ($i == 1) if ($i == 1)
{ {
print '<tr><td>'.$langs->trans("VATRate").'</td><td>'; print '<tr><td>'.$langs->trans("VATRate").'</td><td>';
print $html->select_tva("tva_tx_".$i,$product->multiprices_tva_tx["$i"],$mysoc,'',$product->id); print $html->load_tva("tva_tx_".$i,$product->multiprices_tva_tx["$i"],$mysoc,'',$product->id);
print '</td></tr>'; print '</td></tr>';
} }
else else
@@ -534,5 +534,5 @@ else
$db->close(); $db->close();
llxFooter('$Date: 2011/07/31 23:19:25 $ - $Revision: 1.110 $'); llxFooter('$Date: 2011/08/04 21:46:50 $ - $Revision: 1.111 $');
?> ?>