This commit is contained in:
ptibogxiv 2022-08-07 10:14:40 +02:00
parent 1a1c5d9110
commit 65629121f8
2 changed files with 43 additions and 4 deletions

View File

@ -40,6 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
@ -312,7 +313,7 @@ if (empty($reshook)) {
//$object->facebook = trim(GETPOST("facebook", 'alpha')); //$object->facebook = trim(GETPOST("facebook", 'alpha'));
//$object->linkedin = trim(GETPOST("linkedin", 'alpha')); //$object->linkedin = trim(GETPOST("linkedin", 'alpha'));
$object->birth = $birthdate; $object->birth = $birthdate;
$object->default_lang = GETPOST('default_lang', 'alpha');
$object->typeid = GETPOST("typeid", 'int'); $object->typeid = GETPOST("typeid", 'int');
//$object->note = trim(GETPOST("comment","alpha")); //$object->note = trim(GETPOST("comment","alpha"));
$object->morphy = GETPOST("morphy", 'alpha'); $object->morphy = GETPOST("morphy", 'alpha');
@ -457,6 +458,7 @@ if (empty($reshook)) {
$userid = GETPOST("userid", 'int'); $userid = GETPOST("userid", 'int');
$socid = GETPOST("socid", 'int'); $socid = GETPOST("socid", 'int');
$default_lang = GETPOST('default_lang', 'alpha');
$object->civility_id = $civility_id; $object->civility_id = $civility_id;
$object->firstname = $firstname; $object->firstname = $firstname;
@ -498,7 +500,7 @@ if (empty($reshook)) {
$object->user_id = $userid; $object->user_id = $userid;
$object->socid = $socid; $object->socid = $socid;
$object->public = $public; $object->public = $public;
$object->default_lang = $default_lang;
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object); $ret = $extrafields->setOptionalsFromPost(null, $object);
if ($ret < 0) { if ($ret < 0) {
@ -899,6 +901,7 @@ if (empty($reshook)) {
$form = new Form($db); $form = new Form($db);
$formfile = new FormFile($db); $formfile = new FormFile($db);
$formadmin = new FormAdmin($db);
$formcompany = new FormCompany($db); $formcompany = new FormCompany($db);
$title = $langs->trans("Member")." - ".$langs->trans("Card"); $title = $langs->trans("Member")." - ".$langs->trans("Card");
@ -1363,6 +1366,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print $form->selectDate(($object->birth ? $object->birth : -1), 'birth', '', '', 1, 'formsoc'); print $form->selectDate(($object->birth ? $object->birth : -1), 'birth', '', '', 1, 'formsoc');
print "</td></tr>\n"; print "</td></tr>\n";
// Default language
if (!empty($conf->global->MAIN_MULTILANGS)) {
print '<tr><td>'.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).'</td><td colspan="3">'."\n";
print img_picto('', 'language').$formadmin->select_language($object->default_lang, 'default_lang', 0, 0, 1);
print '</td>';
print '</tr>';
}
// Public profil // Public profil
print "<tr><td>".$langs->trans("Public")."</td><td>\n"; print "<tr><td>".$langs->trans("Public")."</td><td>\n";
print $form->selectyesno("public", (GETPOSTISSET("public") ? GETPOST("public", 'alphanohtml', 2) : $object->public), 1); print $form->selectyesno("public", (GETPOSTISSET("public") ? GETPOST("public", 'alphanohtml', 2) : $object->public), 1);
@ -1803,6 +1814,19 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Birth Date // Birth Date
print '<tr><td class="titlefield">'.$langs->trans("DateOfBirth").'</td><td class="valeur">'.dol_print_date($object->birth, 'day').'</td></tr>'; print '<tr><td class="titlefield">'.$langs->trans("DateOfBirth").'</td><td class="valeur">'.dol_print_date($object->birth, 'day').'</td></tr>';
// Default language
if (!empty($conf->global->MAIN_MULTILANGS)) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
print '<tr><td>'.$langs->trans("DefaultLang").'</td><td>';
//$s=picto_from_langcode($object->default_lang);
//print ($s?$s.' ':'');
$langs->load("languages");
$labellang = ($object->default_lang ? $langs->trans('Language_'.$object->default_lang) : '');
print picto_from_langcode($object->default_lang, 'class="paddingrightonly saturatemedium opacitylow"');
print $labellang;
print '</td></tr>';
}
// Public // Public
print '<tr><td>'.$langs->trans("Public").'</td><td class="valeur">'.yn($object->public).'</td></tr>'; print '<tr><td>'.$langs->trans("Public").'</td><td class="valeur">'.yn($object->public).'</td></tr>';

View File

@ -215,6 +215,12 @@ class Adherent extends CommonObject
*/ */
public $public; public $public;
/**
* Default language code of member (en_US, ...)
* @var string
*/
public $default_lang;
/** /**
* @var string photo of member * @var string photo of member
*/ */
@ -328,6 +334,7 @@ class Adherent extends CommonObject
'photo' => array('type' => 'varchar(255)', 'label' => 'Photo', 'enabled' => 1, 'visible' => -1, 'position' => 135), 'photo' => array('type' => 'varchar(255)', 'label' => 'Photo', 'enabled' => 1, 'visible' => -1, 'position' => 135),
'public' => array('type' => 'smallint(6)', 'label' => 'Public', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 145), 'public' => array('type' => 'smallint(6)', 'label' => 'Public', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 145),
'datefin' => array('type' => 'datetime', 'label' => 'DateEnd', 'enabled' => 1, 'visible' => -1, 'position' => 150), 'datefin' => array('type' => 'datetime', 'label' => 'DateEnd', 'enabled' => 1, 'visible' => -1, 'position' => 150),
'default_lang' =>array('type'=>'varchar(6)', 'label'=>'Default lang', 'enabled'=>1, 'visible'=>-1, 'position'=> 153),
'note_private' => array('type' => 'text', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 0, 'position' => 155), 'note_private' => array('type' => 'text', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 0, 'position' => 155),
'note_public' => array('type' => 'text', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 0, 'position' => 160), 'note_public' => array('type' => 'text', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 0, 'position' => 160),
'datevalid' => array('type' => 'datetime', 'label' => 'DateValidation', 'enabled' => 1, 'visible' => -1, 'position' => 165), 'datevalid' => array('type' => 'datetime', 'label' => 'DateValidation', 'enabled' => 1, 'visible' => -1, 'position' => 165),
@ -710,9 +717,11 @@ class Adherent extends CommonObject
$sql .= ", photo = ".($this->photo ? "'".$this->db->escape($this->photo)."'" : "null"); $sql .= ", photo = ".($this->photo ? "'".$this->db->escape($this->photo)."'" : "null");
$sql .= ", public = '".$this->db->escape($this->public)."'"; $sql .= ", public = '".$this->db->escape($this->public)."'";
$sql .= ", statut = ".$this->db->escape($this->statut); $sql .= ", statut = ".$this->db->escape($this->statut);
$sql .= ", default_lang = ".(!empty($this->default_lang) ? "'".$this->db->escape($this->default_lang)."'" : "null");
$sql .= ", fk_adherent_type = ".$this->db->escape($this->typeid); $sql .= ", fk_adherent_type = ".$this->db->escape($this->typeid);
$sql .= ", morphy = '".$this->db->escape($this->morphy)."'"; $sql .= ", morphy = '".$this->db->escape($this->morphy)."'";
$sql .= ", birth = ".($this->birth ? "'".$this->db->idate($this->birth)."'" : "null"); $sql .= ", birth = ".($this->birth ? "'".$this->db->idate($this->birth)."'" : "null");
if ($this->datefin) { if ($this->datefin) {
$sql .= ", datefin = '".$this->db->idate($this->datefin)."'"; // Must be modified only when deleting a subscription $sql .= ", datefin = '".$this->db->idate($this->datefin)."'"; // Must be modified only when deleting a subscription
} }
@ -833,6 +842,8 @@ class Adherent extends CommonObject
$luser->office_phone = $this->phone; $luser->office_phone = $this->phone;
$luser->user_mobile = $this->phone_mobile; $luser->user_mobile = $this->phone_mobile;
$luser->lang = $this->default_lang;
$luser->fk_member = $this->id; $luser->fk_member = $this->id;
$result = $luser->update($user, 0, 1, 1); // Use nosync to 1 to avoid cyclic updates $result = $luser->update($user, 0, 1, 1); // Use nosync to 1 to avoid cyclic updates
@ -868,6 +879,7 @@ class Adherent extends CommonObject
$lthirdparty->state_id = $this->state_id; $lthirdparty->state_id = $this->state_id;
$lthirdparty->country_id = $this->country_id; $lthirdparty->country_id = $this->country_id;
//$lthirdparty->phone_mobile=$this->phone_mobile; //$lthirdparty->phone_mobile=$this->phone_mobile;
$lthirdparty->default_lang = $this->default_lang;
$result = $lthirdparty->update($this->fk_soc, $user, 0, 1, 1, 'update'); // Use sync to 0 to avoid cyclic updates $result = $lthirdparty->update($this->fk_soc, $user, 0, 1, 1, 'update'); // Use sync to 0 to avoid cyclic updates
@ -1314,7 +1326,7 @@ class Adherent extends CommonObject
$sql .= " d.photo, d.fk_adherent_type, d.morphy, d.entity,"; $sql .= " d.photo, d.fk_adherent_type, d.morphy, d.entity,";
$sql .= " d.datec as datec,"; $sql .= " d.datec as datec,";
$sql .= " d.tms as datem,"; $sql .= " d.tms as datem,";
$sql .= " d.datefin as datefin,"; $sql .= " d.datefin as datefin, d.default_lang,";
$sql .= " d.birth as birthday,"; $sql .= " d.birth as birthday,";
$sql .= " d.datevalid as datev,"; $sql .= " d.datevalid as datev,";
$sql .= " d.country,"; $sql .= " d.country,";
@ -1407,6 +1419,8 @@ class Adherent extends CommonObject
$this->date_validation = $this->db->jdate($obj->datev); $this->date_validation = $this->db->jdate($obj->datev);
$this->birth = $this->db->jdate($obj->birthday); $this->birth = $this->db->jdate($obj->birthday);
$this->default_lang = $obj->default_lang;
$this->note_private = $obj->note_private; $this->note_private = $obj->note_private;
$this->note_public = $obj->note_public; $this->note_public = $obj->note_public;
$this->morphy = $obj->morphy; $this->morphy = $obj->morphy;
@ -2556,6 +2570,7 @@ class Adherent extends CommonObject
$this->datefin = $now; $this->datefin = $now;
$this->datevalid = $now; $this->datevalid = $now;
$this->default_lang = '';
$this->typeid = 1; // Id type adherent $this->typeid = 1; // Id type adherent
$this->type = 'Type adherent'; // Libelle type adherent $this->type = 'Type adherent'; // Libelle type adherent