Skip to content

Commit

Permalink
Manage empty values for start date and end date (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
coudot authored Dec 31, 2024
1 parent 1548b87 commit 0f671e6
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions htdocs/updatevaliditydates.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,17 @@
$result = "hookerror";
} else {

if ($use_updatestarttime and $start_date) {
$startDate = new DateTime($start_date);
$ldapStartDate = $directory->getLdapDate($startDate);
if ($use_updatestarttime) {
$ldapStartDate = $start_date ? $directory->getLdapDate(new DateTime($start_date)) : array();
$update = $ldapInstance->modify_attributes($dn, array( $attributes_map['starttime']['attribute'] => $ldapStartDate));
if ( $update[0] == 0 ) {
$result = "validiydatesupdated";
} else {
$result = "ldaperror";
}
}
if ($use_updateendtime and $end_date) {
$endDate = new DateTime($end_date);
$ldapEndDate = $directory->getLdapDate($endDate);
if ($use_updateendtime) {
$ldapEndDate = $end_date ? $directory->getLdapDate(new DateTime($end_date)) : array();
$update = $ldapInstance->modify_attributes($dn, array( $attributes_map['endtime']['attribute'] => $ldapEndDate));
if ( $update[0] == 0 and $result !== "ldaperror" ) {
$result = "validiydatesupdated";
Expand Down

0 comments on commit 0f671e6

Please sign in to comment.