Fix translation and sql request

This commit is contained in:
Laurent Destailleur 2019-09-28 12:36:09 +02:00
parent 86e5465197
commit db32ca99c6
6 changed files with 27 additions and 21 deletions

View File

@ -1039,8 +1039,8 @@ else
print '<tr><td>'.$langs->trans("LinkedIn").'</td><td><input type="text" name="member_linkedin" size="40" value="'.(GETPOST('member_linkedin', 'alpha')?GETPOST('member_linkedin', 'alpha'):$object->linkedin).'"></td></tr>'; print '<tr><td>'.$langs->trans("LinkedIn").'</td><td><input type="text" name="member_linkedin" size="40" value="'.(GETPOST('member_linkedin', 'alpha')?GETPOST('member_linkedin', 'alpha'):$object->linkedin).'"></td></tr>';
} }
// Birthday // Birth Date
print "<tr><td>".$langs->trans("Birthday")."</td><td>\n"; print "<tr><td>".$langs->trans("DateToBirth")."</td><td>\n";
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";
@ -1308,8 +1308,8 @@ else
print '<tr><td>'.$langs->trans("LinkedIn").'</td><td><input type="text" name="linkedin" class="minwidth100" value="'.(isset($_POST["linkedin"])?GETPOST("linkedin"):$object->linkedin).'"></td></tr>'; print '<tr><td>'.$langs->trans("LinkedIn").'</td><td><input type="text" name="linkedin" class="minwidth100" value="'.(isset($_POST["linkedin"])?GETPOST("linkedin"):$object->linkedin).'"></td></tr>';
} }
// Birthday // Birth Date
print "<tr><td>".$langs->trans("Birthday")."</td><td>\n"; print "<tr><td>".$langs->trans("DateToBirth")."</td><td>\n";
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";
@ -1750,8 +1750,8 @@ else
print '<table class="border tableforfield tableforfield" width="100%">'; print '<table class="border tableforfield tableforfield" width="100%">';
// Birthday // Birth Date
print '<tr><td class="titlefield">'.$langs->trans("Birthday").'</td><td class="valeur">'.dol_print_date($object->birth, 'day').'</td></tr>'; print '<tr><td class="titlefield">'.$langs->trans("DateToBirth").'</td><td class="valeur">'.dol_print_date($object->birth, 'day').'</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

@ -34,7 +34,7 @@ class box_birthdays extends ModeleBoxes
{ {
public $boxcode="birthdays"; public $boxcode="birthdays";
public $boximg="object_user"; public $boximg="object_user";
public $boxlabel="BoxBirthdays"; public $boxlabel="BoxTitleUserBirthdaysOfMonth";
public $depends = array("user"); public $depends = array("user");
/** /**
@ -76,6 +76,7 @@ class box_birthdays extends ModeleBoxes
$this->max=$max; $this->max=$max;
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
$userstatic=new User($this->db); $userstatic=new User($this->db);
@ -83,11 +84,12 @@ class box_birthdays extends ModeleBoxes
if ($user->rights->user->user->lire) if ($user->rights->user->user->lire)
{ {
$sql = "SELECT u.rowid, u.firstname, u.lastname"; $tmparray=dol_getdate(dol_now(), true);
$sql.= ", u.birth";
$sql = "SELECT u.rowid, u.firstname, u.lastname, u.birth";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE u.entity IN (".getEntity('user').")"; $sql.= " WHERE u.entity IN (".getEntity('user').")";
$sql.= " AND MONTH(u.birth) = ".date('m'); $sql.= dolSqlDateFilter('u.birth', 0, $tmparray['mon'], $tmparray['year']);
$sql.= " ORDER BY u.birth ASC"; $sql.= " ORDER BY u.birth ASC";
$sql.= $this->db->plimit($max, 0); $sql.= $this->db->plimit($max, 0);
@ -127,7 +129,7 @@ class box_birthdays extends ModeleBoxes
$line++; $line++;
} }
if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'class="center"','text'=>$langs->trans("NoRecordedUsers")); if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'class="center opacitymedium"','text'=>$langs->trans("None"));
$this->db->free($result); $this->db->free($result);
} }

View File

@ -34,7 +34,7 @@ class box_birthdays_members extends ModeleBoxes
{ {
public $boxcode="birthdays_members"; public $boxcode="birthdays_members";
public $boximg="object_user"; public $boximg="object_user";
public $boxlabel="BoxBirthdaysMembers"; public $boxlabel="BoxTitleMemberNextBirthdays";
public $depends = array("adherent"); public $depends = array("adherent");
/** /**
@ -76,6 +76,7 @@ class box_birthdays_members extends ModeleBoxes
$this->max=$max; $this->max=$max;
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$memberstatic=new Adherent($this->db); $memberstatic=new Adherent($this->db);
@ -83,13 +84,14 @@ class box_birthdays_members extends ModeleBoxes
if ($user->rights->adherent->lire) if ($user->rights->adherent->lire)
{ {
$sql = "SELECT u.rowid, u.firstname, u.lastname"; $tmparray=dol_getdate(dol_now(), true);
$sql.= ", u.birth";
$sql = "SELECT u.rowid, u.firstname, u.lastname, u.birth";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as u"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as u";
$sql.= " WHERE u.entity IN (".getEntity('adherent').")"; $sql.= " WHERE u.entity IN (".getEntity('adherent').")";
$sql.= " AND u.statut = 1"; $sql.= " AND u.statut = 1";
$sql.= " AND date_format(u.birth, '%m-%d') >= date_format(curdate(), '%m-%d')"; $sql.= dolSqlDateFilter('u.birth', 0, $tmparray['mon'], $tmparray['year']);
$sql.= " ORDER BY date_format(u.birth, '%m-%d') ASC"; $sql.= " ORDER BY u.birth ASC";
$sql.= $this->db->plimit($max, 0); $sql.= $this->db->plimit($max, 0);
dol_syslog(get_class($this)."::loadBox", LOG_DEBUG); dol_syslog(get_class($this)."::loadBox", LOG_DEBUG);
@ -128,7 +130,7 @@ class box_birthdays_members extends ModeleBoxes
$line++; $line++;
} }
if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'class="center"','text'=>$langs->trans("NoRecordedUsers")); if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'class="center opacitymedium"','text'=>$langs->trans("None"));
$this->db->free($result); $this->db->free($result);
} }

View File

@ -19,6 +19,7 @@ BoxLastContacts=Latest contacts/addresses
BoxLastMembers=Latest members BoxLastMembers=Latest members
BoxFicheInter=Latest interventions BoxFicheInter=Latest interventions
BoxCurrentAccounts=Open accounts balance BoxCurrentAccounts=Open accounts balance
BoxTitleMemberNextBirthdays=Birthdays of this month (members)
BoxTitleLastRssInfos=Latest %s news from %s BoxTitleLastRssInfos=Latest %s news from %s
BoxTitleLastProducts=Products/Services: last %s modified BoxTitleLastProducts=Products/Services: last %s modified
BoxTitleProductsAlertStock=Products: stock alert BoxTitleProductsAlertStock=Products: stock alert
@ -85,4 +86,4 @@ ForProposals=Proposals
LastXMonthRolling=The latest %s month rolling LastXMonthRolling=The latest %s month rolling
ChooseBoxToAdd=Add widget to your dashboard ChooseBoxToAdd=Add widget to your dashboard
BoxAdded=Widget was added in your dashboard BoxAdded=Widget was added in your dashboard
BoxTitleUserBirthdaysOfMonth=Birthdays of this month BoxTitleUserBirthdaysOfMonth=Birthdays of this month (users)

View File

@ -6,7 +6,7 @@ TMenuTools=Tools
ToolsDesc=All tools not included in other menu entries are grouped here.<br>All the tools can be accessed via the left menu. ToolsDesc=All tools not included in other menu entries are grouped here.<br>All the tools can be accessed via the left menu.
Birthday=Birthday Birthday=Birthday
BirthdayDate=Birthday date BirthdayDate=Birthday date
DateToBirth=Date of birth DateToBirth=Birth date
BirthdayAlertOn=birthday alert active BirthdayAlertOn=birthday alert active
BirthdayAlertOff=birthday alert inactive BirthdayAlertOff=birthday alert inactive
TransKey=Translation of the key TransKey TransKey=Translation of the key TransKey

View File

@ -240,6 +240,7 @@ foreach($search as $key => $val)
if ($search[$key] != '') $sql.=natural_search($key, $search[$key], (($key == 'status')?2:$mode_search)); if ($search[$key] != '') $sql.=natural_search($key, $search[$key], (($key == 'status')?2:$mode_search));
} }
if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all); if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all);
//$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
// Add where from extra fields // Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
// Add where from hooks // Add where from hooks