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

Tag and process update v4.4.0

Changelog:
- archived documents changed to status "Nav aktuāls"
- added tag to document view
- added tag to table list view
- added new field process
- added new field process to table list view
- removed outdated "Studiju ceļvedis" link
- added red "Archived" mark to document title in table list view
- renamed tags
- renamed archived checkbox

Update executables:
`UPDATE tx_lunas_domain_model_document SET process_id = 0 WHERE process_id IS NULL;`
parent f9950f51
...@@ -6,7 +6,9 @@ use Lu\LuApi\DataSources\SolrRegulations; ...@@ -6,7 +6,9 @@ use Lu\LuApi\DataSources\SolrRegulations;
use Lu\LuNas\Domain\Model\Document; use Lu\LuNas\Domain\Model\Document;
use Lu\LuNas\Domain\Model\Issuer; use Lu\LuNas\Domain\Model\Issuer;
use Lu\LuNas\Domain\Model\OrderType; use Lu\LuNas\Domain\Model\OrderType;
use Lu\LuNas\Domain\Model\Process;
use Lu\LuNas\Domain\Model\Status; use Lu\LuNas\Domain\Model\Status;
use Lu\LuNas\Domain\Model\Tag;
use Lu\LuNas\Domain\Model\Type; use Lu\LuNas\Domain\Model\Type;
use Lu\LuNas\Domain\Repository\DocumentRepository; use Lu\LuNas\Domain\Repository\DocumentRepository;
use Lu\LuNas\Domain\Session\BackendSessionHandler; use Lu\LuNas\Domain\Session\BackendSessionHandler;
...@@ -257,6 +259,8 @@ class FrontController extends ActionController ...@@ -257,6 +259,8 @@ class FrontController extends ActionController
$typeModel = new Type(); $typeModel = new Type();
$statusModel = new Status(); $statusModel = new Status();
$issuerModel = new Issuer(); $issuerModel = new Issuer();
$processModel = new Process();
$tagModel = new Tag();
$documentsModel = new Document(); $documentsModel = new Document();
$orderTypeModel = new OrderType(); $orderTypeModel = new OrderType();
...@@ -296,6 +300,16 @@ class FrontController extends ActionController ...@@ -296,6 +300,16 @@ class FrontController extends ActionController
$document['issuer'] = $issuer['title']; $document['issuer'] = $issuer['title'];
} }
// Get process name
if ($document['process_id']) {
$document['process'] = $processModel->getProcessById($document['process_id']);
}
// Get tags
if ($document['tags']) {
$document['tag_names'] = $tagModel->getTagNamesById($document['tags']);
}
// Get related // Get related
$related = $documentsModel->getRelated(); $related = $documentsModel->getRelated();
......
...@@ -234,6 +234,8 @@ class Document extends AbstractEntity ...@@ -234,6 +234,8 @@ class Document extends AbstractEntity
$orderTypesModel = new OrderType(); $orderTypesModel = new OrderType();
$typesModel = new Type(); $typesModel = new Type();
$statusModel = new Status(); $statusModel = new Status();
$processModel = new Process();
$tagModel = new Tag();
// Build the query // Build the query
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($this->tableName); $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($this->tableName);
...@@ -281,6 +283,8 @@ class Document extends AbstractEntity ...@@ -281,6 +283,8 @@ class Document extends AbstractEntity
'order_name' => $orderTypesModel->getOrderTypeById($row['order_doc_id']), 'order_name' => $orderTypesModel->getOrderTypeById($row['order_doc_id']),
'type_name' => $typesModel->getTypeById($row['document_type_id']), 'type_name' => $typesModel->getTypeById($row['document_type_id']),
'status_icon' => $statusModel->getStatusIcon($row['status_id']), 'status_icon' => $statusModel->getStatusIcon($row['status_id']),
'process' => $processModel->getProcessById($row['process_id']),
'tag_names' => $tagModel->getTagNamesById($row['tags']),
] + $row; ] + $row;
} }
...@@ -479,6 +483,7 @@ class Document extends AbstractEntity ...@@ -479,6 +483,7 @@ class Document extends AbstractEntity
$queryBuilder->expr()->lt('date_archived', strtotime(date("Y-m-d"))) $queryBuilder->expr()->lt('date_archived', strtotime(date("Y-m-d")))
) )
->set('archived', 1) ->set('archived', 1)
->set('status_id', 3)
->execute(); ->execute();
return true; return true;
......
<?php
namespace Lu\LuNas\Domain\Model;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
/**
* Class Process
*
* @author Dainis Abols <dainis.abols@lu.lv>
* @owner University of Latvia
* @since 01.11.2021
*
* @package Lu\LuNas\Domain\Model
*/
class Process extends AbstractEntity
{
/**
* Define table name
*
* @var string
*/
private $tableName = 'tx_lunas_domain_model_process';
/**
* The process names
*
* @var array
*/
private $process = [];
/**
* OrderType constructor.
*/
public function __construct()
{
$data = $this->loadAll();
$this->setProcess($data);
}
/**
* Get the table name
*
* @return string
*/
public function getTableName()
{
return $this->tableName;
}
/**
* Sets the process names
*
* @param $process
*/
public function setProcess($process)
{
$this->process = $process;
}
/**
* Gets the process
*/
public function getProcess(): array
{
return $this->process;
}
/**
* Retrieve process name by its ID
*
* @param $processId
*
* @return string
*/
public function getProcessById($processId): string
{
$result = isset($this->process[$processId]) ? $this->process[$processId] : '';
return (string)$result;
}
/**
* Loads and returns all order document processes
*
* @return array
*/
public function loadAll(): array
{
// Pre-set variables
$data = [];
// Build query
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($this->tableName);
$queryBuilder->getRestrictions()->removeAll();
$queryBuilder->select('*')->from($this->tableName);
// Read and load groups
$result = $queryBuilder->execute()->fetchAll();
foreach($result as $row) {
$data[$row['uid']] = $row['title'];
}
// Return the data array
return $data;
}
}
<?php
namespace Lu\LuNas\Domain\Model;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
/**
* Class Tag
*
* @author Dainis Abols <dainis.abols@lu.lv>
* @owner University of Latvia
* @since 01.11.2021
*
* @package Lu\LuNas\Domain\Model
*/
class Tag extends AbstractEntity
{
/**
* Define table name
*
* @var string
*/
private $tableName = 'tx_lunas_domain_model_tags';
/**
* The tag names
*
* @var array
*/
private $tag = [];
/**
* OrderType constructor.
*/
public function __construct()
{
$data = $this->loadAll();
$this->setTag($data);
}
/**
* Get the table name
*
* @return string
*/
public function getTableName()
{
return $this->tableName;
}
/**
* Sets the tag names
*
* @param $tag
*/
public function setTag($tag)
{
$this->tag = $tag;
}
/**
* Gets the tag
*/
public function getTag(): array
{
return $this->tag;
}
/**
* Retrieve tag name by its ID
*
* @param $tagIds
*
* @return array
*/
public function getTagNamesById($tagIds): array
{
$tags = explode(",", $tagIds);
$result = [];
foreach($tags as $tagId) {
$tagName = isset($this->tag[$tagId]) ? $this->tag[$tagId] : '';
if ($tagName && strlen($tagName) > 1) {
$result[] = trim($tagName);
}
}
return $result;
}
/**
* Loads and returns all order document tags
*
* @return array
*/
public function loadAll(): array
{
// Pre-set variables
$data = [];
// Build query
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($this->tableName);
$queryBuilder->getRestrictions()->removeAll();
$queryBuilder->select('*')->from($this->tableName);
// Read and load groups
$result = $queryBuilder->execute()->fetchAll();
foreach($result as $row) {
$data[$row['uid']] = $row['title'];
}
// Return the data array
return $data;
}
}
...@@ -67,7 +67,6 @@ return [ ...@@ -67,7 +67,6 @@ return [
], ],
], ],
'archived' => [ 'archived' => [
'exclude' => true, 'exclude' => true,
'l10n_mode' => 'mergeIfNotBlank', 'l10n_mode' => 'mergeIfNotBlank',
...@@ -141,6 +140,20 @@ return [ ...@@ -141,6 +140,20 @@ return [
], ],
], ],
'process_id' => [
'exclude' => true,
'label' => 'LLL:EXT:lu_nas/Resources/Private/Language/locallang.xlf:document.process',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'minitems' => 0,
'maxitems' => 1,
'foreign_table' => 'tx_lunas_domain_model_process',
'foreign_table_where' => 'ORDER BY tx_lunas_domain_model_process.title ASC',
'items' => [['', '',]],
],
],
'filename_lv' => [ 'filename_lv' => [
'exclude' => 1, 'exclude' => 1,
'label' => 'LLL:EXT:lu_nas/Resources/Private/Language/locallang.xlf:document.filename_lv', 'label' => 'LLL:EXT:lu_nas/Resources/Private/Language/locallang.xlf:document.filename_lv',
...@@ -251,7 +264,7 @@ return [ ...@@ -251,7 +264,7 @@ return [
'showitem' => 'number, date_accepted, date_archived, archived', 'showitem' => 'number, date_accepted, date_archived, archived',
], ],
'group-2' => [ 'group-2' => [
'showitem' => 'order_doc_id, document_type_id, issuer_id, status_id', 'showitem' => 'order_doc_id, document_type_id, issuer_id, status_id, process_id',
], ],
'filenames' => [ 'filenames' => [
'showitem' => 'filename_lv, filename_en', 'showitem' => 'filename_lv, filename_en',
......
<?php
return [
'ctrl' => [
'title' => 'LLL:EXT:lu_nas/Resources/Private/Language/locallang.xlf:process.title',
'label' => 'title',
'typeicon_classes' => [
'default' => 'lunas-process',
],
'security' => [
'ignoreWebMountRestriction' => 1,
'ignoreRootLevelRestriction' => 1,
],
'rootLevel' => -1,
],
'columns' => [
'title' => [
'exclude' => true,
'label' => 'LLL:EXT:lu_nas/Resources/Private/Language/locallang.xlf:process.title',
'config' => [
'type' => 'input',
'eval' => 'trim,required',
'size' => 16,
'default' => '',
],
],
],
'types' => [
'0' => ['showitem' => 'title'],
],
];
...@@ -5,7 +5,7 @@ return [ ...@@ -5,7 +5,7 @@ return [
'title' => 'LLL:EXT:lu_nas/Resources/Private/Language/locallang.xlf:tags.title', 'title' => 'LLL:EXT:lu_nas/Resources/Private/Language/locallang.xlf:tags.title',
'label' => 'title', 'label' => 'title',
'typeicon_classes' => [ 'typeicon_classes' => [
'default' => 'actions-tag', 'default' => 'lunas-tag',
], ],
'security' => [ 'security' => [
'ignoreWebMountRestriction' => 1, 'ignoreWebMountRestriction' => 1,
......
...@@ -29,6 +29,12 @@ ...@@ -29,6 +29,12 @@
<trans-unit id="document.document_ordertype"> <trans-unit id="document.document_ordertype">
<source><![CDATA[Rīkojuma dokumenta veids]]></source> <source><![CDATA[Rīkojuma dokumenta veids]]></source>
</trans-unit> </trans-unit>
<trans-unit id="document.tag">
<source><![CDATA[Atslēgvārdi]]></source>
</trans-unit>
<trans-unit id="document.process">
<source><![CDATA[Process]]></source>
</trans-unit>
<trans-unit id="document.document_type"> <trans-unit id="document.document_type">
<source><![CDATA[Dokumenta tips]]></source> <source><![CDATA[Dokumenta tips]]></source>
</trans-unit> </trans-unit>
...@@ -42,7 +48,7 @@ ...@@ -42,7 +48,7 @@
<source><![CDATA[Dokumenta izdevējs]]></source> <source><![CDATA[Dokumenta izdevējs]]></source>
</trans-unit> </trans-unit>
<trans-unit id="document.name"> <trans-unit id="document.name">
<source><![CDATA[LU NAS]]></source> <source><![CDATA[NAS Dokuments]]></source>
</trans-unit> </trans-unit>
<trans-unit id="document.none_found"> <trans-unit id="document.none_found">
<source><![CDATA[Pēc izvēlētiem meklēšanas kritērijiem netika atrasts neviens dokuments]]></source> <source><![CDATA[Pēc izvēlētiem meklēšanas kritērijiem netika atrasts neviens dokuments]]></source>
...@@ -83,6 +89,12 @@ ...@@ -83,6 +89,12 @@
<trans-unit id="facet.rikojuma_dokum"> <trans-unit id="facet.rikojuma_dokum">
<source><![CDATA[Rīkojuma dokumenta tips]]></source> <source><![CDATA[Rīkojuma dokumenta tips]]></source>
</trans-unit> </trans-unit>
<trans-unit id="facet.tag">
<source><![CDATA[Atslēgvārdi]]></source>
</trans-unit>
<trans-unit id="facet.process">
<source><![CDATA[Process]]></source>
</trans-unit>
<trans-unit id="form.acceptedDate"> <trans-unit id="form.acceptedDate">
<source><![CDATA[Pieņemšanas datums]]></source> <source><![CDATA[Pieņemšanas datums]]></source>
</trans-unit> </trans-unit>
...@@ -114,7 +126,7 @@ ...@@ -114,7 +126,7 @@
<source><![CDATA[Meklēt]]></source> <source><![CDATA[Meklēt]]></source>
</trans-unit> </trans-unit>
<trans-unit id="form.archived"> <trans-unit id="form.archived">
<source><![CDATA[Rādīt arhivētos]]></source> <source><![CDATA[Rādīt tikai arhivētos]]></source>
</trans-unit> </trans-unit>
<trans-unit id="form.status"> <trans-unit id="form.status">
<source><![CDATA[Statuss]]></source> <source><![CDATA[Statuss]]></source>
...@@ -129,13 +141,13 @@ ...@@ -129,13 +141,13 @@
<source><![CDATA[Rādīt skatītākos dokumentus]]></source> <source><![CDATA[Rādīt skatītākos dokumentus]]></source>
</trans-unit> </trans-unit>
<trans-unit id="issuer.title"> <trans-unit id="issuer.title">
<source><![CDATA[LU NAS Izdevējs]]></source> <source><![CDATA[NAS Izdevējs]]></source>
</trans-unit> </trans-unit>
<trans-unit id="ordertype.title"> <trans-unit id="ordertype.title">
<source><![CDATA[LU NAS Rīkojuma dokuments]]></source> <source><![CDATA[NAS Rīkojuma dokuments]]></source>
</trans-unit> </trans-unit>
<trans-unit id="status.title"> <trans-unit id="status.title">
<source><![CDATA[LU NAS Statuss]]></source> <source><![CDATA[NAS Statuss]]></source>
</trans-unit> </trans-unit>
<trans-unit id="sync.description"> <trans-unit id="sync.description">
<source><![CDATA[Meklētāja dati tiek sinhrinizēti, tas var prasīt līdz 10 minūtēm]]></source> <source><![CDATA[Meklētāja dati tiek sinhrinizēti, tas var prasīt līdz 10 minūtēm]]></source>
...@@ -150,10 +162,13 @@ ...@@ -150,10 +162,13 @@
<source><![CDATA[Nosaukums]]></source> <source><![CDATA[Nosaukums]]></source>
</trans-unit> </trans-unit>
<trans-unit id="type.title"> <trans-unit id="type.title">
<source><![CDATA[LU NAS Veids]]></source> <source><![CDATA[NAS Veids]]></source>
</trans-unit> </trans-unit>
<trans-unit id="tags.title"> <trans-unit id="tags.title">
<source><![CDATA[Tagi]]></source> <source><![CDATA[NAS Atslēgvārdi]]></source>
</trans-unit>
<trans-unit id="process.title">
<source><![CDATA[NAS Process]]></source>
</trans-unit> </trans-unit>
<trans-unit id="dateFormat"> <trans-unit id="dateFormat">
<source><![CDATA[d.m.Y]]></source> <source><![CDATA[d.m.Y]]></source>
......
...@@ -33,6 +33,14 @@ ...@@ -33,6 +33,14 @@
<source><![CDATA[Arhivēts]]></source> <source><![CDATA[Arhivēts]]></source>
<target><![CDATA[Arhivēts]]></target> <target><![CDATA[Arhivēts]]></target>
</trans-unit> </trans-unit>
<trans-unit id="document.tag">
<source><![CDATA[Atslēgvārdi]]></source>
<target><![CDATA[Atslēgvārdi]]></target>
</trans-unit>
<trans-unit id="document.process">
<source><![CDATA[Process]]></source>
<target><![CDATA[Process]]></target>
</trans-unit>
<trans-unit id="document.document_type" approved="yes"> <trans-unit id="document.document_type" approved="yes">
<source><![CDATA[Dokumenta tips]]></source> <source><![CDATA[Dokumenta tips]]></source>
<target><![CDATA[Dokumenta tips]]></target> <target><![CDATA[Dokumenta tips]]></target>
...@@ -50,8 +58,8 @@ ...@@ -50,8 +58,8 @@
<target><![CDATA[Dokumenta izdevējs]]></target> <target><![CDATA[Dokumenta izdevējs]]></target>
</trans-unit> </trans-unit>
<trans-unit id="document.name" approved="yes"> <trans-unit id="document.name" approved="yes">
<source><![CDATA[LU NAS]]></source> <source><![CDATA[NAS Dokuments]]></source>
<target><![CDATA[LU NAS]]></target> <target><![CDATA[NAS Dokuments]]></target>
</trans-unit> </trans-unit>
<trans-unit id="document.none_found" approved="yes"> <trans-unit id="document.none_found" approved="yes">
<source><![CDATA[Pēc izvēlētiem meklēšanas kritērijiem netika atrasts neviens dokuments]]></source> <source><![CDATA[Pēc izvēlētiem meklēšanas kritērijiem netika atrasts neviens dokuments]]></source>
...@@ -101,6 +109,14 @@ ...@@ -101,6 +109,14 @@
<source><![CDATA[Izdevējs]]></source> <source><![CDATA[Izdevējs]]></source>
<target><![CDATA[Izdevējs]]></target> <target><![CDATA[Izdevējs]]></target>
</trans-unit> </trans-unit>
<trans-unit id="facet.tag">
<source><![CDATA[Atslēgvārdi]]></source>
<target><![CDATA[Atslēgvārdi]]></target>
</trans-unit>
<trans-unit id="facet.process">
<source><![CDATA[Process]]></source>
<target><![CDATA[Process]]></target>
</trans-unit>
<trans-unit id="facet.rikojuma_dokum" approved="yes"> <trans-unit id="facet.rikojuma_dokum" approved="yes">
<source><![CDATA[Rīkojuma dokumenta tips]]></source> <source><![CDATA[Rīkojuma dokumenta tips]]></source>
<target><![CDATA[Rīkojuma dokumenta tips]]></target> <target><![CDATA[Rīkojuma dokumenta tips]]></target>
...@@ -146,8 +162,8 @@ ...@@ -146,8 +162,8 @@
<target><![CDATA[Statuss]]></target> <target><![CDATA[Statuss]]></target>
</trans-unit> </trans-unit>
<trans-unit id="form.arcived" approved="yes"> <trans-unit id="form.arcived" approved="yes">
<source><![CDATA[Rādīt arhivētos]]></source> <source><![CDATA[Rādīt tikai arhivētos]]></source>
<target><![CDATA[Rādīt arhivētos]]></target> <target><![CDATA[Rādīt tikai arhivētos]]></target>
</trans-unit> </trans-unit>
<trans-unit id="form.study_guide" approved="yes"> <trans-unit id="form.study_guide" approved="yes">
<source><![CDATA[Studiju ceļvedis]]></source> <source><![CDATA[Studiju ceļvedis]]></source>
...@@ -162,16 +178,16 @@ ...@@ -162,16 +178,16 @@
<target><![CDATA[Rādīt skatītākos dokumentus]]></target> <target><![CDATA[Rādīt skatītākos dokumentus]]></target>
</trans-unit> </trans-unit>
<trans-unit id="issuer.title" approved="yes"> <trans-unit id="issuer.title" approved="yes">
<source><![CDATA[LU NAS Izdevējs]]></source> <source><![CDATA[NAS Izdevējs]]></source>
<target><![CDATA[LU NAS Izdevējs]]></target> <target><![CDATA[NAS Izdevējs]]></target>
</trans-unit> </trans-unit>
<trans-unit id="ordertype.title" approved="yes"> <trans-unit id="ordertype.title" approved="yes">
<source><![CDATA[LU NAS Rīkojuma dokuments]]></source> <source><![CDATA[NAS Rīkojuma dokuments]]></source>
<target><![CDATA[LU NAS Rīkojuma dokuments]]></target> <target><![CDATA[NAS Rīkojuma dokuments]]></target>
</trans-unit> </trans-unit>