From 817e16d6527308fb3d7e29638dd0187dd479f387 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 18 Apr 2020 20:01:18 +0200 Subject: [PATCH 1/2] Fix birthdays boxes and filter on month --- htdocs/core/boxes/box_birthdays.php | 2 +- htdocs/core/boxes/box_birthdays_members.php | 2 +- htdocs/core/lib/date.lib.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/boxes/box_birthdays.php b/htdocs/core/boxes/box_birthdays.php index 05d4e1d3ac0..2df1f0d331e 100644 --- a/htdocs/core/boxes/box_birthdays.php +++ b/htdocs/core/boxes/box_birthdays.php @@ -89,7 +89,7 @@ class box_birthdays extends ModeleBoxes $sql = "SELECT u.rowid, u.firstname, u.lastname, u.birth"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; $sql.= " WHERE u.entity IN (".getEntity('user').")"; - $sql.= dolSqlDateFilter('u.birth', 0, $tmparray['mon'], $tmparray['year']); + $sql.= dolSqlDateFilter('u.birth', 0, $tmparray['mon'], 0); $sql.= " ORDER BY u.birth ASC"; $sql.= $this->db->plimit($max, 0); diff --git a/htdocs/core/boxes/box_birthdays_members.php b/htdocs/core/boxes/box_birthdays_members.php index e48271c4d84..bb8f0b94904 100644 --- a/htdocs/core/boxes/box_birthdays_members.php +++ b/htdocs/core/boxes/box_birthdays_members.php @@ -90,7 +90,7 @@ class box_birthdays_members extends ModeleBoxes $sql.= " FROM ".MAIN_DB_PREFIX."adherent as u"; $sql.= " WHERE u.entity IN (".getEntity('adherent').")"; $sql.= " AND u.statut = 1"; - $sql.= dolSqlDateFilter('u.birth', 0, $tmparray['mon'], $tmparray['year']); + $sql.= dolSqlDateFilter('u.birth', 0, $tmparray['mon'], 0); $sql.= " ORDER BY u.birth ASC"; $sql.= $this->db->plimit($max, 0); diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 8fb32bb2f37..123e3297f11 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -301,7 +301,7 @@ function dolSqlDateFilter($datefield, $day_date, $month_date, $year_date, $exclu $sqldate.= ($excludefirstand ? "" : " AND ").$datefield." BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month_date, $day_date, $year_date)); $sqldate.= "' AND '".$db->idate(dol_mktime(23, 59, 59, $month_date, $day_date, $year_date))."'"; } else - $sqldate.= ($excludefirstand ? "" : " AND ")." date_format( ".$datefield.", '%m') = '".$db->escape($month_date)."'"; + $sqldate.= ($excludefirstand ? "" : " AND ")." date_format( ".$datefield.", '%c') = '".$db->escape($month_date)."'"; } elseif ($year_date > 0){ $sqldate.= ($excludefirstand ? "" : " AND ").$datefield." BETWEEN '".$db->idate(dol_get_first_day($year_date, 1, false)); $sqldate.= "' AND '".$db->idate(dol_get_last_day($year_date, 12, false))."'"; From b72651fdfdae61724fcb8832979a12ead6264f1f Mon Sep 17 00:00:00 2001 From: gauthier Date: Mon, 20 Apr 2020 15:59:44 +0200 Subject: [PATCH 2/2] FIX : we must export company mail address on contact vcard only if contact email address is empty --- htdocs/contact/vcard.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contact/vcard.php b/htdocs/contact/vcard.php index ebfdfecd6a7..8536c4ebe33 100644 --- a/htdocs/contact/vcard.php +++ b/htdocs/contact/vcard.php @@ -79,7 +79,7 @@ if ($company->id) if (! $contact->phone_pro) $v->setPhoneNumber($company->phone, "TYPE=WORK;VOICE"); if (! $contact->fax) $v->setPhoneNumber($company->fax, "TYPE=WORK;FAX"); if (! $contact->zip) $v->setAddress("", "", $company->address, $company->town, "", $company->zip, $company->country, "TYPE=WORK;POSTAL"); - if ($company->email != $contact->email) $v->setEmail($company->email, 'TYPE=PREF,INTERNET'); + if (empty($contact->email)) $v->setEmail($company->email, 'TYPE=PREF,INTERNET'); // Si contact lie a un tiers non de type "particulier" if ($contact->typent_code != 'TE_PRIVATE') $v->setOrg($company->name); }