diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php
index 7593c814b31..11acc1914a1 100644
--- a/htdocs/adherents/index.php
+++ b/htdocs/adherents/index.php
@@ -203,7 +203,7 @@ $var=true;
*/
$max=5;
-$sql = "SELECT a.rowid, a.statut, a.nom as lastname, a.prenom as firstname,";
+$sql = "SELECT a.rowid, a.statut, a.nom as lastname, a.prenom as firstname, a.societe as company, a.fk_soc,";
$sql.= " a.tms as datem, datefin as date_end_subscription,";
$sql.= " ta.rowid as typeid, ta.libelle, ta.cotisation";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta";
@@ -232,11 +232,18 @@ if ($resql)
$staticmember->id=$obj->rowid;
$staticmember->lastname=$obj->lastname;
$staticmember->firstname=$obj->firstname;
+ if (! empty($obj->fk_soc)) {
+ $staticmember->socid = $obj->fk_soc;
+ $staticmember->fetch_thirdparty();
+ $staticmember->name=$staticmember->thirdparty->name;
+ } else {
+ $staticmember->name=$obj->company;
+ }
$staticmember->ref=$staticmember->getFullName($langs);
$statictype->id=$obj->typeid;
$statictype->libelle=$obj->libelle;
- print '
'.$staticmember->getNomUrl(1,24).' | ';
- print ''.$statictype->getNomUrl(1,16).' | ';
+ print ''.$staticmember->getNomUrl(1,32).' | ';
+ print ''.$statictype->getNomUrl(1,32).' | ';
print ''.dol_print_date($db->jdate($obj->datem),'dayhour').' | ';
print ''.$staticmember->LibStatut($obj->statut,($obj->cotisation=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).' | ';
print '';
@@ -256,7 +263,7 @@ else
*/
$max=5;
-$sql = "SELECT a.rowid, a.statut, a.nom as lastname, a.prenom as firstname,";
+$sql = "SELECT a.rowid, a.statut, a.nom as lastname, a.prenom as firstname, a.societe as company, a.fk_soc,";
$sql.= " datefin as date_end_subscription,";
$sql.= " c.rowid as cid, c.tms as datem, c.datec as datec, c.dateadh as date_start, c.datef as date_end, c.cotisation";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."cotisation as c";
@@ -287,9 +294,16 @@ if ($resql)
$staticmember->id=$obj->rowid;
$staticmember->lastname=$obj->lastname;
$staticmember->firstname=$obj->firstname;
+ if (! empty($obj->fk_soc)) {
+ $staticmember->socid = $obj->fk_soc;
+ $staticmember->fetch_thirdparty();
+ $staticmember->name=$staticmember->thirdparty->name;
+ } else {
+ $staticmember->name=$obj->company;
+ }
$staticmember->ref=$staticmember->getFullName($langs);
print ''.$subscriptionstatic->getNomUrl(1).' | ';
- print ''.$staticmember->getNomUrl(1,24,'subscription').' | ';
+ print ''.$staticmember->getNomUrl(1,32,'subscription').' | ';
print ''.get_date_range($db->jdate($obj->date_start),$db->jdate($obj->date_end)).' | ';
print ''.price($obj->cotisation).' | ';
//print ''.$staticmember->LibStatut($obj->statut,($obj->cotisation=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).' | ';
@@ -320,7 +334,7 @@ foreach ($AdherentType as $key => $adhtype)
{
$var=!$var;
print "";
- print '| '.img_object($langs->trans("ShowType"),"group").' '.$adhtype->getNomUrl(0,dol_size(16)).' | ';
+ print ''.$adhtype->getNomUrl(1, dol_size(32)).' | ';
print ''.(isset($MemberToValidate[$key]) && $MemberToValidate[$key] > 0?$MemberToValidate[$key]:'').' '.$staticmember->LibStatut(-1,$adhtype->cotisation,0,3).' | ';
print ''.(isset($MembersValidated[$key]) && ($MembersValidated[$key]-$MemberUpToDate[$key] > 0) ? $MembersValidated[$key]-$MemberUpToDate[$key]:'').' '.$staticmember->LibStatut(1,$adhtype->cotisation,0,3).' | ';
print ''.(isset($MemberUpToDate[$key]) && $MemberUpToDate[$key] > 0 ? $MemberUpToDate[$key]:'').' '.$staticmember->LibStatut(1,$adhtype->cotisation,$now,3).' | ';
diff --git a/htdocs/adherents/liste.php b/htdocs/adherents/liste.php
index ca87562153a..4752a36a65a 100644
--- a/htdocs/adherents/liste.php
+++ b/htdocs/adherents/liste.php
@@ -84,7 +84,7 @@ llxHeader('',$langs->trans("Member"),'EN:Module_Foundations|FR:Module_Adhé
$now=dol_now();
-$sql = "SELECT d.rowid, d.login, d.nom as lastname, d.prenom as firstname, d.societe, ";
+$sql = "SELECT d.rowid, d.login, d.nom as lastname, d.prenom as firstname, d.societe as company, d.fk_soc,";
$sql.= " d.datefin,";
$sql.= " d.email, d.fk_adherent_type as type_id, d.morphy, d.statut,";
$sql.= " t.libelle as type, t.cotisation";
@@ -238,7 +238,7 @@ if ($resql)
print '';
$listetype=$membertypestatic->liste_array();
- print $form->selectarray("type", $listetype, $type, 1, 0, 0, '', 0, 12);
+ print $form->selectarray("type", $listetype, $type, 1, 0, 0, '', 0, 32);
print ' | ';
print ' | ';
@@ -268,6 +268,14 @@ if ($resql)
$memberstatic->lastname=$objp->lastname;
$memberstatic->firstname=$objp->firstname;
+ if (! empty($objp->fk_soc)) {
+ $memberstatic->socid = $objp->fk_soc;
+ $memberstatic->fetch_thirdparty();
+ $companyname=$memberstatic->thirdparty->name;
+ } else {
+ $companyname=$objp->company;
+ }
+
$var=!$var;
print "
";
@@ -277,14 +285,11 @@ if ($resql)
print "\n";
// Lastname
- if ($objp->societe != '')
- {
- print "| rowid\">".dol_trunc($memberstatic->getFullName($langs))." / ".dol_trunc($objp->societe,12)." | \n";
- }
- else
- {
- print "rowid\">".dol_trunc($memberstatic->getFullName($langs))." | \n";
- }
+ print "rowid\">";
+ print ((! empty($objp->lastname) || ! empty($objp->firstname)) ? dol_trunc($memberstatic->getFullName($langs)) : '');
+ print (((! empty($objp->lastname) || ! empty($objp->firstname)) && ! empty($companyname)) ? ' / ' : '');
+ print (! empty($companyname) ? dol_trunc($companyname, 32) : '');
+ print " | \n";
// Login
print "".$objp->login." | \n";
@@ -293,7 +298,7 @@ if ($resql)
$membertypestatic->id=$objp->type_id;
$membertypestatic->libelle=$objp->type;
print '';
- print $membertypestatic->getNomUrl(1,12);
+ print $membertypestatic->getNomUrl(1,32);
print ' | ';
// Moral/Physique
diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index 56c1434feac..5dcc2332015 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -8,6 +8,7 @@
* Copyright (C) 2011 Remy Younes
* Copyright (C) 2012 Marcos García
* Copyright (C) 2012 Christophe Battarel
+ * Copyright (C) 2011-2012 Alexandre Spangaro
*
* 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
@@ -136,7 +137,7 @@ $tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.t
$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_iso as code, label as libelle, unicode, active FROM ".MAIN_DB_PREFIX."c_currencies";
-$tabsql[10]= "SELECT t.rowid, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, p.libelle as pays, p.code as pays_code, t.fk_pays as pays_id, t.recuperableonly, t.note, t.active, t.accountancy_code FROM ".MAIN_DB_PREFIX."c_tva as t, llx_c_pays as p WHERE t.fk_pays=p.rowid";
+$tabsql[10]= "SELECT t.rowid, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, p.libelle as pays, p.code as pays_code, t.fk_pays as pays_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, llx_c_pays as p WHERE t.fk_pays=p.rowid";
$tabsql[11]= "SELECT t.rowid as rowid, element, source, code, libelle, active FROM ".MAIN_DB_PREFIX."c_type_contact AS t";
$tabsql[12]= "SELECT c.rowid as rowid, code, sortorder, c.libelle, c.libelle_facture, nbjour, fdm, decalage, active FROM ".MAIN_DB_PREFIX.'c_payment_term AS c';
$tabsql[13]= "SELECT id as rowid, code, c.libelle, type, active FROM ".MAIN_DB_PREFIX."c_paiement AS c";
@@ -188,7 +189,7 @@ $tabfield[6] = "code,libelle,type,position";
$tabfield[7] = "code,libelle,pays_id,pays,deductible";
$tabfield[8] = "code,libelle";
$tabfield[9] = "code,libelle,unicode";
-$tabfield[10]= "pays_id,pays,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code,note";
+$tabfield[10]= "pays_id,pays,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note";
$tabfield[11]= "element,source,code,libelle";
$tabfield[12]= "code,libelle,libelle_facture,nbjour,fdm,decalage";
$tabfield[13]= "code,libelle,type";
@@ -214,7 +215,7 @@ $tabfieldvalue[6] = "code,libelle,type,position";
$tabfieldvalue[7] = "code,libelle,pays,deductible";
$tabfieldvalue[8] = "code,libelle";
$tabfieldvalue[9] = "code,libelle,unicode";
-$tabfieldvalue[10]= "pays,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code,note";
+$tabfieldvalue[10]= "pays,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note";
$tabfieldvalue[11]= "element,source,code,libelle";
$tabfieldvalue[12]= "code,libelle,libelle_facture,nbjour,fdm,decalage";
$tabfieldvalue[13]= "code,libelle,type";
@@ -240,7 +241,7 @@ $tabfieldinsert[6] = "code,libelle,type,position";
$tabfieldinsert[7] = "code,libelle,fk_pays,deductible";
$tabfieldinsert[8] = "code,libelle";
$tabfieldinsert[9] = "code_iso,label,unicode";
-$tabfieldinsert[10]= "fk_pays,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code,note";
+$tabfieldinsert[10]= "fk_pays,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note";
$tabfieldinsert[11]= "element,source,code,libelle";
$tabfieldinsert[12]= "code,libelle,libelle_facture,nbjour,fdm,decalage";
$tabfieldinsert[13]= "code,libelle,type";
@@ -344,45 +345,45 @@ $elementList = array();
$sourceList=array();
if ($id == 11)
{
- $langs->load("orders");
- $langs->load("contracts");
- $langs->load("projects");
- $langs->load("propal");
- $langs->load("bills");
- $langs->load("interventions");
- $elementList = array(
- 'commande' => $langs->trans('Order'),
- 'invoice_supplier' => $langs->trans('SupplierBill'),
- 'order_supplier' => $langs->trans('SupplierOrder'),
- 'contrat' => $langs->trans('Contract'),
- 'project' => $langs->trans('Project'),
- 'project_task' => $langs->trans('Task'),
- 'propal' => $langs->trans('Proposal'),
- 'facture' => $langs->trans('Bill'),
- 'facture_fourn' => $langs->trans('SupplierBill'),
- 'fichinter' => $langs->trans('InterventionCard')
- );
- if (! empty($conf->global->MAIN_SUPPORT_CONTACT_TYPE_FOR_THIRDPARTIES)) $elementList["societe"] = $langs->trans('ThirdParty');
- $sourceList = array(
- 'internal' => $langs->trans('Internal'),
- 'external' => $langs->trans('External')
- );
+ $langs->load("orders");
+ $langs->load("contracts");
+ $langs->load("projects");
+ $langs->load("propal");
+ $langs->load("bills");
+ $langs->load("interventions");
+ $elementList = array(
+ 'commande' => $langs->trans('Order'),
+ 'invoice_supplier' => $langs->trans('SupplierBill'),
+ 'order_supplier' => $langs->trans('SupplierOrder'),
+ 'contrat' => $langs->trans('Contract'),
+ 'project' => $langs->trans('Project'),
+ 'project_task' => $langs->trans('Task'),
+ 'propal' => $langs->trans('Proposal'),
+ 'facture' => $langs->trans('Bill'),
+ 'facture_fourn' => $langs->trans('SupplierBill'),
+ 'fichinter' => $langs->trans('InterventionCard')
+ );
+ if (! empty($conf->global->MAIN_SUPPORT_CONTACT_TYPE_FOR_THIRDPARTIES)) $elementList["societe"] = $langs->trans('ThirdParty');
+ $sourceList = array(
+ 'internal' => $langs->trans('Internal'),
+ 'external' => $langs->trans('External')
+ );
}
// Define localtax_typeList (used for dictionnary "c_tva")
$localtax_typeList = array();
if (GETPOST("id") == 10)
{
- $localtax_typeList = array(
- "0" => $langs->trans("No"),
- "1" => $langs->trans("Yes").' ('.$langs->trans("Type")." 1)", //$langs->trans("%ageOnAllWithoutVAT"),
- "2" => $langs->trans("Yes").' ('.$langs->trans("Type")." 2)", //$langs->trans("%ageOnAllBeforeVAT"),
- "3" => $langs->trans("Yes").' ('.$langs->trans("Type")." 3)", //$langs->trans("%ageOnProductsWithoutVAT"),
- "4" => $langs->trans("Yes").' ('.$langs->trans("Type")." 4)", //$langs->trans("%ageOnProductsBeforeVAT"),
- "5" => $langs->trans("Yes").' ('.$langs->trans("Type")." 5)", //$langs->trans("%ageOnServiceWithoutVAT"),
- "6" => $langs->trans("Yes").' ('.$langs->trans("Type")." 6)", //$langs->trans("%ageOnServiceBeforeVAT"),
- "7" => $langs->trans("Yes").' ('.$langs->trans("Type")." 7)" //$langs->trans("AmountOnOrder") // We will enable this later. For the moment, work only of invoice localtype
- );
+ $localtax_typeList = array(
+ "0" => $langs->trans("No"),
+ "1" => $langs->trans("Yes").' ('.$langs->trans("Type")." 1)", //$langs->trans("%ageOnAllWithoutVAT"),
+ "2" => $langs->trans("Yes").' ('.$langs->trans("Type")." 2)", //$langs->trans("%ageOnAllBeforeVAT"),
+ "3" => $langs->trans("Yes").' ('.$langs->trans("Type")." 3)", //$langs->trans("%ageOnProductsWithoutVAT"),
+ "4" => $langs->trans("Yes").' ('.$langs->trans("Type")." 4)", //$langs->trans("%ageOnProductsBeforeVAT"),
+ "5" => $langs->trans("Yes").' ('.$langs->trans("Type")." 5)", //$langs->trans("%ageOnServiceWithoutVAT"),
+ "6" => $langs->trans("Yes").' ('.$langs->trans("Type")." 6)", //$langs->trans("%ageOnServiceBeforeVAT"),
+ "7" => $langs->trans("Yes").' ('.$langs->trans("Type")." 7)" //$langs->trans("AmountOnOrder") // We will enable this later. For the moment, work only of invoice localtype
+ );
}
$msg='';
@@ -404,7 +405,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue;
if ((! isset($_POST[$value]) || $_POST[$value]=='')
// && (! in_array($listfield[$f], array('decalage','module','accountancy_code','localtax1','localtax2'))) // Fields that are not mandatory
- && (! in_array($listfield[$f], array('decalage','module','accountancy_code'))) // Fields that are not mandatory
+ && (! in_array($listfield[$f], array('decalage','module','accountancy_code_sell','accountancy_code_buy'))) // Fields that are not mandatory
)
{
$ok=0;
@@ -464,14 +465,14 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
// Add new entry
$sql = "INSERT INTO ".$tabname[$id]." (";
// List of fields
- if ($tabrowid[$id] &&
- ! in_array($tabrowid[$id],$listfieldinsert)) $sql.= $tabrowid[$id].",";
+ if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
+ $sql.= $tabrowid[$id].",";
$sql.= $tabfieldinsert[$id];
$sql.=",active)";
$sql.= " VALUES(";
// List of values
- if ($tabrowid[$id] &&
- ! in_array($tabrowid[$id],$listfieldinsert)) $sql.= $newid.",";
+ if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
+ $sql.= $newid.",";
$i=0;
foreach ($listfieldinsert as $f => $value)
{
@@ -516,7 +517,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
// Modify entry
$sql = "UPDATE ".$tabname[$id]." SET ";
// Modifie valeur des champs
- if ($tabrowid[$id] && !in_array($tabrowid[$id],$listfieldmodify))
+ if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldmodify))
{
$sql.= $tabrowid[$id]."=";
$sql.= "'".$db->escape($rowid)."', ";
@@ -633,7 +634,7 @@ $linkback='';
if ($id)
{
$titre.=' - '.$langs->trans($tablib[$id]);
- $linkback=''.$langs->trans("BackToDictionnaryList").'';
+ $linkback=''.$langs->trans("BackToDictionnaryList").'';
}
print_fiche_titre($titre,$linkback,'setup');
@@ -685,7 +686,7 @@ if ($id)
$fieldlist=explode(',',$tabfield[$id]);
- print '