From baf6ccf654ea5c7252ec3e7a0b766ef47aec5ada Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Mar 2013 17:16:26 +0100 Subject: [PATCH] New: Can define of we want to use VAT or not for subscriptions (foundation module). New: Can define a default choice for choice "More action when recording a subscription" (foundation module). --- ChangeLog | 9 ++-- htdocs/adherents/admin/adherent.php | 59 +++++++++++++++++-------- htdocs/adherents/card_subscriptions.php | 12 +++-- htdocs/langs/en_US/members.lang | 3 ++ htdocs/langs/fr_FR/members.lang | 4 ++ 5 files changed, 62 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4d8a65800f8..55975d60898 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,10 +14,13 @@ For users: - New: Can expand/collapse menus, categories and users list. - New: extra parameters are supported into ODT templates. - New: total per vat rate are available as tags for ODT templates. -- New: Add more types for extra parameters (lists, phone, emails, checkbox, prices) +- New: Add more types for extra parameters (lists, phone, emails, checkbox, prices). - New: Some part of interface use more CSS3 (ie: agenda) -- New: [ task #707 ] Create option ProfIdx are mandatory to validate a invoice - +- New: [ task #707 ] Create option ProfIdx are mandatory to validate a invoice. +- New: Can define of we want to use VAT or not for subscriptions (foundation module). +- New: Can define a default choice for choice "More action when recording + a subscription" (foundation module). + For developers: - System of menu managers has been rewritten to reduce code to do same things. - An external module can force its theme. diff --git a/htdocs/adherents/admin/adherent.php b/htdocs/adherents/admin/adherent.php index ea481c64661..91bbbb33049 100644 --- a/htdocs/adherents/admin/adherent.php +++ b/htdocs/adherents/admin/adherent.php @@ -169,31 +169,54 @@ print $form->selectyesno('constvalue',(! empty($conf->global->ADHERENT_DEFAULT_S print ''; print ''; print "\n"; -print ''; +print ''; -// Insertion cotisations dans compte financier +// Insert subscription into bank account $var=!$var; print '
'; print ''; print ''; print ''; -print ''.$langs->trans("AddSubscriptionIntoAccount").''; -if (! empty($conf->banque->enabled)) -{ - print ''; - print $form->selectyesno('constvalue',$conf->global->ADHERENT_BANK_USE,1); - print ''; - print ''; - print ''; -} -else -{ - print ''; - print $langs->trans("WarningModuleNotActive",$langs->transnoentities("Module85Name")); - print ''; -} +print ''.$langs->trans("MoreActionsOnSubscription").''; +$arraychoices=array('0'=>$langs->trans("None")); +if (! empty($conf->banque->enabled)) $arraychoices['bankdirect']=$langs->trans("MoreActionBankDirect"); +if (! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled)) $arraychoices['invoiceonly']=$langs->trans("MoreActionInvoiceOnly"); +if (! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled)) $arraychoices['bankviainvoice']=$langs->trans("MoreActionBankViaInvoice"); +print ''; +print $form->selectarray('constvalue',$arraychoices,$conf->global->ADHERENT_BANK_USE,0); +print ''; +print ''; +print ''; print "\n"; -print '
'; +print ''; + +// Use vat for invoice creation +if ($conf->facture->enabled) +{ + $var=!$var; + print '
'; + print ''; + print ''; + print ''; + print ''.$langs->trans("VATToUseForSubscriptions").''; + if (! empty($conf->banque->enabled)) + { + print ''; + print $form->selectarray('constvalue', array('0'=>$langs->trans("NoVatOnSubscription"),'defaultforfoundationcountry'=>$langs->trans("Default")), (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS)?'0':$conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS), 0); + print ''; + print ''; + print ''; + } + else + { + print ''; + print $langs->trans("WarningModuleNotActive",$langs->transnoentities("Module85Name")); + print ''; + } + print "\n"; + print '
'; +} + print ''; print '
'; diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index 199e2025b47..6b989004b3c 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -362,7 +362,11 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ // Add line to draft invoice $idprodsubscription=0; - $vattouse=get_default_tva($mysoc, $customer, $idprodsubscription); + $vattouse=0; + if (isset($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) && $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS == 'defaultforfoundationcountry') + { + $vattouse=get_default_tva($mysoc, $mysoc, $idprodsubscription); + } //print xx".$vattouse." - ".$mysoc." - ".$customer;exit; $result=$invoice->addline($invoice->id,$label,0,1,$vattouse,0,0,$idprodsubscription,0,$datecotisation,$datesubend,0,0,'','TTC',$cotisation,1); if ($result <= 0) @@ -756,9 +760,9 @@ if ($rowid) } else { - if (! empty($conf->global->ADHERENT_BANK_USE) && ! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled) && $object->fk_soc) $bankviainvoice=1; - else if (! empty($conf->global->ADHERENT_BANK_USE) && ! empty($conf->banque->enabled)) $bankdirect=1; - else if (empty($conf->global->ADHERENT_BANK_USE) && ! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled) && $object->fk_soc) $invoiceonly=1; + if (! empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankviainvoice' && ! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled) && $object->fk_soc) $bankviainvoice=1; + else if (! empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankdirect' && ! empty($conf->banque->enabled)) $bankdirect=1; + else if (! empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'invoiceonly' && ! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled) && $object->fk_soc) $invoiceonly=1; } print "\n\n\n"; diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index 8956502c3a9..77657563851 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -157,6 +157,7 @@ NoThirdPartyAssociatedToMember=No third party associated to this member ThirdPartyDolibarr=Dolibarr third party MembersAndSubscriptions= Members and Suscriptions MoreActions=Complementary action on recording +MoreActionsOnSubscription=Complementary action, suggested by default when recording a subscription MoreActionBankDirect=Create a direct transaction record on account MoreActionBankViaInvoice=Create an invoice and payment on account MoreActionInvoiceOnly=Create an invoice with no payment @@ -199,3 +200,5 @@ DOLIBARRFOUNDATION_PAYMENT_FORM=To make your subscription payment using a bank t ByProperties=By characteristics MembersStatisticsByProperties=Members statistics by characteristics MembersByNature=Members by nature +VATToUseForSubscriptions=VAT rate to use for subscriptions +NoVatOnSubscription=No TVA for subscriptions diff --git a/htdocs/langs/fr_FR/members.lang b/htdocs/langs/fr_FR/members.lang index 2ccafef4cab..9a047a30ae6 100644 --- a/htdocs/langs/fr_FR/members.lang +++ b/htdocs/langs/fr_FR/members.lang @@ -162,6 +162,7 @@ NoThirdPartyAssociatedToMember=Pas de tiers associé à cet adhérent ThirdPartyDolibarr=Tiers Dolibarr MembersAndSubscriptions= Adhérents et Adhésions MoreActions=Action complémentaire à l'enregistrement +MoreActionsOnSubscription=Action complémentaire proposée par défaut à l'enregistrement de l'adhésion MoreActionBankDirect=Création transaction sur compte bancaire ou caisse directement MoreActionBankViaInvoice=Création facture avec paiement sur compte bancaire ou caisse MoreActionInvoiceOnly=Création facture sans paiement @@ -204,3 +205,6 @@ DOLIBARRFOUNDATION_PAYMENT_FORM=Pour réaliser le paiement de votre cotisation p ByProperties=Par caractéristiques MembersStatisticsByProperties=Statistiques des adhérents par caractéristiques MembersByNature=Adhérents par nature +VATToUseForSubscriptions=Taux de TVA pour les adhésions +NoVatOnSubscription=Pas de TVA sur les adhésions +