CMS MADE SIMPLE FORGE

Frontend Users

 

[#11577] Error when required date field is less than or egal to 1 January 1970

avatar
Created By: cyrcle (cyrcle)
Date Submitted: Sat Sep 16 06:03:49 -0400 2017

Assigned To: Robert Campbell (calguy1000)
Version: 2.6
CMSMS Version: 2.2.3.1
Severity: Minor
Resolution: None
State: Open
Summary:
Error when required date field is less than or egal to 1 January 1970
Detailed Description:
In the admin_edituser2 step, it's not possible to validate the form when a
required date field is less than or egal  to 1 January 1970.
Probably because in this case, the value is negative. For example, for January
01, 1970, the value is -3600.
In this case, an alert is displayed "birth_date is a required field" and it's
not possible to validate the user's record.


History

Comments
avatar
Date: 2017-10-04 12:14
Posted By: cyrcle (cyrcle)

in /modules/FrontEndUsers/lib/class.property_editor_defn.php
There is no more error if I replace line 263 :
if( $val < 1 && $this->required ) throw new
\RuntimeException($mod->Lang('error_missing_required_param',$name));
by :
if( $val == '0' && $this->required ) throw new
\RuntimeException($mod->Lang('error_missing_required_param',$name));

and work better if I replace in admin_edituser2.tpl :
     {elseif $field->type == 8}
        {* date *}
	{$tmp="{$actionid}prop_{$field->name}"}
{html_select_date prefix=$tmp time=$field->value start_year=1900 end_year=2036}
     {/if}
by  :
     {elseif $field->type == 8}
        {* date *}
	{$tmp="{$actionid}prop_{$field->name}"}
	<label>Valeur: {$field->value}</label>
	  {if $field->value == "" || $field->value == 0}
{html_select_date prefix=$tmp time=NULL start_year=-99 end_year="+0"
field_order=DMY day_empty=Jour month_empty=Mois year_empty=Annee}
	  {else}
{html_select_date prefix=$tmp time=$field->value start_year=-99 end_year="+0"
field_order=DMY day_empty=Jour month_empty=Mois year_empty=Annee}
	  {/if}
     {/if}
      
avatar
Date: 2017-10-24 10:25
Posted By: Jack Skiba (nidus)

I second it, when field type date is required it is a big problem to add or edit
listing.