developer.jelix.org is not used any more and exists only for history. Post new tickets on the Github account.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Opened 10 years ago

Closed 10 years ago

#1139 closed bug (fixed)

jFormsControlDate.class.php et jFormsControlDatetime

Reported by: Zeffyr Owned by:
Priority: normal Milestone: Jelix 1.1.7
Component: jelix:forms Version: 1.1.6
Severity: normal Keywords:
Cc: Blocked By:
Blocking: Documentation needed: no
Hosting Provider: Php version:

Description

lib/jelix/forms/controls/jFormsControlDate.class.php

 function setValueFromRequest($request) {
        $value = $request->getParam($this->ref,'');
        $value = $value['year'].'-'.$value['month'].'-'.$value['day'];
        if($value == '--')
            $value = '';
        $this->setData($value);
    }

il manque un test sur $value qui peut ne pas être un tableau patch proposé:

function setValueFromRequest($request) {
        $value = $request->getParam($this->ref,'');
        if(is_array($value))
	$value = $value['year'].'-'.$value['month'].'-'.$value['day'];
        if($value == '--')
            $value = '';
        $this->setData($value);
    }

Idem pour lib/jelix/forms/controls/jFormsControlDatetime.class.php

  function setValueFromRequest($request) {
        $value = $request->getParam($this->ref,'');
        if($value['year'] === '' && $value['month'] === '' && $value['day'] === '' && $value['hour'] === '' && $value['minutes'] === '' && (!$this->enableSeconds || $value['seconds'] === ''))
            $this->setData('');
        else{
            if($value['seconds']==='')
                $value['seconds'] = '00';
            $this->setData($value['year'].'-'.$value['month'].'-'.$value['day'].' '.$value['hour'].':'.$value['minutes'].':'.$value['seconds']);
        }
    }

par

function setValueFromRequest($request) {
        $value = $request->getParam($this->ref,'');
		  if(!is_array($value))
			$this->setData('');
        elseif($value['year'] === '' && $value['month'] === '' && $value['day'] === '' && $value['hour'] === '' && $value['minutes'] === '' && (!$this->enableSeconds || $value['seconds'] === ''))
            $this->setData('');
        else{
            if($value['seconds']==='')
                $value['seconds'] = '00';
            $this->setData($value['year'].'-'.$value['month'].'-'.$value['day'].' '.$value['hour'].':'.$value['minutes'].':'.$value['seconds']);
        }
    }

Change History (2)

comment:1 Changed 10 years ago by laurentj

  • Component changed from jelix to jelix:forms
  • Milestone set to Jelix 1.2

Dans quel cas ce n'est pas un tableau ?

comment:2 Changed 10 years ago by laurentj

  • Milestone changed from Jelix 1.2 to Jelix 1.1.7
  • Resolution set to fixed
  • review set to review+
  • Status changed from new to closed
  • Version changed from trunk to 1.1.6
Note: See TracTickets for help on using tickets.