add searching for last date of a document status

This commit is contained in:
Uwe Steinmann 2021-03-15 16:08:51 +01:00
parent b103d9f30d
commit fad2020cfd
2 changed files with 50 additions and 0 deletions

View File

@ -359,6 +359,29 @@ if(((!isset($_GET["fullsearch"]) && $settings->_defaultSearchMethod == 'fulltext
UI::exitError(getMLText("search"),getMLText("invalid_create_date_end"));
}
$statusstartdate = array();
$statusstopdate = array();
if (isset($_GET["statusdate"]) && $_GET["statusdate"]!=null) {
$statusdate = true;
} else {
$statusdate = false;
}
if(isset($_GET["statusstart"])) {
$tmp = explode("-", $_GET["statusstart"]);
$statusstartdate = array('year'=>(int)$tmp[0], 'month'=>(int)$tmp[1], 'day'=>(int)$tmp[2], 'hour'=>0, 'minute'=>0, 'second'=>0);
}
if ($statusstartdate && !checkdate($statusstartdate['month'], $startdate['day'], $startdate['year'])) {
UI::exitError(getMLText("search"),getMLText("invalid_status_date_end"));
}
if(isset($_GET["statusend"])) {
$tmp = explode("-", $_GET["statusend"]);
$statusstopdate = array('year'=>(int)$tmp[0], 'month'=>(int)$tmp[1], 'day'=>(int)$tmp[2], 'hour'=>23, 'minute'=>59, 'second'=>59);
}
if ($statusstopdate && !checkdate($statusstopdate['month'], $stopdate['day'], $stopdate['year'])) {
UI::exitError(getMLText("search"),getMLText("invalid_status_date_end"));
}
$expstartdate = array();
$expstopdate = array();
if (isset($_GET["expirationdate"]) && $_GET["expirationdate"]!=null) {
@ -499,6 +522,8 @@ if(((!isset($_GET["fullsearch"]) && $settings->_defaultSearchMethod == 'fulltext
'mode'=>$resultmode,
'expirationstartdate'=>$expirationdate ? $expstartdate : array(),
'expirationenddate'=>$expirationdate ? $expstopdate : array(),
'statusstartdate'=>$statusdate ? $statusstartdate : array(),
'statusenddate'=>$statusdate ? $statusstopdate : array(),
'orderby'=>$orderby
));
$total = $resArr['totalDocs'] + $resArr['totalFolders'];
@ -572,8 +597,11 @@ if($settings->_showSingleSearchHit && count($entries) == 1) {
$view->setParam('stopdate', isset($stopdate) ? $stopdate : array());
$view->setParam('expstartdate', isset($expstartdate) ? $expstartdate : array());
$view->setParam('expstopdate', isset($expstopdate) ? $expstopdate : array());
$view->setParam('statusstartdate', isset($statusstartdate) ? $statusstartdate : array());
$view->setParam('statusstopdate', isset($statusstopdate) ? $statusstopdate : array());
$view->setParam('creationdate', isset($creationdate) ? $creationdate : '');
$view->setParam('expirationdate', isset($expirationdate) ? $expirationdate: '');
$view->setParam('statusdate', isset($statusdate) ? $statusdate: '');
$view->setParam('status', isset($status) ? $status : array());
$view->setParam('categories', isset($categories) ? $categories : '');
$view->setParam('category', isset($categorynames) ? $categorynames : '');

View File

@ -141,8 +141,11 @@ function typeahead() { /* {{{ */
$stopdate = $this->params['stopdate'];
$expstartdate = $this->params['expstartdate'];
$expstopdate = $this->params['expstopdate'];
$statusstartdate = $this->params['statusstartdate'];
$statusstopdate = $this->params['statusstopdate'];
$creationdate = $this->params['creationdate'];
$expirationdate = $this->params['expirationdate'];
$statusdate = $this->params['statusdate'];
$status = $this->params['status'];
$this->query = $this->params['query'];
$orderby = $this->params['orderby'];
@ -306,6 +309,8 @@ function typeahead() { /* {{{ */
$openfilterdlg = true;
if($expirationdate)
$openfilterdlg = true;
if($statusdate)
$openfilterdlg = true;
?>
<div class="accordion" id="accordion2">
<div class="accordion-group">
@ -369,6 +374,23 @@ function typeahead() { /* {{{ */
</span>
</td>
</tr>
<tr>
<td><?php printMLText("status_change");?>:</td>
<td>
<label class="checkbox inline">
<input type="checkbox" name="statusdate" value="true" <?php if($statusdate) echo "checked"; ?>/><?php printMLText("between");?>
</label><br />
<span class="input-append date datepicker" style="display: inline;" id="statusstartdate" data-date="<?php echo date('Y-m-d'); ?>" data-date-format="yyyy-mm-dd" data-date-language="<?php echo str_replace('_', '-', $this->params['session']->getLanguage()); ?>">
<input class="span4" size="16" name="statusstart" type="text" value="<?php if($statusstartdate) printf("%04d-%02d-%02d", $statusstartdate['year'], $statusstartdate['month'], $statusstartdate['day']); else echo date('Y-m-d'); ?>">
<span class="add-on"><i class="fa fa-calendar"></i></span>
</span>&nbsp;
<?php printMLText("and"); ?>
<span class="input-append date datepicker" style="display: inline;" id="statusenddate" data-date="<?php echo date('Y-m-d'); ?>" data-date-format="yyyy-mm-dd" data-date-language="<?php echo str_replace('_', '-', $this->params['session']->getLanguage()); ?>">
<input class="span4" size="16" name="statusend" type="text" value="<?php if($statusstopdate) printf("%04d-%02d-%02d", $statusstopdate['year'], $statusstopdate['month'], $statusstopdate['day']); else echo date('Y-m-d'); ?>">
<span class="add-on"><i class="fa fa-calendar"></i></span>
</span>
</td>
</tr>
<?php
if($attrdefs) {
foreach($attrdefs as $attrdef) {