diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index f161d979afa39395de619b7d4ff07642cccbff45..cc930358ad1d1237e915bc72537604266be22167 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -56,7 +56,7 @@ if ( (isset($_POST["action"]) && $_POST["action"] == 'update' && empty($_POST["c $new_pays_id=$_POST["pays_id"]; $new_pays_code=getCountry($new_pays_id,2); $new_pays_label=getCountry($new_pays_id,0); - //dolibarr_set_const($db, "MAIN_INFO_SOCIETE_PAYS", $new_pays_id,'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_INFO_SOCIETE_PAYS", $new_pays_id.':'.$new_pays_code.':'.$new_pays_label,'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM",$_POST["nom"],'chaine',0,'',$conf->entity); diff --git a/htdocs/admin/taxes.php b/htdocs/admin/taxes.php index 7b91d58f76bf811c867eba5bce68b73ce4501a71..6128d3754dcb8416cb9dc5818f1f98b6e89dcae4 100644 --- a/htdocs/admin/taxes.php +++ b/htdocs/admin/taxes.php @@ -35,6 +35,7 @@ $langs->load('taxes'); if (!$user->admin) accessforbidden(); + /* * View */ @@ -43,7 +44,7 @@ llxHeader(); // 0=normal, 1=option vat for services is on debit -$tax_mode = defined('TAX_MODE')?TAX_MODE:0; +$tax_mode = empty($conf->global->TAX_MODE)?0:$conf->global->TAX_MODE; // TAX_MODE=0 (most cases): // Buy Sell @@ -53,13 +54,29 @@ $tax_mode = defined('TAX_MODE')?TAX_MODE:0; // TAX_MODE=1 (option): // Buy Sell // Product On delivery On delivery -// Service On payment On invoice +// Service On invoice On invoice if ($_POST['action'] == 'settaxmode') { $tax_mode = $_POST['tax_mode']; if (! dolibarr_set_const($db, 'TAX_MODE', $tax_mode,'chaine',0,'',$conf->entity)) { print $db->error(); } + + if ($tax_mode == 0) + { + if (! dolibarr_set_const($db, 'TAX_MODE_SELL_PRODUCT', 'invoice','chaine',0,'',$conf->entity)) { print $db->error(); } + if (! dolibarr_set_const($db, 'TAX_MODE_BUY_PRODUCT', 'invoice','chaine',0,'',$conf->entity)) { print $db->error(); } + if (! dolibarr_set_const($db, 'TAX_MODE_SELL_SERVICE', 'payment','chaine',0,'',$conf->entity)) { print $db->error(); } + if (! dolibarr_set_const($db, 'TAX_MODE_BUY_SERVICE', 'payment','chaine',0,'',$conf->entity)) { print $db->error(); } + } + if ($tax_mode == 1) + { + if (! dolibarr_set_const($db, 'TAX_MODE_SELL_PRODUCT', 'invoice','chaine',0,'',$conf->entity)) { print $db->error(); } + if (! dolibarr_set_const($db, 'TAX_MODE_BUY_PRODUCT', 'invoice','chaine',0,'',$conf->entity)) { print $db->error(); } + if (! dolibarr_set_const($db, 'TAX_MODE_SELL_SERVICE', 'invoice','chaine',0,'',$conf->entity)) { print $db->error(); } + if (! dolibarr_set_const($db, 'TAX_MODE_BUY_SERVICE', 'invoice','chaine',0,'',$conf->entity)) { print $db->error(); } + } + } if ($_POST['action'] == 'update' || $_POST['action'] == 'add') @@ -121,21 +138,31 @@ else print '<table class="border" width="100%">'; print '<tr><td> </td><td>'.$langs->trans("Buy").'</td><td>'.$langs->trans("Sell").'</td></tr>'; + // Products print '<tr><td>'.$langs->trans("Product").'</td>'; print '<td>'; print $langs->trans("OnDelivery"); - print ' ('.$langs->trans("SupposedToBePaymentDate").')'; + print ' ('.$langs->trans("SupposedToBeInvoiceDate").')'; print '</td>'; print '<td>'; print $langs->trans("OnDelivery"); - print ' ('.$langs->trans("SupposedToBePaymentDate").')'; + print ' ('.$langs->trans("SupposedToBeInvoiceDate").')'; print '</td></tr>'; + // Services print '<tr><td>'.$langs->trans("Services").'</td>'; print '<td>'; - print $langs->trans("OnPayment"); - print ' ('.$langs->trans("SupposedToBePaymentDate").')'; + if ($tax_mode == 0) + { + print $langs->trans("OnPayment"); + print ' ('.$langs->trans("SupposedToBePaymentDate").')'; + } + if ($tax_mode == 1) + { + print $langs->trans("OnInvoice"); + print ' ('.$langs->trans("InvoiceDateUsed").')'; + } print '</td>'; print '<td>'; if ($tax_mode == 0) @@ -146,9 +173,10 @@ else if ($tax_mode == 1) { print $langs->trans("OnInvoice"); - print ' ('.$langs->trans("InvoiceValidateDateUsed").')'; + print ' ('.$langs->trans("InvoiceDateUsed").')'; } print '</td></tr>'; + print '</table>'; } diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index e0666b847d14d2a5634c5410d1a5d97826f6e9bf..57a1d854ad1bb3a406de5e777848428c51b414e9 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -202,7 +202,6 @@ class Conf //var_dump($this->modules); // Clean some variables - // conf->menu_top is defined in main.inc.php if (! $this->global->MAIN_MENU_BARRETOP) $this->global->MAIN_MENU_BARRETOP="eldy_backoffice.php"; if (! $this->global->MAIN_MENUFRONT_BARRETOP) $this->global->MAIN_MENUFRONT_BARRETOP="eldy_frontoffice.php"; if (empty($this->global->MAIN_MENU_SMARTPHONE)) $this->global->MAIN_MENU_SMARTPHONE="iphone_backoffice.php"; @@ -307,6 +306,7 @@ class Conf $this->boutique->livre->enabled=defined("BOUTIQUE_LIVRE")?BOUTIQUE_LIVRE:0; $this->boutique->album->enabled=defined("BOUTIQUE_ALBUM")?BOUTIQUE_ALBUM:0; + /* * Set some default values */ @@ -420,11 +420,16 @@ class Conf // Define umask if (empty($this->global->MAIN_UMASK)) $this->global->MAIN_UMASK='0664'; - /* TODO Ajouter une option Gestion de la TVA dans le module compta qui permet de desactiver la fonction TVA - * (pour particuliers ou liberaux en franchise) - * En attendant, valeur forcee a 1 car toujours interessant a avoir meme ceux qui veulent pas. + // Set default variable to calculate VAT as if option tax_mode was 0 (standard) + if (empty($this->global->TAX_MODE_SELL_PRODUCT)) $this->global->TAX_MODE_SELL_PRODUCT='invoice'; + if (empty($this->global->TAX_MODE_BUY_PRODUCT)) $this->global->TAX_MODE_BUY_PRODUCT='invoice'; + if (empty($this->global->TAX_MODE_SELL_SERVICE)) $this->global->TAX_MODE_SELL_SERVICE='payment'; + if (empty($this->global->TAX_MODE_BUY_SERVICE)) $this->global->TAX_MODE_BUY_SERVICE='payment'; + + /* We always show vat menus if module tax is enabled. + * Because even when vat option is 'franchise' and vat rate is 0, we have to pay vat. */ - $this->compta->tva=1; + $this->compta->tva=1; // This option means "Show vat menus" // Delais de tolerance des alertes $this->actions->warning_delay=$this->global->MAIN_DELAY_ACTIONS_TODO*24*60*60; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index a7dd434639f99abacff4382feada3b9992d82545..edcb505744c9442e14fec16c187bdd19e2661a87 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1146,16 +1146,17 @@ TaxSetup=Taxes, social contributions and dividends module setup OptionVatMode=VAT due OptionVATDefault=Standard OptionVATDebitOption=Option services on Debit -OptionVatDefaultDesc=VAT is due:<br>- on delivery/payments for goods<br>- on payments for services -OptionVatDebitOptionDesc=VAT is due:<br>- on delivery/payments for goods<br>- on invoice (debit) for services +OptionVatDefaultDesc=VAT is due:<br>- on delivery for goods (we use invoice date)<br>- on payments for services +OptionVatDebitOptionDesc=VAT is due:<br>- on delivery for goods (we use invoice date)<br>- on invoice (debit) for services SummaryOfVatExigibilityUsedByDefault=Time of VAT exigibility by default according to choosed option: OnDelivery=On delivery OnPayment=On payment OnInvoice=On invoice -SupposedToBePaymentDate=Payment date used if delivery date not known +SupposedToBePaymentDate=Payment date used +SupposedToBeInvoiceDate=Invoice date used Buy=Buy Sell=Sell -InvoiceValidateDateUsed=Invoice dtate used +InvoiceDateUsed=Invoice date used YourCompanyDoesNotUseVAT=Your company has been defined to not use VAT (Home - Setup - Company/Foundation), so there is no VAT options to setup. ##### Agenda ##### AgendaSetup=Actions and agenda module setup diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index d92c5518308e52de6099b28b1510bebc48431b3b..ab01018d5dfb64f9190b7c0506ed2fc1bd7e1cff 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -1158,16 +1158,17 @@ TaxSetup= Configuration du module Taxes, charges sociales et dividendes OptionVatMode= Option d'exigibilité de TVA par défaut OptionVATDefault= Standard OptionVATDebitOption= Option services sur Débit -OptionVatDefaultDesc= L'exigibilité de la TVA est:<br>- sur livraison pour les biens<br>- sur paiement pour les services -OptionVatDebitOptionDesc= L'exigibilité de la TVA est:<br>- sur livraison pour les biens<br>- sur facturation (débit) pour les services +OptionVatDefaultDesc= L'exigibilité de la TVA est:<br>- sur livraison pour les biens (en pratique on utilise la date de facturation)<br>- sur paiement pour les services +OptionVatDebitOptionDesc= L'exigibilité de la TVA est:<br>- sur livraison pour les biens (en pratique on utilise la date de facturation)<br>- sur facturation (débit) pour les services SummaryOfVatExigibilityUsedByDefault=Moment d'exigibilité par défaut de la TVA pour l'option choisie: OnDelivery=Sur livraison OnPayment=Sur paiement OnInvoice=Sur facture SupposedToBePaymentDate=Date de paiement utilisée +SupposedToBeInvoiceDate=Date de facture utilisée Buy=Achat Sell=Vente -InvoiceValidateDateUsed=Date de validation utilisée +InvoiceDateUsed=Date de facture utilisée YourCompanyDoesNotUseVAT=Votre institution est configurée comme non assujettie à la TVA (Accueil - Configuration - Société/Institution), aussi il n'y a aucune option sur la gestion TVA à paramétrer. ##### Agenda #####= undefined AgendaSetup= Configuration du module actions et agenda