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/core/boxes/box_members.php b/htdocs/core/boxes/box_members.php
index 67e44abebbb..a37fdc15735 100755
--- a/htdocs/core/boxes/box_members.php
+++ b/htdocs/core/boxes/box_members.php
@@ -73,7 +73,8 @@ class box_members extends ModeleBoxes
if ($user->rights->societe->lire)
{
- $sql = "SELECT a.rowid, a.nom as lastname, a.prenom as firstname, a.datec, a.tms, a.statut as status, a.datefin as date_end_subscription,";
+ $sql = "SELECT a.rowid, a.nom as lastname, a.prenom as firstname, a.societe, a.fk_soc,";
+ $sql.= " a.datec, a.tms, a.statut as status, a.datefin as date_end_subscription,";
$sql.= " t.cotisation";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as t";
$sql.= " WHERE a.entity = ".$conf->entity;
@@ -97,6 +98,14 @@ class box_members extends ModeleBoxes
$memberstatic->lastname=$objp->lastname;
$memberstatic->firstname=$objp->firstname;
+ if (! empty($objp->fk_soc)) {
+ $memberstatic->socid = $objp->fk_soc;
+ $memberstatic->fetch_thirdparty();
+ $memberstatic->name=$memberstatic->thirdparty->name;
+ } else {
+ $memberstatic->name=$objp->company;
+ }
+
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg,
'url' => DOL_URL_ROOT."/adherents/fiche.php?rowid=".$objp->rowid);
diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php
index 87d6a91d92f..90a2b1b3698 100644
--- a/htdocs/core/lib/functions2.lib.php
+++ b/htdocs/core/lib/functions2.lib.php
@@ -531,6 +531,8 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
// For debugging
//include_once(DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php');
+ //$mask='{yyyy}-{0000}';
+ //$date=dol_mktime(12, 0, 0, 1, 1, 1900);
//$date=dol_stringtotime('20121001');
// Extract value for mask counter, mask raz and mask offset
diff --git a/test/phpunit/NumberingModulesTest.php b/test/phpunit/NumberingModulesTest.php
index 0d97a232c7e..9c5cdd576aa 100644
--- a/test/phpunit/NumberingModulesTest.php
+++ b/test/phpunit/NumberingModulesTest.php
@@ -129,7 +129,6 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
require_once dirname(__FILE__).'/../../htdocs/compta/facture/class/facture.class.php';
require_once dirname(__FILE__).'/../../htdocs/core/modules/facture/mod_facture_mercure.php';
-
// First we try with a simple mask, with no reset
// and we test counter is still increase second year.
$conf->global->FACTURE_MERCURE_MASK_CREDIT='{yyyy}-{0000}';
@@ -137,21 +136,21 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
$localobject=new Facture($this->savdb);
$localobject->initAsSpecimen();
- $localobject->date=dol_mktime(12, 0, 0, 1, 1, 1900); // we use year 1900 to be sure to not have existing invoice for this year
+ $localobject->date=dol_mktime(12, 0, 0, 1, 1, 1915); // we use year 1915 to be sure to not have existing invoice for this year
$numbering=new mod_facture_mercure();
$result=$numbering->getNextValue($mysoc, $localobject);
$result2=$localobject->create($user,1);
$result3=$localobject->validate($user, $result);
print __METHOD__." result=".$result."\n";
- $this->assertEquals('1900-0001', $result); // counter must start to 1
+ $this->assertEquals('1915-0001', $result); // counter must start to 1
$localobject=new Facture($this->savdb);
$localobject->initAsSpecimen();
- $localobject->date=dol_mktime(12, 0, 0, 1, 1, 1901); // we use following year for second invoice
+ $localobject->date=dol_mktime(12, 0, 0, 1, 1, 1916); // we use following year for second invoice
$numbering=new mod_facture_mercure();
$result=$numbering->getNextValue($mysoc, $localobject);
print __METHOD__." result=".$result."\n";
- $this->assertEquals('1901-0002', $result); // counter must not be reset
+ $this->assertEquals('1916-0002', $result); // counter must not be reset
// Now we try with a reset
$conf->global->FACTURE_MERCURE_MASK_CREDIT='{yyyy}-{0000@1}';