mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
Merge branch 'seeddms-5.1.x' into seeddms-6.0.x
This commit is contained in:
commit
d497eebc01
|
@ -163,6 +163,7 @@
|
|||
- show access rights of folder/document if user has write access
|
||||
- fix creating preview images of documents in drop folder
|
||||
- fix list of expired documents in admin tools (Closes: #474)
|
||||
- list of expired documents can be sorted
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
Changes in version 5.1.16
|
||||
|
|
|
@ -738,20 +738,36 @@ class SeedDMS_Core_DMS {
|
|||
/**
|
||||
* Returns all documents which already expired or will expire in the future
|
||||
*
|
||||
* The parameter $date will be relative to the start of the day. It can
|
||||
* be either a number of days (if an integer is passed) or a date string
|
||||
* in the format 'YYYY-MM-DD'.
|
||||
* If the parameter $date is a negative number or a date in the past, then
|
||||
* all documents from the start of that date till the end of the current
|
||||
* day will be returned. If $date is a positive integer or $date is a
|
||||
* date in the future, the all documents from the start of the current
|
||||
* day till the end of the day of the given date will be returned.
|
||||
* Passing 0 or the
|
||||
* current date in $date, will return all documents expiring the current
|
||||
* day.
|
||||
* @param string $date date in format YYYY-MM-DD or an integer with the number
|
||||
* of days. A negative value will cover the days in the past.
|
||||
* @param SeedDMS_Core_User $user
|
||||
* @param SeedDMS_Core_User $user limits the documents on those owned
|
||||
* by this user
|
||||
* @param string $orderby n=name, e=expired
|
||||
* @param string $orderdir d=desc or a=asc
|
||||
* @param bool $update update status of document if set to true
|
||||
* @return bool|SeedDMS_Core_Document[]
|
||||
*/
|
||||
function getDocumentsExpired($date, $user=null) { /* {{{ */
|
||||
function getDocumentsExpired($date, $user=null, $orderby='e', $orderdir='desc', $update=true) { /* {{{ */
|
||||
$db = $this->getDB();
|
||||
|
||||
if (!$db->createTemporaryTable("ttstatid") || !$db->createTemporaryTable("ttcontentid")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$tsnow = mktime(0, 0, 0); /* Start of today */
|
||||
if(is_int($date)) {
|
||||
$ts = mktime(0, 0, 0) + $date * 86400;
|
||||
$ts = $tsnow + $date * 86400;
|
||||
} elseif(is_string($date)) {
|
||||
$tmp = explode('-', $date, 3);
|
||||
if(count($tmp) != 3)
|
||||
|
@ -760,11 +776,10 @@ class SeedDMS_Core_DMS {
|
|||
} else
|
||||
return false;
|
||||
|
||||
$tsnow = mktime(0, 0, 0); /* Start of today */
|
||||
if($ts < $tsnow) { /* Check for docs expired in the past */
|
||||
$startts = $ts;
|
||||
$endts = $tsnow+86400; /* Use end of day */
|
||||
$updatestatus = true;
|
||||
$updatestatus = $update;
|
||||
} else { /* Check for docs which will expire in the future */
|
||||
$startts = $tsnow;
|
||||
$endts = $ts+86400; /* Use end of day */
|
||||
|
@ -782,12 +797,12 @@ class SeedDMS_Core_DMS {
|
|||
"LEFT JOIN `ttstatid` ON `ttstatid`.`statusID` = `tblDocumentStatus`.`statusID` ".
|
||||
"LEFT JOIN `tblDocumentStatusLog` ON `tblDocumentStatusLog`.`statusLogID` = `ttstatid`.`maxLogID`";
|
||||
$queryStr .=
|
||||
" WHERE `tblDocuments`.`expires` > ".$startts." AND `tblDocuments`.`expires` < ".$endts;
|
||||
" WHERE `tblDocuments`.`expires` >= ".$startts." AND `tblDocuments`.`expires` < ".$endts;
|
||||
if($user)
|
||||
$queryStr .=
|
||||
" AND `tblDocuments`.`owner` = '".$user->getID()."' ";
|
||||
$queryStr .=
|
||||
" ORDER BY `expires` DESC";
|
||||
" ORDER BY ".($orderby == 'e' ? "`expires`" : "`name`")." ".($orderdir == 'd' ? "DESC" : "ASC");
|
||||
|
||||
$resArr = $db->getResultArray($queryStr);
|
||||
if (is_bool($resArr) && !$resArr)
|
||||
|
@ -797,8 +812,9 @@ class SeedDMS_Core_DMS {
|
|||
$documents = array();
|
||||
foreach ($resArr as $row) {
|
||||
$document = $this->getDocument($row["id"]);
|
||||
if($updatestatus)
|
||||
if($updatestatus) {
|
||||
$document->verifyLastestContentExpriry();
|
||||
}
|
||||
$documents[] = $document;
|
||||
}
|
||||
return $documents;
|
||||
|
|
|
@ -839,11 +839,16 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
/**
|
||||
* Check if the document has expired
|
||||
*
|
||||
* The method expects to database field 'expired' to hold the timestamp
|
||||
* of the start of day at which end the document expires. The document will
|
||||
* expire if that day is over. Hence, a document will *not*
|
||||
* be expired during the day of expiration but at the end of that day
|
||||
*
|
||||
* @return boolean true if document has expired otherwise false
|
||||
*/
|
||||
function hasExpired() { /* {{{ */
|
||||
if (intval($this->_expires) == 0) return false;
|
||||
if (time()>$this->_expires+24*60*60) return true;
|
||||
if (time()>=$this->_expires+24*60*60) return true;
|
||||
return false;
|
||||
} /* }}} */
|
||||
|
||||
|
|
|
@ -1781,6 +1781,7 @@ add method SeedDMS_Core_DatabaseAccess::setLogFp()
|
|||
<notes>
|
||||
- add new callback onSetStatus
|
||||
- fix SeedDMS_Core_DMS::getExpiredDocuments(), sql statement failed because temp. tables were not created
|
||||
- add parameters $orderdir, $orderby, $update to SeedDMS_Core::getExpiredDocuments()
|
||||
</notes>
|
||||
</release>
|
||||
<release>
|
||||
|
|
|
@ -26,13 +26,13 @@ if(true) {
|
|||
include("inc/inc.Init.php");
|
||||
include("inc/inc.Extension.php");
|
||||
include("inc/inc.DBInit.php");
|
||||
include("inc/inc.Authentication.php");
|
||||
// include("inc/inc.Authentication.php");
|
||||
|
||||
require "vendor/autoload.php";
|
||||
|
||||
$c = new \Slim\Container(); //Create Your container
|
||||
$c['notFoundHandler'] = function ($c) use ($settings, $dms, $user, $theme) {
|
||||
return function ($request, $response) use ($c, $settings, $dms, $user, $theme) {
|
||||
$c['notFoundHandler'] = function ($c) use ($settings, $dms, $theme) {
|
||||
return function ($request, $response) use ($c, $settings, $dms, $theme) {
|
||||
$uri = $request->getUri();
|
||||
if($uri->getBasePath())
|
||||
$file = $uri->getPath();
|
||||
|
@ -55,7 +55,7 @@ if(true) {
|
|||
if(isset($GLOBALS['SEEDDMS_HOOKS']['initDMS'])) {
|
||||
foreach($GLOBALS['SEEDDMS_HOOKS']['initDMS'] as $hookObj) {
|
||||
if (method_exists($hookObj, 'addRoute')) {
|
||||
$hookObj->addRoute(array('dms'=>$dms, 'user'=>$user, 'app'=>$app, 'settings'=>$settings));
|
||||
$hookObj->addRoute(array('dms'=>$dms, 'app'=>$app, 'settings'=>$settings));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,14 +40,19 @@ if ($user->isGuest()) {
|
|||
UI::exitError(getMLText("expired_documents"),getMLText("access_denied"));
|
||||
}
|
||||
|
||||
$orderby='n';
|
||||
$orderby='e';
|
||||
if (isset($_GET["orderby"]) && strlen($_GET["orderby"])==1 ) {
|
||||
$orderby=$_GET["orderby"];
|
||||
}
|
||||
$orderdir='d';
|
||||
if (isset($_GET["orderdir"]) && strlen($_GET["orderdir"])==1 ) {
|
||||
$orderdir=$_GET["orderdir"];
|
||||
}
|
||||
|
||||
if($view) {
|
||||
$view->setParam('showtree', showtree());
|
||||
$view->setParam('orderby', $orderby);
|
||||
$view->setParam('orderdir', $orderdir);
|
||||
$view->setParam('cachedir', $settings->_cacheDir);
|
||||
$view->setParam('previewWidthList', $settings->_previewWidthList);
|
||||
$view->setParam('timeout', $settings->_cmdTimeout);
|
||||
|
|
|
@ -51,10 +51,12 @@ class SeedDMS_View_ExpiredDocuments extends SeedDMS_Bootstrap_Style {
|
|||
$dms = $this->params['dms'];
|
||||
$user = $this->params['user'];
|
||||
$orderby = $this->params['orderby'];
|
||||
$orderdir = $this->params['orderdir'];
|
||||
$cachedir = $this->params['cachedir'];
|
||||
$previewwidth = $this->params['previewWidthList'];
|
||||
$timeout = $this->params['timeout'];
|
||||
$xsendfile = $this->params['xsendfile'];
|
||||
$order = $orderby.$orderdir;
|
||||
|
||||
$this->htmlAddHeader('<script type="text/javascript" src="../styles/'.$this->theme.'/bootbox/bootbox.min.js"></script>'."\n", 'js');
|
||||
|
||||
|
@ -69,12 +71,15 @@ class SeedDMS_View_ExpiredDocuments extends SeedDMS_Bootstrap_Style {
|
|||
$this->contentHeading(getMLText("expired_documents"));
|
||||
// $this->contentContainerStart();
|
||||
|
||||
if($docs = $dms->getDocumentsExpired(-1400)) {
|
||||
if($docs = $dms->getDocumentsExpired(-1400, null, $orderby, $orderdir, true)) {
|
||||
|
||||
print "<table class=\"table table-condensed\">";
|
||||
print "<thead>\n<tr>\n";
|
||||
print "<th></th>";
|
||||
print "<th><a href=\"../out/out.ExpiredDocuments.php?orderby=n\">".getMLText("name")."</a> — <a href=\"../out/out.ExpiredDocuments.php?orderby=e\">".getMLText("expires")."</a></th>\n";
|
||||
print "<th>".getMLText("name");
|
||||
print " <a href=\"../out/out.ExpiredDocuments.php?".($order=="na"?"&orderby=n&orderdir=d":"&orderby=n&orderdir=a")."\" \"title=\"".getMLText("sort_by_name")."\">".($order=="na"?' <i class="icon-sort-by-alphabet selected"></i>':($order=="nd"?' <i class="icon-sort-by-alphabet-alt selected"></i>':' <i class="icon-sort-by-alphabet"></i>'))."</a>";
|
||||
print " <a href=\"../out/out.ExpiredDocuments.php?".($order=="ea"?"&orderby=e&orderdir=d":"&orderby=e&orderdir=a")."\" \"title=\"".getMLText("sort_by_expiration_date")."\">".($order=="ea"?' <i class="icon-sort-by-order selected"></i>':($order=="ed"?' <i class="icon-sort-by-order-alt selected"></i>':' <i class="icon-sort-by-order"></i>'))."</a>";
|
||||
print "</th>\n";
|
||||
print "<th>".getMLText("status")."</th>\n";
|
||||
print "<th>".getMLText("action")."</th>\n";
|
||||
print "</tr>\n</thead>\n<tbody>\n";
|
||||
|
|
Loading…
Reference in New Issue
Block a user