Changeset 872


Ignore:
Timestamp:
Apr 6, 2020, 9:59:59 PM (4 years ago)
Author:
chronos
Message:
  • Fixed: Init default value even if Default index is not defined.
  • Fixed: Null value support also for Date and Time form types.
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/Version.php

    r871 r872  
    11<?php
    22
    3 $Revision = 871; // Subversion revision
     3$Revision = 872; // Subversion revision
    44$DatabaseRevision = 870; // SQL structure revision
    55$ReleaseTime = strtotime('2020-04-06');
  • trunk/Common/Form/Form.php

    r871 r872  
    5050      {
    5151        if (!array_key_exists($Index, $this->Values))
    52           $this->Values[$Index] = $Item['Default'];
     52        {
     53          if (isset($Item['Default'])) $this->Values[$Index] = $Item['Default'];
     54            else $this->Values[$Index] = null;
     55        }
    5356      }
    5457    }
  • trunk/Common/Form/Types/Date.php

    r639 r872  
    2323    global $MonthNames;
    2424
    25     if(($Item['Value'] !== null) and ((strtolower($Item['Value']) == 'now') or (strtolower($Item['Value']) == ''))) $Item['Value'] = time();
     25    if (($Item['Value'] == null) or (($Item['Value'] !== null) and ((strtolower($Item['Value']) == 'now') or (strtolower($Item['Value']) == ''))))
     26    {
     27      $Item['Value'] = time();
     28      $IsNull = true;
     29    } else $IsNull = false;
    2630    $Parts = getdate($Item['Value']);
    2731
     
    3034    if(array_key_exists('Null', $Item) and $Item['Null'])
    3135    {
    32       if($Item['Value'] != null)
     36      if(!$IsNull)
    3337      {
    3438        $Checked = ' checked="1"';
  • trunk/Common/Form/Types/Time.php

    r659 r872  
    1919  function OnEdit($Item)
    2020  {
    21     if(($Item['Value'] !== null) and ((strtolower($Item['Value']) == 'now') or (strtolower($Item['Value']) == ''))) $Item['Value'] = time();
    22     $TimeParts = getdate($Item['Value']);
     21    if (($Item['Value'] == null) or (($Item['Value'] !== null) and ((strtolower($Item['Value']) == 'now') or (strtolower($Item['Value']) == ''))))
     22    {
     23      $Item['Value'] = time();
     24      $IsNull = true;
     25    } else $IsNull = false;
     26    $Parts = getdate($Item['Value']);
    2327
    2428    $Output = '';
     
    2630    if(array_key_exists('Null', $Item) and $Item['Null'])
    2731    {
    28       if($Item['Value'] != null)
     32      if($IsNull)
    2933      {
    3034        $Checked = ' checked="1"';
Note: See TracChangeset for help on using the changeset viewer.