Projet

Général

Profil

Révision 1f683914

Ajouté par Assos Assos il y a environ 7 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/date/date_popup/date_popup.module
585 585
  // If something was input but there is no date, the date is invalid.
586 586
  // If the field is empty and required, set error message and return.
587 587
  $error_field = implode('][', $element['#parents']);
588
  if (empty($date) || !empty($date->errors)) {
588
  if ((empty($element['#value']['date']) && empty($element['#value']['time']))  || !empty($date->errors)) {
589 589
    if (is_object($date) && !empty($date->errors)) {
590 590
      $message = t('The value input for field %field is invalid:', array('%field' => $label));
591 591
      $message .= '<br />' . implode('<br />', $date->errors);
......
618 618
 */
619 619
function date_popup_input_date($element, $input, $auto_complete = FALSE) {
620 620
  if (empty($input) || !is_array($input) || !array_key_exists('date', $input) || empty($input['date'])) {
621
    return NULL;
621
    //check if there is no time associated in the input variable. This is the exception scenario where the user has entered only time and not date.
622
    if(empty($input['time']))
623
      return NULL;
622 624
  }
623 625
  date_popup_add();
624 626
  $granularity = date_format_order($element['#date_format']);
......
627 629

  
628 630
  $format = date_popup_date_format($element);
629 631
  $format .= $has_time ? ' ' . date_popup_time_format($element) : '';
630
  $datetime = trim($input['date']);
632
  //check if date is empty, if yes, then leave it blank.
633
  $datetime = !empty($input['date']) ? trim($input['date']) : '';
631 634
  $datetime .= $has_time ? ' ' . trim($input['time']) : '';
632 635
  $date = new DateObject($datetime, $element['#date_timezone'], $format);
636
  //if the variable is time only then set TimeOnly to TRUE
637
  if(empty($input['date']) && !empty($input['time']) ){
638
    $date->timeOnly = 'TRUE';
639
  }
633 640
  if (is_object($date)) {
634 641
    $date->limitGranularity($granularity);
635 642
    if ($date->validGranularity($granularity, $flexible)) {

Formats disponibles : Unified diff