forked from Wavyzz/dolibarr
New: Add option MAIN_DISABLEVATCHECK to disable link to VAT check
This commit is contained in:
@@ -105,6 +105,17 @@ class ActionsCardDefault extends ActionsCardCommon
|
||||
$this->tpl['profid2'] = $this->object->siret;
|
||||
$this->tpl['profid3'] = $this->object->ape;
|
||||
$this->tpl['profid4'] = $this->object->idprof4;
|
||||
|
||||
if ($conf->use_javascript_ajax && empty($conf->global->MAIN_DISABLEVATCHECK)) {
|
||||
$js = "\n";
|
||||
$js.= '<script language="JavaScript" type="text/javascript">';
|
||||
$js.= "function CheckVAT(a) {\n";
|
||||
$js.= "newpopup('".DOL_URL_ROOT."/societe/checkvat/checkVatPopup.php?vatNumber='+a,'".dol_escape_js($langs->trans("VATIntraCheckableOnEUSite"))."',500,230);\n";
|
||||
$js.= "}\n";
|
||||
$js.= '</script>';
|
||||
$js.= "\n";
|
||||
$this->tpl['js_checkVatPopup'] = $js;
|
||||
}
|
||||
|
||||
if ($action == 'create' || $action == 'edit')
|
||||
{
|
||||
@@ -124,18 +135,25 @@ class ActionsCardDefault extends ActionsCardCommon
|
||||
$this->tpl['select_workforce'] = $form->selectarray("effectif_id",$formcompany->effectif_array(0), $this->object->effectif_id);
|
||||
|
||||
// VAT intra
|
||||
$s ='<input type="text" class="flat" name="tva_intra" size="12" maxlength="20" value="'.$this->object->tva_intra.'">';
|
||||
$s.=' ';
|
||||
if ($conf->use_javascript_ajax)
|
||||
$s='<input type="text" class="flat" name="tva_intra" size="12" maxlength="20" value="'.$this->object->tva_intra.'">';
|
||||
if (empty($conf->global->MAIN_DISABLEVATCHECK))
|
||||
{
|
||||
$s.='<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>';
|
||||
$this->tpl['tva_intra'] = $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1);
|
||||
$s.=' ';
|
||||
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
$s.='<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>';
|
||||
$this->tpl['tva_intra'] = $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->tpl['tva_intra'] = $s.'<a href="'.$langs->transcountry("VATIntraCheckURL",$this->object->id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->tpl['tva_intra'] = $s.'<a href="'.$langs->transcountry("VATIntraCheckURL",$this->object->id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>';
|
||||
$this->tpl['tva_intra'] = $s;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($action == 'view')
|
||||
@@ -154,21 +172,29 @@ class ActionsCardDefault extends ActionsCardCommon
|
||||
}
|
||||
|
||||
// TVA intra
|
||||
if ($this->tva_intra)
|
||||
if ($this->object->tva_intra)
|
||||
{
|
||||
$s='';
|
||||
$s.=$this->object->tva_intra;
|
||||
$s=$this->object->tva_intra;
|
||||
$s.='<input type="hidden" name="tva_intra" size="12" maxlength="20" value="'.$this->object->tva_intra.'">';
|
||||
$s.=' ';
|
||||
if ($conf->use_javascript_ajax)
|
||||
if (empty($conf->global->MAIN_DISABLEVATCHECK))
|
||||
{
|
||||
$s.='<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>';
|
||||
$this->tpl['tva_intra'] = $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1);
|
||||
$s.=' ';
|
||||
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
$s.='<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>';
|
||||
$this->tpl['tva_intra'] = $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->tpl['tva_intra'] = $s.'<a href="'.$langs->transcountry("VATIntraCheckURL",$this->object->id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->tpl['tva_intra'] = $s.'<a href="'.$langs->transcountry("VATIntraCheckURL",$this->object->id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>';
|
||||
$this->tpl['tva_intra'] = $s;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
<?php echo $this->control->tpl['ajax_selectcountry']; ?>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($this->control->tpl['js_checkVatPopup']) echo $this->control->tpl['js_checkVatPopup']; ?>
|
||||
|
||||
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="POST" name="formsoc">
|
||||
|
||||
<input type="hidden" name="canvas" value="<?php echo $canvas ?>">
|
||||
@@ -161,7 +163,7 @@ for ($i=1; $i<=4; $i++) {
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Type"); ?></td>
|
||||
<td><?php echo $langs->trans("ThirdPartyType"); ?></td>
|
||||
<td><?php echo $this->control->tpl['select_companytype']; echo $this->control->tpl['info_admin']; ?></td>
|
||||
<td><?php echo $langs->trans("Staff"); ?></td>
|
||||
<td><?php echo $this->control->tpl['select_workforce']; echo $this->control->tpl['info_admin']; ?></td>
|
||||
@@ -174,14 +176,6 @@ for ($i=1; $i<=4; $i++) {
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($conf->use_javascript_ajax) { ?>
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
function CheckVAT(a) {
|
||||
newpopup('<?php echo DOL_URL_ROOT; ?>/societe/checkvat/checkVatPopup.php?vatNumber='+a,'<?php echo dol_escape_js($langs->trans("VATIntraCheckableOnEUSite")); ?>',500,260);
|
||||
}
|
||||
</script>
|
||||
<?php } ?>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans('VATIsUsed'); ?></td>
|
||||
<td><?php echo $this->control->tpl['yn_assujtva']; ?></td>
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
|
||||
<?php echo $this->control->tpl['ajax_selectcountry']; ?>
|
||||
<?php if ($this->control->tpl['js_checkVatPopup']) echo $this->control->tpl['js_checkVatPopup']; ?>
|
||||
|
||||
<form action="<?php echo $_SERVER["PHP_SELF"].'?socid='.$this->control->tpl['id']; ?>" method="POST" name="formsoc">
|
||||
<input type="hidden" name="canvas" value="<?php echo $canvas ?>">
|
||||
@@ -174,7 +175,7 @@ for ($i=1; $i<=4; $i++) {
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Type"); ?></td>
|
||||
<td><?php echo $langs->trans("ThirdPartyType"); ?></td>
|
||||
<td><?php echo $this->control->tpl['select_companytype']; echo $this->control->tpl['info_admin']; ?></td>
|
||||
<td><?php echo $langs->trans("Staff"); ?></td>
|
||||
<td><?php echo $this->control->tpl['select_workforce']; echo $this->control->tpl['info_admin']; ?></td>
|
||||
@@ -187,14 +188,6 @@ for ($i=1; $i<=4; $i++) {
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($conf->use_javascript_ajax) { ?>
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
function CheckVAT(a) {
|
||||
newpopup('<?php echo DOL_URL_ROOT; ?>/societe/checkvat/checkVatPopup.php?vatNumber='+a,'<?php echo dol_escape_js($langs->trans("VATIntraCheckableOnEUSite")); ?>',500,260);
|
||||
}
|
||||
</script>
|
||||
<?php } ?>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans('VATIsUsed'); ?></td>
|
||||
<td><?php echo $this->control->tpl['yn_assujtva']; ?></td>
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
|
||||
<?php if ($this->control->tpl['action_delete']) echo $this->control->tpl['action_delete']; ?>
|
||||
<?php if ($this->control->tpl['js_checkVatPopup']) echo $this->control->tpl['js_checkVatPopup']; ?>
|
||||
|
||||
<form name="formsoc" method="POST">
|
||||
<input type="hidden" name="canvas" value="<?php echo $canvas ?>">
|
||||
@@ -129,15 +130,6 @@ for ($i=1; $i<=4; $i++) {
|
||||
<tr>
|
||||
<td><?php echo $langs->trans('VATIsUsed'); ?></td>
|
||||
<td><?php echo $this->control->tpl['tva_assuj']; ?></td>
|
||||
|
||||
<?php if ($conf->use_javascript_ajax) { ?>
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
function CheckVAT(a) {
|
||||
newpopup('<?php echo DOL_URL_ROOT; ?>/societe/checkvat/checkVatPopup.php?vatNumber='+a,'<?php echo dol_escape_js($langs->trans("VATIntraCheckableOnEUSite")); ?>',500,260);
|
||||
}
|
||||
</script>
|
||||
<?php } ?>
|
||||
|
||||
<td nowrap="nowrap"><?php echo $langs->trans('VATIntra'); ?></td>
|
||||
<td><?php echo $this->control->tpl['tva_intra']; ?></td>
|
||||
</tr>
|
||||
@@ -160,7 +152,7 @@ function CheckVAT(a) {
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Type"); ?></td>
|
||||
<td><?php echo $langs->trans("ThirdPartyType"); ?></td>
|
||||
<td><?php echo $this->control->tpl['typent']; ?></td>
|
||||
<td><?php echo $langs->trans("Staff"); ?></td>
|
||||
<td><?php echo $this->control->tpl['effectif']; ?></td>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Brian Fraval <brian@fraval.org>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2008 Patrick Raguin <patrick.raguin@auguria.net>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
@@ -877,33 +877,36 @@ else
|
||||
print '<td nowrap="nowrap">'.$langs->trans('VATIntra').'</td>';
|
||||
print '<td nowrap="nowrap">';
|
||||
$s ='<input type="text" class="flat" name="tva_intra" size="12" maxlength="20" value="'.$soc->tva_intra.'">';
|
||||
$s.=' ';
|
||||
if ($conf->use_javascript_ajax)
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLEVATCHECK))
|
||||
{
|
||||
print "\n";
|
||||
print '<script language="JavaScript" type="text/javascript">';
|
||||
print "function CheckVAT(a) {\n";
|
||||
print "newpopup('".DOL_URL_ROOT."/societe/checkvat/checkVatPopup.php?vatNumber='+a,'".dol_escape_js($langs->trans("VATIntraCheckableOnEUSite"))."',500,230);\n";
|
||||
print "}\n";
|
||||
print '</script>';
|
||||
print "\n";
|
||||
if (empty($conf->global->MAIN_DISABLEVATCHECK))
|
||||
{
|
||||
$s.='<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>';
|
||||
print $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1);
|
||||
}
|
||||
else print $s;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($conf->global->MAIN_DISABLEVATCHECK)) $s.='<a href="'.$langs->transcountry("VATIntraCheckURL",$soc->id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>';
|
||||
print $s;
|
||||
$s.=' ';
|
||||
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
print "\n";
|
||||
print '<script language="JavaScript" type="text/javascript">';
|
||||
print "function CheckVAT(a) {\n";
|
||||
print "newpopup('".DOL_URL_ROOT."/societe/checkvat/checkVatPopup.php?vatNumber='+a,'".dol_escape_js($langs->trans("VATIntraCheckableOnEUSite"))."',500,230);\n";
|
||||
print "}\n";
|
||||
print '</script>';
|
||||
print "\n";
|
||||
$s.='<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>';
|
||||
print $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$s.='<a href="'.$langs->transcountry("VATIntraCheckURL",$soc->id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
print $s;
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
|
||||
// Local Taxes
|
||||
// TODO add specific function by country
|
||||
if($mysoc->pays_code=='ES')
|
||||
{
|
||||
if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1")
|
||||
@@ -1256,32 +1259,36 @@ else
|
||||
print '<td nowrap="nowrap">'.$langs->trans('VATIntra').'</td>';
|
||||
print '<td nowrap="nowrap">';
|
||||
$s ='<input type="text" class="flat" name="tva_intra" size="12" maxlength="20" value="'.$soc->tva_intra.'">';
|
||||
$s.=' ';
|
||||
if ($conf->use_javascript_ajax)
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLEVATCHECK))
|
||||
{
|
||||
print "\n";
|
||||
print '<script language="JavaScript" type="text/javascript">';
|
||||
print "function CheckVAT(a) {\n";
|
||||
print "newpopup('".DOL_URL_ROOT."/societe/checkvat/checkVatPopup.php?vatNumber='+a,'".dol_escape_js($langs->trans("VATIntraCheckableOnEUSite"))."',500,285);\n";
|
||||
print "}\n";
|
||||
print '</script>';
|
||||
print "\n";
|
||||
if (empty($conf->global->MAIN_DISABLEVATCHECK))
|
||||
{
|
||||
$s.='<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>';
|
||||
print $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1);
|
||||
}
|
||||
else print $s;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($conf->global->MAIN_DISABLEVATCHECK)) $s.='<a href="'.$langs->transcountry("VATIntraCheckURL",$soc->id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>';
|
||||
print $s;
|
||||
$s.=' ';
|
||||
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
print "\n";
|
||||
print '<script language="JavaScript" type="text/javascript">';
|
||||
print "function CheckVAT(a) {\n";
|
||||
print "newpopup('".DOL_URL_ROOT."/societe/checkvat/checkVatPopup.php?vatNumber='+a,'".dol_escape_js($langs->trans("VATIntraCheckableOnEUSite"))."',500,285);\n";
|
||||
print "}\n";
|
||||
print '</script>';
|
||||
print "\n";
|
||||
$s.='<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>';
|
||||
print $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$s.='<a href="'.$langs->transcountry("VATIntraCheckURL",$soc->id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
print $s;
|
||||
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Local Taxes
|
||||
// TODO add specific function by country
|
||||
if($mysoc->pays_code=='ES')
|
||||
{
|
||||
if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1")
|
||||
@@ -1519,28 +1526,29 @@ else
|
||||
$s='';
|
||||
$s.=$soc->tva_intra;
|
||||
$s.='<input type="hidden" name="tva_intra" size="12" maxlength="20" value="'.$soc->tva_intra.'">';
|
||||
$s.=' ';
|
||||
if ($conf->use_javascript_ajax)
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLEVATCHECK))
|
||||
{
|
||||
print "\n";
|
||||
print '<script language="JavaScript" type="text/javascript">';
|
||||
print "function CheckVAT(a) {\n";
|
||||
print "newpopup('".DOL_URL_ROOT."/societe/checkvat/checkVatPopup.php?vatNumber='+a,'".dol_escape_js($langs->trans("VATIntraCheckableOnEUSite"))."',500,285);\n";
|
||||
print "}\n";
|
||||
print '</script>';
|
||||
print "\n";
|
||||
if (empty($conf->global->MAIN_DISABLEVATCHECK))
|
||||
{
|
||||
$s.='<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>';
|
||||
$s.=' ';
|
||||
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
print "\n";
|
||||
print '<script language="JavaScript" type="text/javascript">';
|
||||
print "function CheckVAT(a) {\n";
|
||||
print "newpopup('".DOL_URL_ROOT."/societe/checkvat/checkVatPopup.php?vatNumber='+a,'".dol_escape_js($langs->trans("VATIntraCheckableOnEUSite"))."',500,285);\n";
|
||||
print "}\n";
|
||||
print '</script>';
|
||||
print "\n";
|
||||
$s.='<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>';
|
||||
print $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1);
|
||||
}
|
||||
else print $s;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($conf->global->MAIN_DISABLEVATCHECK)) $s.='<a href="'.$langs->transcountry("VATIntraCheckURL",$soc->id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>';
|
||||
print $s;
|
||||
}
|
||||
else
|
||||
{
|
||||
$s.='<a href="'.$langs->transcountry("VATIntraCheckURL",$soc->id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>';
|
||||
}
|
||||
}
|
||||
print $s;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1551,6 +1559,7 @@ else
|
||||
print '</tr>';
|
||||
|
||||
// Local Taxes
|
||||
// TODO add specific function by country
|
||||
if($mysoc->pays_code=='ES')
|
||||
{
|
||||
if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1")
|
||||
|
||||
Reference in New Issue
Block a user