6.0.0-beta1
8/7/25

[#3134] emptyDateArray assumes 3 date components
Summary emptyDateArray assumes 3 date components
Queue Horde Framework Packages
Queue Version HEAD
Type Enhancement
State Resolved
Priority 2. Medium
Owners
Requester robin (at) rainton (dot) com
Created 12/14/2005 (7176 days ago)
Due
Updated 11/16/2006 (6839 days ago)
Assigned
Resolved 11/16/2006 (6839 days ago)
Milestone
Patch No

History
11/16/2006 05:30:11 PM Chuck Hagenbuch Comment #2
State ⇒ Resolved
Reply to this comment
Done, slightly simpler but same idea. Thanks!
12/14/2005 04:19:51 AM Chuck Hagenbuch Type ⇒ Enhancement
State ⇒ Accepted
Priority ⇒ 2. Medium
Version ⇒ HEAD
 
12/14/2005 02:31:30 AM robin (at) rainton (dot) com Comment #1
State ⇒ Unconfirmed
Priority ⇒ 2. Medium
Type ⇒ Bug
Summary ⇒ emptyDateArray assumes 3 date components
Queue ⇒ Horde Framework Packages
Reply to this comment
It is possible to have a number of date parts other than 3. For 
example, when initialising a form ($this):



     $this->addVariable(_("Start Date"), 'start', 'monthDayYear', true);

     $this->addVariable(_("Start Time"), 'start', 'hourMinuteSecond', true);



Which works as expected, but breaks the validation function, which 
should probably read:



     function emptyDateArray($date)

     {

         if (!is_array($date)) {

             return empty($date);

         }



         $empty = 0;

         $parts = 0;

         /* Check each date array component. */

         foreach ($date as $key => $val) {

             $parts++;

             if (empty($val)) {

                 $empty++;

             }

         }

         /* Check state of empty. */

         if ($empty == 0) {

             /* If no empty parts return 0. */

             return 0;

         } elseif ($empty == $parts) {

             /* If all empty parts return 1. */

             return 1;

         } else {

             /* If some empty parts return -1. */

             return -1;

         }

     }


Saved Queries