From e1baf806b9f46ea3de6e2d3cdbb935452a75a8ce Mon Sep 17 00:00:00 2001 From: Grand Philippe <contact@atoo-net.com> Date: Wed, 13 Mar 2013 22:17:03 +0100 Subject: [PATCH] change birth instead of naiss --- htdocs/adherents/admin/adherent.php | 6 ++-- htdocs/adherents/cartes/carte.php | 4 +-- htdocs/adherents/class/adherent.class.php | 16 +++++----- htdocs/adherents/fiche.php | 32 +++++++++---------- htdocs/admin/ldap_members.php | 2 +- htdocs/core/modules/modAdherent.class.php | 10 +++--- .../install/mysql/migration/3.3.0-3.4.0.sql | 1 + htdocs/install/mysql/tables/llx_adherent.sql | 2 +- htdocs/public/members/new.php | 2 +- htdocs/public/members/public_card.php | 2 +- htdocs/public/members/public_list.php | 6 ++-- .../members/sync_members_ldap2dolibarr.php | 2 +- test/phpunit/AdherentTest.php | 8 ++--- 13 files changed, 47 insertions(+), 46 deletions(-) diff --git a/htdocs/adherents/admin/adherent.php b/htdocs/adherents/admin/adherent.php index 91bbbb33049..62f89f992dd 100644 --- a/htdocs/adherents/admin/adherent.php +++ b/htdocs/adherents/admin/adherent.php @@ -239,7 +239,7 @@ form_constantes($constantes); print '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>'; print '%DOL_MAIN_URL_ROOT%, %ID%, %FIRSTNAME%, %LASTNAME%, %FULLNAME%, %LOGIN%, %PASSWORD%, '; -print '%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %NAISS%, %PHOTO%, %TYPE%, '; +print '%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %BIRTH%, %PHOTO%, %TYPE%, '; print '%YEAR%, %MONTH%, %DAY%'; print '<br>'; @@ -257,7 +257,7 @@ form_constantes($constantes); print '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>'; print '%DOL_MAIN_URL_ROOT%, %ID%, %FIRSTNAME%, %LASTNAME%, %FULLNAME%, %LOGIN%, %PASSWORD%, '; -print '%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %NAISS%, %PHOTO%, %TYPE%, '; +print '%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %BIRTH%, %PHOTO%, %TYPE%, '; print '%YEAR%, %MONTH%, %DAY%'; print '<br>'; @@ -287,7 +287,7 @@ form_constantes($constantes); print '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>'; print '%DOL_MAIN_URL_ROOT%, %ID%, %FIRSTNAME%, %LASTNAME%, %FULLNAME%, %LOGIN%, %PASSWORD%, '; -print '%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %NAISS%, %PHOTO%, %TYPE%, '; +print '%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %BIRTH%, %PHOTO%, %TYPE%, '; //print '%YEAR%, %MONTH%, %DAY%'; // Not supported print '<br>'; diff --git a/htdocs/adherents/cartes/carte.php b/htdocs/adherents/cartes/carte.php index 7c1d95502ca..e60a76bd936 100755 --- a/htdocs/adherents/cartes/carte.php +++ b/htdocs/adherents/cartes/carte.php @@ -62,7 +62,7 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg // requete en prenant que les adherents a jour de cotisation $sql = "SELECT d.rowid, d.firstname, d.lastname, d.login, d.societe as company, d.datefin,"; - $sql.= " d.address, d.zip, d.town, d.country, d.naiss, d.email, d.photo,"; + $sql.= " d.address, d.zip, d.town, d.country, d.birth, d.email, d.photo,"; $sql.= " t.libelle as type,"; $sql.= " p.code as country_code, p.libelle as country"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d"; @@ -101,7 +101,7 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg '%COUNTRY%'=>$objp->country, '%COUNTRY_CODE%'=>$objp->country_code, '%EMAIL%'=>$objp->email, - '%NAISS%'=>dol_print_date($objp->naiss,'day'), + '%BIRTH%'=>dol_print_date($objp->birth,'day'), '%TYPE%'=>$objp->type, '%YEAR%'=>$year, '%MONTH%'=>$month, diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 7dd0f5fbbd1..3527535809b 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -77,7 +77,7 @@ class Adherent extends CommonObject var $datem; var $datefin; var $datevalid; - var $naiss; + var $birth; var $typeid; // Id type adherent var $type; // Libelle type adherent @@ -175,7 +175,7 @@ class Adherent extends CommonObject { global $conf,$langs; - $birthday = dol_print_date($this->naiss,'day'); + $birthday = dol_print_date($this->birth,'day'); $msgishtml = 0; if (dol_textishtml($text,1)) $msgishtml = 1; @@ -214,7 +214,7 @@ class Adherent extends CommonObject '%TOWN%'=>$msgishtml?dol_htmlentitiesbr($this->town):$this->town, '%COUNTRY%'=>$msgishtml?dol_htmlentitiesbr($this->country):$this->country, '%EMAIL%'=>$msgishtml?dol_htmlentitiesbr($this->email):$this->email, - '%NAISS%'=>$msgishtml?dol_htmlentitiesbr($birthday):$birthday, + '%BIRTH%'=>$msgishtml?dol_htmlentitiesbr($birthday):$birthday, '%PHOTO%'=>$msgishtml?dol_htmlentitiesbr($this->photo):$this->photo, '%LOGIN%'=>$msgishtml?dol_htmlentitiesbr($this->login):$this->login, '%PASSWORD%'=>$msgishtml?dol_htmlentitiesbr($this->pass):$this->pass, @@ -433,7 +433,7 @@ class Adherent extends CommonObject $sql.= ", statut=" .$this->statut; $sql.= ", fk_adherent_type=".$this->typeid; $sql.= ", morphy='".$this->morphy."'"; - $sql.= ", naiss=" .($this->naiss?"'".$this->db->idate($this->naiss)."'":"null"); + $sql.= ", birth=" .($this->birth?"'".$this->db->idate($this->birth)."'":"null"); if ($this->datefin) $sql.= ", datefin='".$this->db->idate($this->datefin)."'"; // Ne doit etre modifie que par effacement cotisation if ($this->datevalid) $sql.= ", datevalid='".$this->db->idate($this->datevalid)."'"; // Ne doit etre modifie que par validation adherent $sql.= ", fk_user_mod=".($user->id>0?$user->id:'null'); // Can be null because member can be create by a guest @@ -1012,7 +1012,7 @@ class Adherent extends CommonObject $sql.= " d.datec as datec,"; $sql.= " d.tms as datem,"; $sql.= " d.datefin as datefin,"; - $sql.= " d.naiss as datenaiss,"; + $sql.= " d.birth as birthday,"; $sql.= " d.datevalid as datev,"; $sql.= " d.country,"; $sql.= " d.state_id,"; @@ -1079,7 +1079,7 @@ class Adherent extends CommonObject $this->datem = $this->db->jdate($obj->datem); $this->datefin = $this->db->jdate($obj->datefin); $this->datevalid = $this->db->jdate($obj->datev); - $this->naiss = $this->db->jdate($obj->datenaiss); + $this->birth = $this->db->jdate($obj->birthday); $this->note = $obj->note; $this->morphy = $obj->morphy; @@ -1739,7 +1739,7 @@ class Adherent extends CommonObject $this->phone_perso = '0999999998'; $this->phone_mobile = '0999999997'; $this->note='No comment'; - $this->naiss=time(); + $this->birth=time(); $this->photo=''; $this->public=1; $this->statut=0; @@ -1811,7 +1811,7 @@ class Adherent extends CommonObject if ($this->phone_mobile && ! empty($conf->global->LDAP_MEMBER_FIELD_MOBILE)) $info[$conf->global->LDAP_MEMBER_FIELD_MOBILE] = $this->phone_mobile; if ($this->fax && ! empty($conf->global->LDAP_MEMBER_FIELD_FAX)) $info[$conf->global->LDAP_MEMBER_FIELD_FAX] = $this->fax; if ($this->note && ! empty($conf->global->LDAP_MEMBER_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_FIELD_DESCRIPTION] = $this->note; - if ($this->naiss && ! empty($conf->global->LDAP_MEMBER_FIELD_BIRTHDATE)) $info[$conf->global->LDAP_MEMBER_FIELD_BIRTHDATE] = dol_print_date($this->naiss,'dayhourldap'); + if ($this->birth && ! empty($conf->global->LDAP_MEMBER_FIELD_BIRTHDATE)) $info[$conf->global->LDAP_MEMBER_FIELD_BIRTHDATE] = dol_print_date($this->birth,'dayhourldap'); if (isset($this->statut) && ! empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) $info[$conf->global->LDAP_FIELD_MEMBER_STATUS] = $this->statut; if ($this->datefin && ! empty($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION)) $info[$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION] = dol_print_date($this->datefin,'dayhourldap'); diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index 0159f5d93d5..787cad2664f 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -236,12 +236,12 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $datenaiss=''; - if (isset($_POST["naissday"]) && $_POST["naissday"] - && isset($_POST["naissmonth"]) && $_POST["naissmonth"] - && isset($_POST["naissyear"]) && $_POST["naissyear"]) + $birthdate=''; + if (isset($_POST["birthday"]) && $_POST["birthday"] + && isset($_POST["birthmonth"]) && $_POST["birthmonth"] + && isset($_POST["birthyear"]) && $_POST["birthyear"]) { - $datenaiss=dol_mktime(12, 0, 0, $_POST["naissmonth"], $_POST["naissday"], $_POST["naissyear"]); + $birthdate=dol_mktime(12, 0, 0, $_POST["birthmonth"], $_POST["birthday"], $_POST["birthyear"]); } // Create new object @@ -267,7 +267,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer) $object->phone_perso = trim($_POST["phone_perso"]); $object->phone_mobile= trim($_POST["phone_mobile"]); $object->email = trim($_POST["email"]); - $object->naiss = $datenaiss; + $object->birth = $birthdate; $object->typeid = $_POST["typeid"]; //$object->note = trim($_POST["comment"]); @@ -388,12 +388,12 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer) if ($action == 'add' && $user->rights->adherent->creer) { if ($canvas) $object->canvas=$canvas; - $datenaiss=''; - if (isset($_POST["naissday"]) && $_POST["naissday"] - && isset($_POST["naissmonth"]) && $_POST["naissmonth"] - && isset($_POST["naissyear"]) && $_POST["naissyear"]) + $birthdate=''; + if (isset($_POST["birthday"]) && $_POST["birthday"] + && isset($_POST["birthmonth"]) && $_POST["birthmonth"] + && isset($_POST["birthyear"]) && $_POST["birthyear"]) { - $datenaiss=dol_mktime(12, 0, 0, $_POST["naissmonth"], $_POST["naissday"], $_POST["naissyear"]); + $birthdate=dol_mktime(12, 0, 0, $_POST["birthmonth"], $_POST["birthday"], $_POST["birthyear"]); } $datecotisation=''; if (isset($_POST["reday"]) && isset($_POST["remonth"]) && isset($_POST["reyear"])) @@ -442,7 +442,7 @@ if ($action == 'add' && $user->rights->adherent->creer) $object->email = $email; $object->login = $login; $object->pass = $pass; - $object->naiss = $datenaiss; + $object->naiss = $birthdate; $object->photo = $photo; $object->typeid = $typeid; //$object->note = $comment; @@ -1113,9 +1113,9 @@ else // EMail print '<tr><td>'.($conf->global->ADHERENT_MAIL_REQUIRED?'<span class="fieldrequired">':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'</span>':'').'</td><td><input type="text" name="email" size="40" value="'.(isset($_POST["email"])?$_POST["email"]:$object->email).'"></td></tr>'; - // Date naissance + // Birthday print "<tr><td>".$langs->trans("Birthday")."</td><td>\n"; - $form->select_date(($object->naiss ? $object->naiss : -1),'naiss','','',1,'formsoc'); + $form->select_date(($object->birth ? $object->birth : -1),'birth','','',1,'formsoc'); print "</td></tr>\n"; // Profil public @@ -1444,8 +1444,8 @@ else // EMail print '<tr><td>'.$langs->trans("EMail").'</td><td class="valeur">'.dol_print_email($object->email,0,$object->fk_soc,1).'</td></tr>'; - // Date naissance - print '<tr><td>'.$langs->trans("Birthday").'</td><td class="valeur">'.dol_print_date($object->naiss,'day').'</td></tr>'; + // Birthday + print '<tr><td>'.$langs->trans("Birthday").'</td><td class="valeur">'.dol_print_date($object->birth,'day').'</td></tr>'; // Public print '<tr><td>'.$langs->trans("Public").'</td><td class="valeur">'.yn($object->public).'</td></tr>'; diff --git a/htdocs/admin/ldap_members.php b/htdocs/admin/ldap_members.php index b8245f2aa34..2b3194b9cad 100644 --- a/htdocs/admin/ldap_members.php +++ b/htdocs/admin/ldap_members.php @@ -303,7 +303,7 @@ print '</td><td>'.$langs->trans("LDAPFieldDescriptionExample").'</td>'; print '<td align="right"> </td>'; print '</tr>'; -// Date naissance +// Birthday $var=!$var; print '<tr '.$bc[$var].'><td>'.$langs->trans("LDAPFieldBirthdate").'</td><td>'; print '<input size="25" type="text" name="fieldbirthdate" value="'.$conf->global->LDAP_MEMBER_FIELD_BIRTHDATE.'">'; diff --git a/htdocs/core/modules/modAdherent.class.php b/htdocs/core/modules/modAdherent.class.php index 3757e424ada..44304f870f9 100644 --- a/htdocs/core/modules/modAdherent.class.php +++ b/htdocs/core/modules/modAdherent.class.php @@ -172,9 +172,9 @@ class modAdherent extends DolibarrModules $this->export_code[$r]=$this->rights_class.'_'.$r; $this->export_label[$r]='MembersAndSubscriptions'; $this->export_permission[$r]=array(array("adherent","export")); - $this->export_fields_array[$r]=array('a.rowid'=>'Id','a.civilite'=>"UserTitle",'a.lastname'=>"Lastname",'a.firstname'=>"Firstname",'a.login'=>"Login",'a.morphy'=>'Nature','a.societe'=>'Company','a.address'=>"Address",'a.zip'=>"Zip",'a.town'=>"Town",'a.country'=>"Country",'a.phone'=>"PhonePro",'a.phone_perso'=>"PhonePerso",'a.phone_mobile'=>"PhoneMobile",'a.email'=>"Email",'a.naiss'=>"Birthday",'a.statut'=>"Status",'a.photo'=>"Photo",'a.note'=>"Note",'a.datec'=>'DateCreation','a.datevalid'=>'DateValidation','a.tms'=>'DateLastModification','a.datefin'=>'DateEndSubscription','ta.rowid'=>'MemberTypeId','ta.libelle'=>'MemberTypeLabel','c.rowid'=>'SubscriptionId','c.dateadh'=>'DateSubscription','c.cotisation'=>'Amount'); - $this->export_TypeFields_array[$r]=array('a.civilite'=>"Text",'a.lastname'=>"Text",'a.firstname'=>"Text",'a.login'=>"Text",'a.morphy'=>'Text','a.societe'=>'Text','a.address'=>"Text",'a.zip'=>"Text",'a.town'=>"Text",'a.country'=>"Text",'a.phone'=>"Text",'a.phone_perso'=>"Text",'a.phone_mobile'=>"Text",'a.email'=>"Text",'a.naiss'=>"Date",'a.statut'=>"Status",'a.note'=>"Text",'a.datec'=>'Date','a.datevalid'=>'Date','a.tms'=>'Date','a.datefin'=>'Date','ta.rowid'=>'List:fk_adherent_type:libelle','ta.libelle'=>'Text','c.dateadh'=>'Date','c.cotisation'=>'Number'); - $this->export_entities_array[$r]=array('a.rowid'=>'member','a.civilite'=>"member",'a.lastname'=>"member",'a.firstname'=>"member",'a.login'=>"member",'a.morphy'=>'member','a.societe'=>'member','a.address'=>"member",'a.zip'=>"member",'a.town'=>"member",'a.country'=>"member",'a.phone'=>"member",'a.phone_perso'=>"member",'a.phone_mobile'=>"member",'a.email'=>"member",'a.naiss'=>"member",'a.statut'=>"member",'a.photo'=>"member",'a.note'=>"member",'a.datec'=>'member','a.datevalid'=>'member','a.tms'=>'member','a.datefin'=>'member','ta.rowid'=>'member_type','ta.libelle'=>'member_type','c.rowid'=>'subscription','c.dateadh'=>'subscription','c.cotisation'=>'subscription'); + $this->export_fields_array[$r]=array('a.rowid'=>'Id','a.civilite'=>"UserTitle",'a.lastname'=>"Lastname",'a.firstname'=>"Firstname",'a.login'=>"Login",'a.morphy'=>'Nature','a.societe'=>'Company','a.address'=>"Address",'a.zip'=>"Zip",'a.town'=>"Town",'a.country'=>"Country",'a.phone'=>"PhonePro",'a.phone_perso'=>"PhonePerso",'a.phone_mobile'=>"PhoneMobile",'a.email'=>"Email",'a.birth'=>"Birthday",'a.statut'=>"Status",'a.photo'=>"Photo",'a.note'=>"Note",'a.datec'=>'DateCreation','a.datevalid'=>'DateValidation','a.tms'=>'DateLastModification','a.datefin'=>'DateEndSubscription','ta.rowid'=>'MemberTypeId','ta.libelle'=>'MemberTypeLabel','c.rowid'=>'SubscriptionId','c.dateadh'=>'DateSubscription','c.cotisation'=>'Amount'); + $this->export_TypeFields_array[$r]=array('a.civilite'=>"Text",'a.lastname'=>"Text",'a.firstname'=>"Text",'a.login'=>"Text",'a.morphy'=>'Text','a.societe'=>'Text','a.address'=>"Text",'a.zip'=>"Text",'a.town'=>"Text",'a.country'=>"Text",'a.phone'=>"Text",'a.phone_perso'=>"Text",'a.phone_mobile'=>"Text",'a.email'=>"Text",'a.birth'=>"Date",'a.statut'=>"Status",'a.note'=>"Text",'a.datec'=>'Date','a.datevalid'=>'Date','a.tms'=>'Date','a.datefin'=>'Date','ta.rowid'=>'List:fk_adherent_type:libelle','ta.libelle'=>'Text','c.dateadh'=>'Date','c.cotisation'=>'Number'); + $this->export_entities_array[$r]=array('a.rowid'=>'member','a.civilite'=>"member",'a.lastname'=>"member",'a.firstname'=>"member",'a.login'=>"member",'a.morphy'=>'member','a.societe'=>'member','a.address'=>"member",'a.zip'=>"member",'a.town'=>"member",'a.country'=>"member",'a.phone'=>"member",'a.phone_perso'=>"member",'a.phone_mobile'=>"member",'a.email'=>"member",'a.birth'=>"member",'a.statut'=>"member",'a.photo'=>"member",'a.note'=>"member",'a.datec'=>'member','a.datevalid'=>'member','a.tms'=>'member','a.datefin'=>'member','ta.rowid'=>'member_type','ta.libelle'=>'member_type','c.rowid'=>'subscription','c.dateadh'=>'subscription','c.cotisation'=>'subscription'); // Add extra fields $sql="SELECT name, label FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'member'"; $resql=$this->db->query($sql); @@ -207,7 +207,7 @@ class modAdherent extends DolibarrModules $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon $this->import_tables_array[$r]=array('a'=>MAIN_DB_PREFIX.'adherent','extra'=>MAIN_DB_PREFIX.'adherent_extrafields'); $this->import_tables_creator_array[$r]=array('a'=>'fk_user_author'); // Fields to store import user id - $this->import_fields_array[$r]=array('a.civilite'=>"UserTitle",'a.nom'=>"Lastname*",'a.firstname'=>"Firstname",'a.login'=>"Login*","a.pass"=>"Password","a.fk_adherent_type"=>"MemberType*",'a.morphy'=>'Nature*','a.societe'=>'Company','a.address'=>"Address",'a.zip'=>"Zip",'a.town'=>"Town",'a.country'=>"Country",'a.phone'=>"PhonePro",'a.phone_perso'=>"PhonePerso",'a.phone_mobile'=>"PhoneMobile",'a.email'=>"Email",'a.naiss'=>"Birthday",'a.statut'=>"Status*",'a.photo'=>"Photo",'a.note'=>"Note",'a.datec'=>'DateCreation','a.datefin'=>'DateEndSubscription'); + $this->import_fields_array[$r]=array('a.civilite'=>"UserTitle",'a.nom'=>"Lastname*",'a.firstname'=>"Firstname",'a.login'=>"Login*","a.pass"=>"Password","a.fk_adherent_type"=>"MemberType*",'a.morphy'=>'Nature*','a.societe'=>'Company','a.address'=>"Address",'a.zip'=>"Zip",'a.town'=>"Town",'a.country'=>"Country",'a.phone'=>"PhonePro",'a.phone_perso'=>"PhonePerso",'a.phone_mobile'=>"PhoneMobile",'a.email'=>"Email",'a.birth'=>"Birthday",'a.statut'=>"Status*",'a.photo'=>"Photo",'a.note'=>"Note",'a.datec'=>'DateCreation','a.datefin'=>'DateEndSubscription'); // Add extra fields $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'member'"; $resql=$this->db->query($sql); @@ -223,7 +223,7 @@ class modAdherent extends DolibarrModules // End add extra fields $this->import_fieldshidden_array[$r]=array('extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'adherent'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) $this->import_regex_array[$r]=array('a.civilite'=>'code@'.MAIN_DB_PREFIX.'c_civilite','a.fk_adherent_type'=>'rowid@'.MAIN_DB_PREFIX.'adherent_type','a.morphy'=>'(phy|mor)','a.statut'=>'^[0|1]','a.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','a.datefin'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'); - $this->import_examplevalues_array[$r]=array('a.civilite'=>"MR",'a.nom'=>'Smith','a.firstname'=>'John','a.login'=>'jsmith','a.pass'=>'passofjsmith','a.fk_adherent_type'=>'1','a.morphy'=>'"mor" or "phy"','a.societe'=>'JS company','a.address'=>'21 jump street','a.zip'=>'55000','a.town'=>'New York','a.country'=>'1','a.email'=>'jsmith@example.com','a.naiss'=>'1972-10-10','a.statut'=>"0 or 1",'a.note'=>"This is a comment on member",'a.datec'=>dol_print_date($now,'%Y-%m-%d'),'a.datefin'=>dol_print_date(dol_time_plus_duree($now, 1, 'y'),'%Y-%m-%d')); + $this->import_examplevalues_array[$r]=array('a.civilite'=>"MR",'a.nom'=>'Smith','a.firstname'=>'John','a.login'=>'jsmith','a.pass'=>'passofjsmith','a.fk_adherent_type'=>'1','a.morphy'=>'"mor" or "phy"','a.societe'=>'JS company','a.address'=>'21 jump street','a.zip'=>'55000','a.town'=>'New York','a.country'=>'1','a.email'=>'jsmith@example.com','a.birth'=>'1972-10-10','a.statut'=>"0 or 1",'a.note'=>"This is a comment on member",'a.datec'=>dol_print_date($now,'%Y-%m-%d'),'a.datefin'=>dol_print_date(dol_time_plus_duree($now, 1, 'y'),'%Y-%m-%d')); } diff --git a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql index df178f1ccab..55e8e3af0ce 100755 --- a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql +++ b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql @@ -63,6 +63,7 @@ alter table llx_adherent CHANGE COLUMN prenom firstname varchar(50); alter table llx_adherent CHANGE COLUMN ville town text; alter table llx_adherent CHANGE COLUMN cp zip varchar(10); alter table llx_adherent CHANGE COLUMN pays country varchar(50); +alter table llx_adherent CHANGE COLUMN naiss birth date; alter table llx_adherent CHANGE COLUMN fk_departement state_id varchar(50); alter table llx_bank_account CHANGE COLUMN adresse_proprio owner_address text; alter table llx_bank_account CHANGE COLUMN fk_departement state_id varchar(50); diff --git a/htdocs/install/mysql/tables/llx_adherent.sql b/htdocs/install/mysql/tables/llx_adherent.sql index 821859228a3..936f04d78a4 100644 --- a/htdocs/install/mysql/tables/llx_adherent.sql +++ b/htdocs/install/mysql/tables/llx_adherent.sql @@ -48,7 +48,7 @@ create table llx_adherent phone varchar(30), phone_perso varchar(30), phone_mobile varchar(30), - naiss date, -- date de naissance + birth date, -- birthday photo varchar(255), -- filename or url of photo statut smallint NOT NULL DEFAULT 0, public smallint NOT NULL DEFAULT 0, -- certain champ de la fiche sont ils public ou pas ? diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index d6de1fecf92..d6368514821 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -243,7 +243,7 @@ if ($action == 'add') $adh->typeid = $_POST["type"]; $adh->note = $_POST["comment"]; $adh->morphy = $_POST["morphy"]; - $adh->naiss = $birthday; + $adh->birth = $birthday; foreach($_POST as $key => $value){ if (preg_match("/^options_/",$key)){ diff --git a/htdocs/public/members/public_card.php b/htdocs/public/members/public_card.php index a5423468a2e..d250b838386 100644 --- a/htdocs/public/members/public_card.php +++ b/htdocs/public/members/public_card.php @@ -95,7 +95,7 @@ if ($id > 0) print '<tr><td>'.$langs->trans("Zip").' '.$langs->trans("Town").'</td><td class="valeur">'.$object->zip.' '.$object->town.' </td></tr>'; print '<tr><td>'.$langs->trans("Country").'</td><td class="valeur">'.$object->country.' </td></tr>'; print '<tr><td>'.$langs->trans("EMail").'</td><td class="valeur">'.$object->email.' </td></tr>'; - print '<tr><td>'.$langs->trans("Birthday").'</td><td class="valeur">'.$object->naiss.' </td></tr>'; + print '<tr><td>'.$langs->trans("Birthday").'</td><td class="valeur">'.$object->birth.' </td></tr>'; if (isset($object->photo) && $object->photo !='') { diff --git a/htdocs/public/members/public_list.php b/htdocs/public/members/public_list.php index de4044e3574..971ad3dc449 100644 --- a/htdocs/public/members/public_list.php +++ b/htdocs/public/members/public_list.php @@ -101,7 +101,7 @@ if (! $sortfield) { $sortfield="nom"; } llxHeaderVierge($langs->trans("ListOfValidatedPublicMembers")); -$sql = "SELECT rowid, firstname, lastname, societe, zip, town, email, naiss, photo"; +$sql = "SELECT rowid, firstname, lastname, societe, zip, town, email, birth, photo"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent"; $sql.= " WHERE entity = ".$entity; $sql.= " AND statut = 1"; @@ -127,7 +127,7 @@ if ($result) print '<td><a href="'.$_SERVER["PHP_SELF"].'?page='.$page.'&sortorder=ASC&sortfield=firstname">'.$langs->trans("Firstname").'</a>'; print ' <a href="'.$_SERVER['PHP_SELF'].'?page='.$page.'&sortorder=ASC&sortfield=lastname">'.$langs->trans("Lastname").'</a>'; print ' / <a href="'.$_SERVER["PHP_SELF"].'?page='.$page.'&sortorder=ASC&sortfield=societe">'.$langs->trans("Company").'</a></td>'."\n"; - //print_liste_field_titre($langs->trans("DateToBirth"),"public_list.php","naiss",'',$param,$sortfield,$sortorder); // est-ce nécessaire ?? + //print_liste_field_titre($langs->trans("DateToBirth"),"public_list.php","birth",'',$param,$sortfield,$sortorder); // est-ce nécessaire ?? print_liste_field_titre($langs->trans("EMail"),"public_list.php","email",'',$param,$sortfield,$sortorder); print_liste_field_titre($langs->trans("Zip"),"public_list.php","zip","",$param,$sortfield,$sortorder); print_liste_field_titre($langs->trans("Town"),"public_list.php","town","",$param,$sortfield,$sortorder); @@ -141,7 +141,7 @@ if ($result) $var=!$var; print "<tr $bc[$var]>"; print '<td><a href="public_card.php?id='.$objp->rowid.'">'.dolGetFirstLastname($obj->firstname, $obj->lastname).($objp->societe?' / '.$objp->societe:'').'</a></td>'."\n"; - //print "<td>$objp->naiss</td>\n"; // est-ce nécessaire ?? + //print "<td>$objp->birth</td>\n"; // est-ce nécessaire ?? print '<td>'.$objp->email.'</td>'."\n"; print '<td>'.$objp->zip.'</td>'."\n"; print '<td>'.$objp->town.'</td>'."\n"; diff --git a/scripts/members/sync_members_ldap2dolibarr.php b/scripts/members/sync_members_ldap2dolibarr.php index e89f8186552..d29992a21db 100755 --- a/scripts/members/sync_members_ldap2dolibarr.php +++ b/scripts/members/sync_members_ldap2dolibarr.php @@ -207,7 +207,7 @@ if ($result >= 0) $member->morphy='phy'; $member->photo=''; $member->public=1; - $member->naiss=dol_stringtotime($ldapuser[$conf->global->LDAP_FIELD_BIRTHDATE]); + $member->birth=dol_stringtotime($ldapuser[$conf->global->LDAP_FIELD_BIRTHDATE]); $member->statut=-1; if (isset($ldapuser[$conf->global->LDAP_FIELD_MEMBER_STATUS])) diff --git a/test/phpunit/AdherentTest.php b/test/phpunit/AdherentTest.php index a0ee0efac83..f7a932250b2 100644 --- a/test/phpunit/AdherentTest.php +++ b/test/phpunit/AdherentTest.php @@ -222,7 +222,7 @@ class AdherentTest extends PHPUnit_Framework_TestCase $localobject->phone_perso='New tel perso'; $localobject->phone_mobile='New tel mobile'; $localobject->email='newemail@newemail.com'; - $localobject->naiss=$timestamp; + $localobject->birth=$timestamp; $result=$localobject->update($user); print __METHOD__." id=".$localobject->id." result=".$result."\n"; $this->assertLessThan($result, 0); @@ -256,7 +256,7 @@ class AdherentTest extends PHPUnit_Framework_TestCase $this->assertEquals($localobject->phone_perso, $newobject->phone_perso); $this->assertEquals($localobject->phone_mobile, $newobject->phone_mobile); $this->assertEquals($localobject->email, $newobject->email); - $this->assertEquals($localobject->naiss, $timestamp); + $this->assertEquals($localobject->birth, $timestamp); $this->assertEquals($localobject->morphy, $newobject->morphy); //We return newobject because of new values @@ -281,11 +281,11 @@ class AdherentTest extends PHPUnit_Framework_TestCase $db=$this->savdb; $template = '%DOL_MAIN_URL_ROOT%,%ID%,%CIVILITE%,%FIRSTNAME%,%LASTNAME%,%FULLNAME%,%COMPANY%,'. - '%ADDRESS%,%ZIP%,%TOWN%,%COUNTRY%,%EMAIL%,%NAISS%,%PHOTO%,%LOGIN%,%PASSWORD%,%PRENOM%,'. + '%ADDRESS%,%ZIP%,%TOWN%,%COUNTRY%,%EMAIL%,%BIRTH%,%PHOTO%,%LOGIN%,%PASSWORD%,%PRENOM%,'. '%NOM%,%SOCIETE%,%ADDRESS%,%ZIP%,%TOWN%,%COUNTRY%'; $expected = DOL_MAIN_URL_ROOT.','.$localobject->id.',0,New firstname,New name,New firstname New name,'. - 'New company,New address,New zip,New town,Belgium,newemail@newemail.com,'.dol_print_date($localobject->naiss,'day').',,'. + 'New company,New address,New zip,New town,Belgium,newemail@newemail.com,'.dol_print_date($localobject->birth,'day').',,'. 'newlogin,dolibspec,New firstname,New name,New company,New address,New zip,New town,Belgium'; $result = $localobject->makeSubstitution($template); -- GitLab