case 'montant_cotis':
$this->_amount = $value;
$value = strtr($value, ',', '.');
- if (!is_numeric($value)) {
+ if (!is_numeric($value) && $value !== '') {
$this->errors[] = _T("- The amount must be an integer!");
}
break;
$this->_begin_date = $d->format('Y-m-d');
} catch (\Exception $e) {
Analog::log(
- 'Wrong date format. field: ' . $key .
+ 'Wrong date format. field: ' . $name .
', value: ' . $value . ', expected fmt: ' .
__("Y-m-d") . ' | ' . $e->getMessage(),
Analog::INFO
),
array(
__("Y-m-d"),
- $this->_fields[$key]['label']
+ $this->_fields['date_debut_cotis']['label']
),
_T("- Wrong date format (%date_format) for %field!")
);
$select->where($this->fpk . ' = ' . $id);
$results = $this->zdb->execute($select);
- $result = $results->current();
- $this->loadFromRS($result);
+ if ($results->count() > 0) {
+ $result = $results->current();
+ $this->loadFromRS($result);
- return true;
+ return true;
+ } else {
+ throw new \RuntimeException(
+ 'Unknown ID ' . $id . '!'
+ );
+ }
} catch (\Exception $e) {
Analog::log(
'Cannot load ' . $this->getType() . ' from id `' . $id . '` | ' .