Commit 630b4feb authored by Arnaud Pauget's avatar Arnaud Pauget
Browse files

Merge branch 'Support/2.7.X' into 'master'

Support/2.7.x

See merge request !653
parents e24d5cdd 429f9ddc
Pipeline #11882 failed with stages
in 42 seconds
# CHANGELOG
## Version 2.7.3
- `Fixed` Actualisation lors du changement d'organisation après connexion.
- `Added` Prise en compte de l'ajout d'une référence à une archive parente lors du versement d'un bordereau MADES.
- `Fixed` Erreur lors de la consultation des statistiques.
- `Fixed` Amélioration des performances du chargement des dossiers virtuels sur l'écran principal.
## Version 2.7.2
- `Added` Tri des dossiers virtuels par ordre alphabétique.
- `Added` Affichage des champs de référence externe dans la liste des données descriptives.
......
2.7.2
\ No newline at end of file
2.7.3
\ No newline at end of file
......@@ -1667,9 +1667,8 @@ trait laabsModelTrait
}
}
} else {
return static::buildBranch($objects, null, $refField, $keyField, $childListProperty);
return static::buildTree2($objects, $refField, $keyField, $childListProperty);
}
}
protected static function buildBranch(array &$objects, $parentId, $idProperty, $parentIdProperty, $childListProperty)
......@@ -1689,6 +1688,35 @@ trait laabsModelTrait
return $branch;
}
protected static function buildTree2(array &$objects, $idProperty, $parentIdProperty, $childListProperty)
{
$tree = [];
// Create an associative array with each key being the ID of the item
foreach ($objects as $object) {
$tree[(string) $object->{$idProperty}] = $object;
}
// Loop over the array and add each child to their parent
foreach ($tree as $id => $object) {
if (empty($object->{$parentIdProperty})) {
continue;
}
$tree[$object->{$parentIdProperty}]->{$childListProperty}[] = $object;
}
// Loop over the array again and remove any items that don't have a parent of 0;
foreach ($tree as $id => $object) {
if (empty($object->{$parentIdProperty})) {
continue;
}
unset($tree[$id]);
}
return $tree;
}
/**
* Adds the canonical path of objects in tree
* @param array $objects The tree roots or branches
......
......@@ -44,6 +44,7 @@ class Document extends \dependency\xml\Document
public $translator;
public $dateTimeFormatter;
public $pluginsParameters = [];
public $fragments = [];
/**
* -- document --
* <html>
......@@ -101,7 +102,6 @@ class Document extends \dependency\xml\Document
$container = $this->createElement('div');
$this->appendChild($container);
}
}
/**
......@@ -345,8 +345,8 @@ class Document extends \dependency\xml\Document
*/
public function addContent($content, $container = false)
{
$contentFragment = $this->createDocumentFragment();
$contentFragment->appendHtml($content);
$contentFragment = $this->addFragment($content);
if (!$container) {
$container = $this->getContainer();
}
......@@ -363,8 +363,7 @@ class Document extends \dependency\xml\Document
*/
public function addContentFile($contentResource, $container = false)
{
$contentFragment = $this->createDocumentFragment();
$contentFragment->appendHtmlFile($contentResource);
$contentFragment = $this->addFragmentFile($contentResource);
if (!$container) {
$container = $this->getContainer();
......@@ -386,6 +385,36 @@ class Document extends \dependency\xml\Document
}
}
/**
* Adds a fragment to the document, without including it to the dom tree
* @param string $content
* @return DOMDocumentFragment
*/
public function addFragment($contents)
{
$contentFragment = $this->createDocumentFragment();
$contentFragment->appendHtml($contents);
$this->fragments[crc32($contents)] = $contentFragment;
return $contentFragment;
}
/**
* Adds a fragment to the document, without including it to the dom tree
* @param string $contentResource
* @return DOMDocumentFragment
*/
public function addFragmentFile($contentResource)
{
$contentFragment = $this->createDocumentFragment();
$contentFragment->appendHtmlFile($contentResource);
$this->fragments[$contentResource] = $contentFragment;
return $contentFragment;
}
/*************************************************************************/
/* HTML plugins management
/*************************************************************************/
......
......@@ -63,7 +63,10 @@ trait LocalisationTrait
public function translate($node=null, $catalog=false)
{
if (!$node) {
$node = $this->documentElement;
$this->translate($this->documentElement);
foreach ($this->fragments as $id => $fragment) {
$this->translate($fragment);
}
}
if ($catalog) {
......
......@@ -307,14 +307,17 @@ trait TemplateTrait
if (isset($params['include'])) {
$res = $params['include'];
$targetNode = $this->createDocumentFragment();
if (pathinfo($res, PATHINFO_EXTENSION) == 'xml') {
$targetNode->appendFile($res);
if (isset($this->fragments[$res])) {
$targetNode = $this->fragments[$res];
} else {
$targetNode->appendHtmlFile($res);
}
$targetNode = $this->createDocumentFragment();
if (pathinfo($res, PATHINFO_EXTENSION) == 'xml') {
$targetNode->appendFile($res);
} else {
$targetNode->appendHtmlFile($res);
}
}
} elseif (!$targetNode = $this->XPath->query("following-sibling::*", $pi)->item(0)) {
return true;
}
......
......@@ -719,7 +719,7 @@ EOT;
ON "organization"."registrationNumber" = "event"."eventInfo"::json->>6';
}
$query = 'SELECT '.($groupBy ? $selectCondition . ' AS "'.$groupBy.'", ' : '').'SUM(CAST("event"."eventInfo"::json->>'.$jsonSizeColumnNumber.' AS INTEGER))
$query = 'SELECT '.($groupBy ? $selectCondition . ' AS "'.$groupBy.'", ' : '').'SUM(CAST(COALESCE(NULLIF("event"."eventInfo"::json->>'.$jsonSizeColumnNumber.', \'\'), \'0\') AS INTEGER))
FROM "lifeCycle"."event" "event"'.
($groupBy ? $joinCondition : '').'
WHERE "event"."eventType" IN (\''.$eventType.'\')
......
......@@ -450,7 +450,7 @@ class ArchiveTransfer extends abstractMessage implements \bundle\medona\Controll
protected function validateFilingContainer($archiveUnit)
{
$containerArchive = $archiveController->read($archiveUnit->filing->container);
$containerArchive = $this->archiveController->read($archiveUnit->filing->container);
// Check level in file plan
if ($containerArchive->fileplanLevel == 'item') {
......@@ -724,6 +724,9 @@ class ArchiveTransfer extends abstractMessage implements \bundle\medona\Controll
if (isset($archiveUnit->filing->folder)) {
$archive->filePlanPosition = $archiveUnit->filing->folder;
}
if (isset($archiveUnit->filing->container)) {
$archive->parentArchiveId = $archiveUnit->filing->container;
}
}
protected function processBinaryDataObjects($archive, $dataObjectReferences, $message)
......
......@@ -98,8 +98,15 @@ class csrf
*/
public function setResponseToken(&$response)
{
$this->getAccountId();
// Do not process base uri or whitelisted URIs
if (empty(\laabs::kernel()->request->uri) || in_array(\laabs::kernel()->request->uri, $this->whiteList)) {
if ((
empty(\laabs::kernel()->request->uri)
|| in_array(\laabs::kernel()->request->uri, $this->whiteList)
)
&& (empty($this->accountId))
) {
return;
}
......@@ -129,7 +136,7 @@ class csrf
// Save auth information to user account
$this->updateAccount();
\laabs::setToken(strtoupper($this->config["cookieName"]), $responseToken, null, false);
}
......
......@@ -63,6 +63,7 @@ class welcome
$this->view->setSource('datePickerParams', $datePickerPlugin->saveParameters());
$this->view->addContentFile("dashboard/mainScreen/main.html");
$this->view->addFragmentFile("filePlan/folderNode.html");
$this->view->translate();
......@@ -86,7 +87,6 @@ class welcome
$this->view->setSource("filePlan", $filePlan);
$this->view->setSource("filePlanPrivileges", $filePlanPrivileges);
$this->view->merge($this->view->getElementById('filePlanTree'));
$this->view->translate();
}
// Retention
......@@ -148,7 +148,7 @@ class welcome
$this->view->setSource('user', $user);
$this->view->setSource('locale', \laabs::configuration('dependency.localisation')['lang']);
$this->view->merge();
$this->view->translate();
return $this->view->saveHtml();
}
......
<li id="[?merge .folderId ?]" class="folder" data-path="[?merge .path ?]" data-orgregnumber="[?merge .ownerOrgRegNumber ?]" data-parentid="[?merge .parentFolderId ?]" data-description="[?merge .description ?]" data-closed="[?merge .closed.bool().then('true', 'false') ?]">
<li data-translate-catalog="filePlan/messages" id="[?merge .folderId ?]" class="folder" data-path="[?merge .path ?]" data-orgregnumber="[?merge .ownerOrgRegNumber ?]" data-parentid="[?merge .parentFolderId ?]" data-description="[?merge .description ?]" data-closed="[?merge .closed.bool().then('true', 'false') ?]">
<span class="folderNode" title="[?merge .name ?]">
<i class="fa" data-opened-icon="fa-caret-down" data-closed-icon="fa-caret-right" data-default-icon="">&nbsp;</i>
<b data-translate="no">
......
......@@ -20,7 +20,7 @@ var BootstrapTree = {
// $(this).next().find("i").addClass("fa-folder").removeClass("fa-folder-o");
});
$('.parent_li').find(' > ul > li').hide();
$('.parent_li').find(' > ul > li').css({'display':'none'});
tree.find('li')
.not('.parent_li')
......@@ -71,7 +71,7 @@ var BootstrapTree = {
if (openNode || openNode == undefined) {
this.openNode(parent);
} else {
element.hide();
element.css({'display':'none'});
}
}
},
......@@ -102,7 +102,7 @@ var BootstrapTree = {
var closedIcon = i.data('closed-icon');
if (!i.hasClass(openedIcon) && children.length) {
children.show('fast');
children.css({'display':'block'});
i.addClass(openedIcon).removeClass(closedIcon);
}
},
......
Markdown is supported
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