Commit f9950f51 authored by Dainis Abols's avatar Dainis Abols
Browse files

Added document achrive task. Updated readme.

4.3.1
parent 5531986c
......@@ -462,4 +462,25 @@ class Document extends AbstractEntity
// Return result
return !empty($result) ? true : false;
}
/**
* Archives older NAS documents
*
* @return bool
*/
public function executeCron()
{
// Update views
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($this->tableName);
$queryBuilder->getRestrictions()->removeAll();
$result = $queryBuilder->update($this->tableName)
->where(
$queryBuilder->expr()->gt('date_archived', 0),
$queryBuilder->expr()->lt('date_archived', strtotime(date("Y-m-d")))
)
->set('archived', 1)
->execute();
return true;
}
}
......@@ -55,8 +55,6 @@ class DataHelper
/**
* Retrieve language value for requested string
*
* @TODO: Implement different language requests
*
* @param string $string
*
* @return string
......
<?php
namespace Lu\LuNas\Tasks;
use Lu\LuNas\Domain\Model\Document;
use TYPO3\CMS\Scheduler\Task\AbstractTask;
class DocumentArchiveTask extends AbstractTask
{
public function execute()
{
return (new Document())->executeCron();
}
}
......@@ -68,6 +68,9 @@
<trans-unit id="extension.short_title">
<source><![CDATA[LU NAS]]></source>
</trans-unit>
<trans-unit id="cron.title" approved="yes">
<source><![CDATA[NAS Dokumentu arhivēšana]]></source>
</trans-unit>
<trans-unit id="extension.title">
<source><![CDATA[LU Normtīvo Aktu Sistēma]]></source>
</trans-unit>
......
......@@ -85,6 +85,10 @@
<source><![CDATA[LU NAS]]></source>
<target><![CDATA[LU NAS]]></target>
</trans-unit>
<trans-unit id="cron.title" approved="yes">
<source><![CDATA[NAS Dokumentu arhivēšana]]></source>
<target><![CDATA[NAS Dokumentu arhivēšana]]></target>
</trans-unit>
<trans-unit id="extension.title" approved="yes">
<source><![CDATA[LU Normtīvo Aktu Sistēma]]></source>
<target><![CDATA[LU Normtīvo Aktu Sistēma]]></target>
......
{
"name": "luitd/lu-nas",
"version": "4.3.0",
"version": "4.3.1",
"description": "Latvijas Universitātes Normatīvo Aktu sistēmas TYPO3 spraudnis",
"type": "typo3-cms-extension",
"keywords": [
......
......@@ -9,7 +9,7 @@ $EM_CONF[$_EXTKEY] = [
'author_email' => 'dainis.abols@lu.lv',
'state' => 'stable',
'clearCacheOnLoad' => true,
'version' => '4.3.0',
'version' => '4.3.1',
'constraints' => [
'depends' => [
'typo3' => '10.4.0-10.9.99',
......
......@@ -17,11 +17,17 @@ if (!defined('TYPO3_MODE')) {
// Add elements for dev views
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:lu_nas/Configuration/TSConfig/mod.newElements.ts">');
// Initialize task scheduler
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['Lu\\LuNas\\Tasks\\DocumentArchiveTask'] = [
'extension' => 'tx_lunas',
'title' => 'LLL:EXT:lu_nas/Resources/Private/Language/locallang.xlf:cron.title',
'description' => 'LLL:EXT:lu_nas/Resources/Private/Language/locallang.xlf:extension.title',
'additionalFields' => '',
];
// Register hooks
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass']['tx_lunas'] = \Lu\LuNas\Hooks\TCEmainHook::class;
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass']['tx_lunas'] = \Lu\LuNas\Hooks\TCEmainHook::class;
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['nasFileMigrationLv']
= \Lu\LuNas\Updates\FileMigrationWizardLv::class;
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['nasFileMigrationEn']
= \Lu\LuNas\Updates\FileMigrationWizardEn::class;
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['nasFileMigrationLv'] = \Lu\LuNas\Updates\FileMigrationWizardLv::class;
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['nasFileMigrationEn'] = \Lu\LuNas\Updates\FileMigrationWizardEn::class;
......@@ -4,62 +4,25 @@ TYPO3 Extension for Regulations (NAS)
## Version
4.3.0
4.3.1
## Dependecies
TYPO3 v8+ (TYPO3 v9 Ready)
TYPO3 v10+
LU API 2.8+
## Author
Dainis Abols <dainis.abols@lu.lv>
## Key changes
## Configuration
* Extension key changed from `user_nas` to `lu_nas`
* Namespace added `Lu/LuNas`
* Database changes:
| Var name | Meaning |
| ----------------------- | ---------------------- |
| general.storage_page_id | File storage directory |
* user_nas_connected_docs > tx_lunas_domain_model_related
- id > uid
## Task scheduler
* user_nas_document > tx_lunas_domain_model_document
- id > uid
- pid `NEW`
- rikojuma_dokum_id > order_doc_id
- lv_doc_filename > filename_lv
- original_lv_doc_filename > filename_lv <- tricky
- en_doc_filename > filename_en
- original_en_doc_filename > filename_en <- tricky
- public_accessible > public
- last_modified > updated_at
- date_record_inserted > created_at
- user_last_modified > updated_by
- imported_from_luis > imported
- viewed_count > view_count
* user_nas_document_issuer > tx_lunas_domain_model_issuer
- id > uid
- pid `NEW`
* user_nas_document_rikojuma_dokum > tx_lunas_domain_model_ordertype
- id > uid
- pid `NEW`
* user_nas_document_status > tx_lunas_domain_model_status
- id > uid
- pid `NEW`
* user_nas_document_type > tx_lunas_domain_model_type
- id > uid
- pid `NEW`
* user_nas_doc_connection_types > tx_lunas_domain_model_connectiontype
- id > uid
- pid `NEW`
## Configuration @TODO Not implemented!
| Var name | Meaning |
| ------------------------- | ---------------------- |
| general.storage_directory | File storage directory |
| Var name | Meaning |
| ------------------- | -------------------------------------------------- |
| DocumentArchiveTask | Archives dokuments after `date_archived` is reched |
Supports Markdown
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