propperly handle modification date

This commit is contained in:
Uwe Steinmann 2023-05-03 16:23:11 +02:00
parent 3739f9e658
commit 97a3da352f

View File

@ -913,7 +913,7 @@ $(document).ready(function() {
$option[] = array(array('data-subtitle', $c.' ×')); $option[] = array(array('data-subtitle', $c.' ×'));
$options[] = $option; $options[] = $option;
} }
} elseif(substr($facetname, 0, 5) == 'attr_' || $facetname == 'created') { } elseif(substr($facetname, 0, 5) == 'attr_' || $facetname == 'created' || $facetname == 'modified') {
/* Do not even create a list of options, because it isn't used */ /* Do not even create a list of options, because it isn't used */
} else { } else {
foreach($values as $v=>$c) { foreach($values as $v=>$c) {
@ -926,7 +926,7 @@ $(document).ready(function() {
$options[] = $option; $options[] = $option;
} }
} }
if(substr($facetname, 0, 5) != 'attr_' && $facetname != 'created') { if(substr($facetname, 0, 5) != 'attr_' && $facetname != 'created' && $facetname != 'modified') {
$this->formField( $this->formField(
getMLText($facetname), getMLText($facetname),
array( array(
@ -1115,6 +1115,7 @@ $(document).ready(function() {
array_walk($oldtransval, function(&$v, $k){$v = getOverallStatusText($v);}); array_walk($oldtransval, function(&$v, $k){$v = getOverallStatusText($v);});
break; break;
case 'created': case 'created':
case 'modified':
if(!empty($allparams[$facetname]['from']) || !empty($allparams[$facetname]['to'])) { if(!empty($allparams[$facetname]['from']) || !empty($allparams[$facetname]['to'])) {
array_walk($allparams[$facetname], function(&$v, $k){$v=getReadableDate($v);}); array_walk($allparams[$facetname], function(&$v, $k){$v=getReadableDate($v);});
$oldvalue = $allparams[$facetname]; $oldvalue = $allparams[$facetname];
@ -1238,7 +1239,7 @@ $(document).ready(function() {
} }
} }
} }
} elseif($facetname == 'created') { } elseif($facetname == 'created' || $facetname == 'modified') {
if(empty($allparams[$facetname]['from']) && empty($allparams[$facetname]['to'])) { if(empty($allparams[$facetname]['from']) && empty($allparams[$facetname]['to'])) {
$tt = array_keys($values); $tt = array_keys($values);
$content = '<div class="input-group">'; $content = '<div class="input-group">';
@ -1248,7 +1249,11 @@ $(document).ready(function() {
$content .= $this->getDateChooser('', $facetname."[to]", $this->params['session']->getLanguage(), '', '' /*getReadableDate(min($tt))*/, getReadableDate(time()), null, '', true); $content .= $this->getDateChooser('', $facetname."[to]", $this->params['session']->getLanguage(), '', '' /*getReadableDate(min($tt))*/, getReadableDate(time()), null, '', true);
$content .= '<button class="btn btn-primary" type="submit">Set</button>'; $content .= '<button class="btn btn-primary" type="submit">Set</button>';
$content .= '</div>'; $content .= '</div>';
$this->printAccordion(getMLText('creation_date'), $content); if($facetname == 'created')
$this->printAccordion(getMLText('creation_date'), $content);
elseif($facetname == 'modified') {
// $this->printAccordion(getMLText('modification_date'), $content);
}
} }
} else { } else {
/* Further filter makes only sense if the facet has more than 1 value /* Further filter makes only sense if the facet has more than 1 value