From aa4b3f07014e35a975ffbe7bd812ec2cd9fd9f85 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 31 Jan 2011 10:32:51 +0000 Subject: [PATCH] New: Add option MAIN_DISABLEVATCHECK to disable link to VAT check --- .../default/actions_card_default.class.php | 56 ++++++-- .../canvas/default/tpl/card_create.tpl.php | 12 +- .../canvas/default/tpl/card_edit.tpl.php | 11 +- .../canvas/default/tpl/card_view.tpl.php | 12 +- htdocs/societe/soc.php | 131 ++++++++++-------- 5 files changed, 118 insertions(+), 104 deletions(-) diff --git a/htdocs/societe/canvas/default/actions_card_default.class.php b/htdocs/societe/canvas/default/actions_card_default.class.php index 716d8d2f448..9404d4ef6e0 100644 --- a/htdocs/societe/canvas/default/actions_card_default.class.php +++ b/htdocs/societe/canvas/default/actions_card_default.class.php @@ -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.= ''; + $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 =''; - $s.=' '; - if ($conf->use_javascript_ajax) + $s=''; + if (empty($conf->global->MAIN_DISABLEVATCHECK)) { - $s.=''.$langs->trans("VATIntraCheck").''; - $this->tpl['tva_intra'] = $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1); + $s.=' '; + + if ($conf->use_javascript_ajax) + { + $s.=''.$langs->trans("VATIntraCheck").''; + $this->tpl['tva_intra'] = $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1); + } + else + { + $this->tpl['tva_intra'] = $s.'object->id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').''; + } } else { - $this->tpl['tva_intra'] = $s.'object->id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').''; + $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.=''; - $s.='   '; - if ($conf->use_javascript_ajax) + if (empty($conf->global->MAIN_DISABLEVATCHECK)) { - $s.=''.$langs->trans("VATIntraCheck").''; - $this->tpl['tva_intra'] = $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1); + $s.='   '; + + if ($conf->use_javascript_ajax) + { + $s.=''.$langs->trans("VATIntraCheck").''; + $this->tpl['tva_intra'] = $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1); + } + else + { + $this->tpl['tva_intra'] = $s.'object->id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').''; + } } else { - $this->tpl['tva_intra'] = $s.'object->id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').''; + $this->tpl['tva_intra'] = $s; } + } else { diff --git a/htdocs/societe/canvas/default/tpl/card_create.tpl.php b/htdocs/societe/canvas/default/tpl/card_create.tpl.php index a57e86495b0..978fc4df793 100644 --- a/htdocs/societe/canvas/default/tpl/card_create.tpl.php +++ b/htdocs/societe/canvas/default/tpl/card_create.tpl.php @@ -33,6 +33,8 @@ control->tpl['ajax_selectcountry']; ?> +control->tpl['js_checkVatPopup']) echo $this->control->tpl['js_checkVatPopup']; ?> +
" method="POST" name="formsoc"> @@ -161,7 +163,7 @@ for ($i=1; $i<=4; $i++) { - trans("Type"); ?> + trans("ThirdPartyType"); ?> control->tpl['select_companytype']; echo $this->control->tpl['info_admin']; ?> trans("Staff"); ?> control->tpl['select_workforce']; echo $this->control->tpl['info_admin']; ?> @@ -174,14 +176,6 @@ for ($i=1; $i<=4; $i++) { -use_javascript_ajax) { ?> - - - trans('VATIsUsed'); ?> control->tpl['yn_assujtva']; ?> diff --git a/htdocs/societe/canvas/default/tpl/card_edit.tpl.php b/htdocs/societe/canvas/default/tpl/card_edit.tpl.php index 82bafbacea7..1696bd1a945 100644 --- a/htdocs/societe/canvas/default/tpl/card_edit.tpl.php +++ b/htdocs/societe/canvas/default/tpl/card_edit.tpl.php @@ -22,6 +22,7 @@ control->tpl['ajax_selectcountry']; ?> +control->tpl['js_checkVatPopup']) echo $this->control->tpl['js_checkVatPopup']; ?> " method="POST" name="formsoc"> @@ -174,7 +175,7 @@ for ($i=1; $i<=4; $i++) { - trans("Type"); ?> + trans("ThirdPartyType"); ?> control->tpl['select_companytype']; echo $this->control->tpl['info_admin']; ?> trans("Staff"); ?> control->tpl['select_workforce']; echo $this->control->tpl['info_admin']; ?> @@ -187,14 +188,6 @@ for ($i=1; $i<=4; $i++) { -use_javascript_ajax) { ?> - - - trans('VATIsUsed'); ?> control->tpl['yn_assujtva']; ?> diff --git a/htdocs/societe/canvas/default/tpl/card_view.tpl.php b/htdocs/societe/canvas/default/tpl/card_view.tpl.php index 911e7b48e65..fdcb5551324 100644 --- a/htdocs/societe/canvas/default/tpl/card_view.tpl.php +++ b/htdocs/societe/canvas/default/tpl/card_view.tpl.php @@ -22,6 +22,7 @@ control->tpl['action_delete']) echo $this->control->tpl['action_delete']; ?> +control->tpl['js_checkVatPopup']) echo $this->control->tpl['js_checkVatPopup']; ?> @@ -129,15 +130,6 @@ for ($i=1; $i<=4; $i++) { trans('VATIsUsed'); ?> control->tpl['tva_assuj']; ?> - -use_javascript_ajax) { ?> - - - trans('VATIntra'); ?> control->tpl['tva_intra']; ?> @@ -160,7 +152,7 @@ function CheckVAT(a) { - trans("Type"); ?> + trans("ThirdPartyType"); ?> control->tpl['typent']; ?> trans("Staff"); ?> control->tpl['effectif']; ?> diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index c8c9bc7b487..1a52e896c6e 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1,9 +1,9 @@ * Copyright (C) 2003 Brian Fraval - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005 Eric Seigne - * Copyright (C) 2005-2010 Regis Houssin + * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2008 Patrick Raguin * Copyright (C) 2010 Juanjo Menent * @@ -877,33 +877,36 @@ else print ''.$langs->trans('VATIntra').''; print ''; $s =''; - $s.=' '; - if ($conf->use_javascript_ajax) + + if (empty($conf->global->MAIN_DISABLEVATCHECK)) { - print "\n"; - print ''; - print "\n"; - if (empty($conf->global->MAIN_DISABLEVATCHECK)) - { - $s.=''.$langs->trans("VATIntraCheck").''; - print $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1); - } - else print $s; - } - else - { - if (empty($conf->global->MAIN_DISABLEVATCHECK)) $s.='id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').''; - print $s; + $s.=' '; + + if ($conf->use_javascript_ajax) + { + print "\n"; + print ''; + print "\n"; + $s.=''.$langs->trans("VATIntraCheck").''; + print $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1); + } + else + { + $s.='id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').''; + } } + + print $s; print ''; print ''; // 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 ''.$langs->trans('VATIntra').''; print ''; $s =''; - $s.='   '; - if ($conf->use_javascript_ajax) + + if (empty($conf->global->MAIN_DISABLEVATCHECK)) { - print "\n"; - print ''; - print "\n"; - if (empty($conf->global->MAIN_DISABLEVATCHECK)) - { - $s.=''.$langs->trans("VATIntraCheck").''; - print $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1); - } - else print $s; - } - else - { - if (empty($conf->global->MAIN_DISABLEVATCHECK)) $s.='id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').''; - print $s; + $s.='   '; + + if ($conf->use_javascript_ajax) + { + print "\n"; + print ''; + print "\n"; + $s.=''.$langs->trans("VATIntraCheck").''; + print $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1); + } + else + { + $s.='id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').''; + } } + + print $s; + print ''; print ''; // 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.=''; - $s.='   '; - if ($conf->use_javascript_ajax) + + if (empty($conf->global->MAIN_DISABLEVATCHECK)) { - print "\n"; - print ''; - print "\n"; - if (empty($conf->global->MAIN_DISABLEVATCHECK)) - { - $s.=''.$langs->trans("VATIntraCheck").''; + $s.='   '; + + if ($conf->use_javascript_ajax) + { + print "\n"; + print ''; + print "\n"; + $s.=''.$langs->trans("VATIntraCheck").''; print $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1); - } - else print $s; - } - else - { - if (empty($conf->global->MAIN_DISABLEVATCHECK)) $s.='id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').''; - print $s; + } + else + { + $s.='id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').''; + } } + print $s; } else { @@ -1551,6 +1559,7 @@ else print ''; // Local Taxes + // TODO add specific function by country if($mysoc->pays_code=='ES') { if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1")