Commit 2d1d44bf authored by sylvieg's avatar sylvieg

[FIX]tracker: if a date field has one field not filled, send a mandatory error on this field

parent 27fa8772
......@@ -67,8 +67,11 @@ class Tracker_Field_DateTime extends Tracker_Field_Abstract implements Tracker_F
'value' => $this->getValue($this->getOption(3) == 'blank' ? '' : TikiLib::lib('tiki')->now),
);
if (isset($requestData[$ins_id.'Month']) || isset($requestData[$ins_id.'Hour'])) {
if (isset($requestData[$ins_id.'Month']) || isset($requestData[$ins_id.'Day']) || isset($requestData[$ins_id.'Year']) || isset($requestData[$ins_id.'Hour']) || isset($requestData[$ins_id.'Minute'])) {
$data['value'] = TikiLib::lib('trk')->build_date($requestData, $this->getOption(0), $ins_id);
if (empty($data['value']) && (!empty($requestData[$ins_id.'Month']) || !empty($requestData[$ins_id.'Day']) || !empty($requestData[$ins_id.'Year']) || !empty($requestData[$ins_id.'Hour']) || !empty($requestData[$ins_id.'Minute']))) {
$data['error'] = 'y';
}
}
return $data;
......
......@@ -1911,6 +1911,9 @@ class TrackerLib extends TikiLib
if (isset($ins_fields)&&isset($ins_fields['data']))
foreach($ins_fields['data'] as $f) {
if ($f['type'] == 'f' && isset($f['error']) && $f['isMandatory'] != 'y') {
$mandatory_fields[] = $f;
}
if ($f['type'] != 'q' and isset($f['isMandatory']) && $f['isMandatory'] == 'y') {
if ($f['type'] == 'e') {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment