2
0
forked from Wavyzz/dolibarr

Qual: Uniformize code.

Fix: Social contributions was french for all countries.
This commit is contained in:
Laurent Destailleur
2009-10-25 20:48:44 +00:00
parent 2c3a33c8eb
commit 0e113ea493
9 changed files with 67 additions and 48 deletions

View File

@@ -97,7 +97,7 @@ $tabsql[3] = "SELECT r.rowid as rowid, code_region as code, nom as libelle, r.fk
$tabsql[4] = "SELECT rowid as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_pays";
$tabsql[5] = "SELECT c.rowid as rowid, c.code as code, c.civilite AS libelle, c.active FROM ".MAIN_DB_PREFIX."c_civilite AS c";
$tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.type, a.active FROM ".MAIN_DB_PREFIX."c_actioncomm AS a";
$tabsql[7] = "SELECT a.id as rowid, a.id as code, a.libelle AS libelle, a.deductible, a.actioncompta, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a";
$tabsql[7] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.deductible, p.code as pays_code, p.libelle as pays, a.fk_pays as pays_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_pays as p WHERE a.fk_pays=p.rowid and p.active=1";
$tabsql[8] = "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_typent";
$tabsql[9] = "SELECT code, code_iso, label as libelle, active FROM ".MAIN_DB_PREFIX."c_currencies";
$tabsql[10]= "SELECT t.rowid, t.taux, p.libelle as pays, p.code as pays_code, t.fk_pays as pays_id, t.recuperableonly, t.note, t.active FROM ".MAIN_DB_PREFIX."c_tva as t, llx_c_pays as p WHERE t.fk_pays=p.rowid";
@@ -111,20 +111,20 @@ $tabsql[17]= "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREF
$tabsql[18]= "SELECT rowid as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."expedition_methode";
// Critere de tri du dictionnaire
$tabsqlsort[1] ="pays, code ASC";
$tabsqlsort[2] ="pays, code ASC";
$tabsqlsort[3] ="pays, code ASC";
$tabsqlsort[1] ="pays ASC, code ASC";
$tabsqlsort[2] ="pays ASC, code ASC";
$tabsqlsort[3] ="pays ASC, code ASC";
$tabsqlsort[4] ="code ASC";
$tabsqlsort[5] ="libelle ASC";
$tabsqlsort[6] ="a.type ASC, a.code ASC";
$tabsqlsort[7] ="a.libelle ASC";
$tabsqlsort[7] ="pays ASC, code ASC, a.libelle ASC";
$tabsqlsort[8] ="libelle ASC";
$tabsqlsort[9] ="code ASC";
$tabsqlsort[10]="pays ASC, taux ASC, recuperableonly ASC";
$tabsqlsort[11]="element ASC, source ASC, code ASC";
$tabsqlsort[12]="sortorder ASC, code ASC";
$tabsqlsort[13]="code ASC";
$tabsqlsort[14]="pays, e.organization ASC, code ASC";
$tabsqlsort[14]="pays ASC, e.organization ASC, code ASC";
$tabsqlsort[15]="rowid ASC";
$tabsqlsort[16]="sortorder ASC";
$tabsqlsort[17]="code ASC";
@@ -137,7 +137,7 @@ $tabfield[3] = "code,libelle,pays_id,pays";
$tabfield[4] = "code,libelle";
$tabfield[5] = "code,libelle";
$tabfield[6] = "code,libelle,type";
$tabfield[7] = "libelle,deductible,actioncompta";
$tabfield[7] = "code,libelle,pays_id,pays,deductible";
$tabfield[8] = "code,libelle";
$tabfield[9] = "code,code_iso,libelle";
$tabfield[10]= "pays_id,pays,taux,recuperableonly,note";
@@ -157,7 +157,7 @@ $tabfieldvalue[3] = "code,libelle,pays";
$tabfieldvalue[4] = "code,libelle";
$tabfieldvalue[5] = "code,libelle";
$tabfieldvalue[6] = "code,libelle,type";
$tabfieldvalue[7] = "libelle,deductible,actioncompta";
$tabfieldvalue[7] = "code,libelle,pays,deductible";
$tabfieldvalue[8] = "code,libelle";
$tabfieldvalue[9] = "code,code_iso,libelle";
$tabfieldvalue[10]= "pays,taux,recuperableonly,note";
@@ -177,7 +177,7 @@ $tabfieldinsert[3] = "code_region,nom,fk_pays";
$tabfieldinsert[4] = "code,libelle";
$tabfieldinsert[5] = "code,civilite";
$tabfieldinsert[6] = "code,libelle,type";
$tabfieldinsert[7] = "libelle,deductible,actioncompta";
$tabfieldinsert[7] = "code,libelle,fk_pays,deductible";
$tabfieldinsert[8] = "code,libelle";
$tabfieldinsert[9] = "code,code_iso,label";
$tabfieldinsert[10]= "fk_pays,taux,recuperableonly,note";

View File

@@ -18,10 +18,10 @@
*/
/**
\file htdocs/compta/sociales/charges.php
\ingroup tax
\brief Fiche d'une charge sociale
\version $Id$
* \file htdocs/compta/sociales/charges.php
* \ingroup tax
* \brief Social contribution car page
* \version $Id$
*/
require("./pre.inc.php");
@@ -94,6 +94,11 @@ if ($_POST["action"] == 'add' && $user->rights->tax->charges->creer)
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Period")).'</div>';
$_GET["action"] = 'create';
}
elseif (! $_POST["actioncode"] > 0)
{
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Type")).'</div>';
$_GET["action"] = 'create';
}
elseif (! $_POST["amount"])
{
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount")).'</div>';
@@ -302,7 +307,7 @@ if ($chid > 0)
}
// Type
print "<tr><td>".$langs->trans("Type")."</td><td>$cha->type_libelle</td><td>".$langs->trans("Payments")."</td></tr>";
print "<tr><td>".$langs->trans("Type")."</td><td>".$cha->type_libelle."</td><td>".$langs->trans("Payments")."</td></tr>";
// Period en date
print "<tr><td>".$langs->trans("PeriodEndDate")."</td>";
@@ -338,7 +343,7 @@ if ($chid > 0)
{
$num = $db->num_rows($resql);
$i = 0; $total = 0;
echo '<table class="noborder" width="100%">';
echo '<table class="nobordernopadding" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Date").'</td><td>'.$langs->trans("Type").'</td>';
print '<td align="right">'.$langs->trans("Amount").'</td><td>&nbsp;</td></tr>';

View File

@@ -350,23 +350,25 @@ class Form
*/
function select_type_socialcontrib($selected='',$htmlname='actioncode', $useempty=0, $maxlen=40, $help=1)
{
global $db,$langs,$user;
global $db,$langs,$user,$mysoc;
$sql = "SELECT c.id, c.libelle as type";
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
$sql.= " WHERE active = 1";
$sql.= " AND fk_pays = ".$mysoc->pays_id;
$sql.= " ORDER BY c.libelle ASC";
dol_syslog("Form::select_type_socialcontrib sql=".$sql, LOG_DEBUG);
$resql=$db->query($sql);
if ($resql)
{
print '<select class="flat" name="'.$htmlname.'">';
$num = $db->num_rows($resql);
if ($num)
{
print '<select class="flat" name="'.$htmlname.'">';
$i = 0;
if ($useempty) print '<option value="0">&nbsp;</option>';
while ($i < $num)
{
$obj = $db->fetch_object($resql);
@@ -379,6 +381,11 @@ class Form
if ($user->admin && $help) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
}
else
{
print $langs->trans("ErrorNoSocialContributionForSellerCountry",$mysoc->pays_code);
}
}
else
{
dol_print_error($db,$db->lasterror());
}

View File

@@ -32,14 +32,14 @@
-- Types de charges
--
insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values ( 1, 'Allocations familiales', 1,1,'TAXFAM');
insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values ( 2, 'GSG Deductible', 1,1,'TAXCSGD');
insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values ( 3, 'GSG/CRDS NON Deductible',0,1,'TAXCSGND');
insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values (10, 'Taxe apprenttissage', 0,1,'TAXAPP');
insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values (11, 'Taxe professionnelle', 0,1,'TAXPRO');
insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values (20, 'Impots locaux/fonciers', 0,1,'TAXFON');
insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values (25, 'Impots revenus', 0,1,'TAXREV');
insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values (30, 'Assurance Sante', 0,1,'TAXSECU');
insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values (40, 'Mutuelle', 0,1,'TAXMUT');
insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values (50, 'Assurance vieillesse', 0,1,'TAXRET');
insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta) values (60, 'Assurance Chomage', 0,1,'TAXCHOM');
insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta, fk_pays) values ( 1, 'Allocations familiales', 1,1,'TAXFAM' ,'1');
insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta, fk_pays) values ( 2, 'GSG Deductible', 1,1,'TAXCSGD' ,'1');
insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta, fk_pays) values ( 3, 'GSG/CRDS NON Deductible',0,1,'TAXCSGND' ,'1');
insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta, fk_pays) values (10, 'Taxe apprenttissage', 0,1,'TAXAPP' ,'1');
insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta, fk_pays) values (11, 'Taxe professionnelle', 0,1,'TAXPRO' ,'1');
insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta, fk_pays) values (20, 'Impots locaux/fonciers', 0,1,'TAXFON' ,'1');
insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta, fk_pays) values (25, 'Impots revenus', 0,1,'TAXREV' ,'1');
insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta, fk_pays) values (30, 'Assurance Sante', 0,1,'TAXSECU' ,'1');
insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta, fk_pays) values (40, 'Mutuelle', 0,1,'TAXMUT' ,'1');
insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta, fk_pays) values (50, 'Assurance vieillesse', 0,1,'TAXRET' ,'1');
insert into llx_c_chargesociales (id, libelle, deductible, active, actioncompta, fk_pays) values (60, 'Assurance Chomage', 0,1,'TAXCHOM' ,'1');

View File

@@ -65,6 +65,9 @@ delete from llx_const where name = 'FACTURE_ENABLE_RECUR';
alter table llx_facturedet_rec add column product_type integer DEFAULT 0 after fk_product;
alter table llx_c_chargesociales change actioncompta code varchar(12) NOT NULL;
alter table llx_c_chargesociales add column fk_pays integer DEFAULT 1 NOT NULL;
-- Usage of llx_menu_const and llx_menu_constraint is too complicated
-- so we made first change to remove it
alter table llx_menu_const drop foreign key fk_menu_const_fk_menu;

View File

@@ -1,6 +1,6 @@
-- ========================================================================
-- Copyright (C) 2001-2002,2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
@@ -25,7 +25,8 @@ create table llx_c_chargesociales
libelle varchar(80),
deductible smallint DEFAULT 0 NOT NULL,
active tinyint DEFAULT 1 NOT NULL,
actioncompta varchar(12) NOT NULL
code varchar(12) NOT NULL,
fk_pays integer DEFAULT 1 NOT NULL
)type=innodb;

View File

@@ -42,6 +42,7 @@ ErrorSomeErrorWereFoundRollbackIsDone=Some errors were found. We rollback change
ErrorConfigParameterNotDefined=Parameter <b>%s</b> is not defined inside Dolibarr config file <b>conf.php</b>.
ErrorCantLoadUserFromDolibarrDatabase=Failed to find user <b>%s</b> in Dolibarr database.
ErrorNoVATRateDefinedForSellerCountry=Error, no vat rates defined for country '%s'.
ErrorNoSocialContributionForSellerCountry=Error, no social contribution type defined for country '%s'.
ErrorFailedToSaveFile=Error, failed to save file.
ErrorOnlyPngJpgSupported=Error, only .png and .jpg image format file are supported.
ErrorImageFormatNotSupported=Your PHP does not support functions to convert images of this format.

View File

@@ -42,6 +42,7 @@ ErrorSomeErrorWereFoundRollbackIsDone=Des erreurs ont été trouvés. On rollbac
ErrorConfigParameterNotDefined=Le parametre <b>%s</b> n'est pas défini dans le fichier de configuration Dolibarr <b>conf.php</b>.
ErrorCantLoadUserFromDolibarrDatabase=Impossible de trouver l'utilisateur <b>%s</b> dans la base Dolibarr.
ErrorNoVATRateDefinedForSellerCountry=Erreur, aucun taux tva défini pour le pays '%s'.
ErrorNoSocialContributionForSellerCountry=Erreur, aucun type de charges défini pour le pays '%s'.
ErrorFailedToSaveFile=Erreur, l'enregistrement du fichier a échoué.
ErrorOnlyPngJpgSupported=Erreur, seuls les formats images .jpg et .png sont supportés.
ErrorImageFormatNotSupported=Votre PHP ne supporte pas les fonctions de conversion de ce format d'image.

View File

@@ -2033,13 +2033,14 @@ function print_titre($titre)
}
/**
* \brief Affichage d'un titre d'une fiche, aligne a gauche
* \param titre Le titre a afficher
* \param mesg Message suplementaire a afficher a droite
* \brief Show a title with picto
* \param titre Title to show
* \param mesg Added message to show on right
* \param picto Icon to use before title (should be a 32x32 transparent png file)
* \param pictoisfullpath 1=Icon name is a full absolute url of image
* \param id To force an id on html objects
*/
function print_fiche_titre($titre, $mesg='', $picto='title.png', $pictoisfullpath=0)
function print_fiche_titre($titre, $mesg='', $picto='title.png', $pictoisfullpath=0, $id='')
{
global $conf;
@@ -2047,7 +2048,7 @@ function print_fiche_titre($titre, $mesg='', $picto='title.png', $pictoisfullpat
if (empty($conf->browser->firefox) && $picto=='title.png') $picto='title.gif';
print "\n";
print '<table summary="" width="100%" border="0" class="notopnoleftnoright" style="margin-bottom: 2px;"><tr>';
print '<table '.($id?'id="'.$id.'" ':'').'summary="" width="100%" border="0" class="notopnoleftnoright" style="margin-bottom: 2px;"><tr>';
if (empty($conf->browser->phone) && $picto && $titre) print '<td class="nobordernopadding" width="40" align="left" valign="middle">'.img_picto('',$picto, 'id="pictotitle"', $pictoisfullpath).'</td>';
print '<td class="nobordernopadding" valign="middle">';
print '<div class="titre">'.$titre.'</div>';