Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Maarch
maarchRM
Commits
4cbe2e3a
Unverified
Commit
4cbe2e3a
authored
Jul 22, 2020
by
Jerome Boucher
Browse files
fix/14312 : add count with max results on default search view
parent
ff76edf9
Pipeline
#8800
canceled with stage
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/bundle/recordsManagement/Controller/archiveAccessTrait.php
View file @
4cbe2e3a
...
...
@@ -2,18 +2,18 @@
/*
* Copyright (C) 2017 Maarch
*
*
* This file is part of bundle XXXX.
* Bundle recordsManagement is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* Bundle recordsManagement is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with bundle recordsManagement. If not, see <http://www.gnu.org/licenses/>.
*/
...
...
@@ -89,6 +89,155 @@ trait archiveAccessTrait
$archives
=
[];
list
(
$searchClasses
,
$archiveArgs
)
=
$this
->
getClassesAndArchiveArgsForSearch
(
$archiveId
,
$profileReference
,
$status
,
$archiveName
,
$agreementReference
,
$archiveExpired
,
$finalDisposition
,
$originatorOrgRegNumber
,
$originatorOwnerOrgId
,
$originatorArchiveId
,
$originatingDate
,
$filePlanPosition
,
$hasParent
,
$partialRetentionRule
,
$retentionRuleCode
,
$depositStartDate
,
$depositEndDate
,
$originatingStartDate
,
$originatingEndDate
,
$archiverArchiveId
,
$processingStatus
);
foreach
(
$searchClasses
as
$descriptionClass
=>
$descriptionController
)
{
$archives
=
array_merge
(
$archives
,
$descriptionController
->
search
(
$description
,
$text
,
$archiveArgs
,
$checkAccess
,
$maxResults
));
}
return
$archives
;
}
/**
* Count archives by profile / dates / agreement
*
* @param string $archiveId
* @param string $profileReference
* @param string $status
* @param string $archiveName
* @param string $agreementReference
* @param string $archiveExpired
* @param string $finalDisposition
* @param string $originatorOrgRegNumber
* @param string $originatorOwnerOrgId
* @param string $originatorArchiveId
* @param array $originatingDate
* @param string $filePlanPosition
* @param bool $hasParent
* @param string $description
* @param string $text
* @param bool $partialRetentionRule
* @param string $retentionRuleCode
* @param string $depositStartDate
* @param string $depositEndDate
* @param string $originatingStartDate
* @param string $originatingEndDate
* @param string $archiverArchiveId
* @param string $processingStatus
* @param bool $checkAccess
* @param integer $maxResults
*
* @return integer $count Count of archives from search
*/
public
function
count
(
$archiveId
=
null
,
$profileReference
=
null
,
$status
=
null
,
$archiveName
=
null
,
$agreementReference
=
null
,
$archiveExpired
=
null
,
$finalDisposition
=
null
,
$originatorOrgRegNumber
=
null
,
$originatorOwnerOrgId
=
null
,
$originatorArchiveId
=
null
,
$originatingDate
=
null
,
$filePlanPosition
=
null
,
$hasParent
=
null
,
$description
=
null
,
$text
=
null
,
$partialRetentionRule
=
null
,
$retentionRuleCode
=
null
,
$depositStartDate
=
null
,
$depositEndDate
=
null
,
$originatingStartDate
=
null
,
$originatingEndDate
=
null
,
$archiverArchiveId
=
null
,
$processingStatus
=
null
,
$checkAccess
=
true
,
$maxResults
=
null
)
{
$accountController
=
\
laabs
::
newController
(
'auth/userAccount'
);
$accountController
->
isAuthorized
(
'user'
);
$archives
=
[];
list
(
$searchClasses
,
$archiveArgs
)
=
$this
->
getClassesAndArchiveArgsForSearch
(
$archiveId
,
$profileReference
,
$status
,
$archiveName
,
$agreementReference
,
$archiveExpired
,
$finalDisposition
,
$originatorOrgRegNumber
,
$originatorOwnerOrgId
,
$originatorArchiveId
,
$originatingDate
,
$filePlanPosition
,
$hasParent
,
$partialRetentionRule
,
$retentionRuleCode
,
$depositStartDate
,
$depositEndDate
,
$originatingStartDate
,
$originatingEndDate
,
$archiverArchiveId
,
$processingStatus
);
$count
=
0
;
foreach
(
$searchClasses
as
$descriptionClass
=>
$descriptionController
)
{
$count
+=
$descriptionController
->
count
(
$description
,
$text
,
$archiveArgs
,
$checkAccess
,
$maxResults
);
}
return
$count
;
}
protected
function
getClassesAndArchiveArgsForSearch
(
$archiveId
=
null
,
$profileReference
=
null
,
$status
=
null
,
$archiveName
=
null
,
$agreementReference
=
null
,
$archiveExpired
=
null
,
$finalDisposition
=
null
,
$originatorOrgRegNumber
=
null
,
$originatorOwnerOrgId
=
null
,
$originatorArchiveId
=
null
,
$originatingDate
=
null
,
$filePlanPosition
=
null
,
$hasParent
=
null
,
$partialRetentionRule
=
null
,
$retentionRuleCode
=
null
,
$depositStartDate
=
null
,
$depositEndDate
=
null
,
$originatingStartDate
=
null
,
$originatingEndDate
=
null
,
$archiverArchiveId
=
null
,
$processingStatus
=
null
)
{
$archiveArgs
=
[
'archiveId'
=>
$archiveId
,
'profileReference'
=>
$profileReference
,
...
...
@@ -136,13 +285,8 @@ trait archiveAccessTrait
}
}
foreach
(
$searchClasses
as
$descriptionClass
=>
$descriptionController
)
{
$archives
=
array_merge
(
$archives
,
$descriptionController
->
search
(
$description
,
$text
,
$archiveArgs
,
$checkAccess
,
$maxResults
));
}
return
$archives
;
return
[
$searchClasses
,
$archiveArgs
];
}
/**
* Search archives by profile / dates / agreement
* @param string $archiveId
...
...
@@ -276,8 +420,8 @@ trait archiveAccessTrait
}
if
(
$partialRetentionRule
)
{
$queryParts
[
'partialRetentionRule'
]
=
"(retentionDuration=NULL
OR retentionStartDate=NULL
$queryParts
[
'partialRetentionRule'
]
=
"(retentionDuration=NULL
OR retentionStartDate=NULL
OR retentionRuleCode=NULL)"
;
}
...
...
@@ -392,7 +536,7 @@ trait archiveAccessTrait
*
* @return integer $count
*/
public
function
count
(
$originatorOrgRegNumber
,
$filePlanPosition
=
null
,
$archiveUnit
=
false
)
public
function
count
List
(
$originatorOrgRegNumber
,
$filePlanPosition
=
null
,
$archiveUnit
=
false
)
{
list
(
$queryString
,
$queryParams
)
=
$this
->
getQueryStringAndParams
(
$originatorOrgRegNumber
,
$filePlanPosition
,
$archiveUnit
);
$count
=
$this
->
sdoFactory
->
count
(
'recordsManagement/archive'
,
$queryString
,
$queryParams
);
...
...
@@ -430,7 +574,7 @@ trait archiveAccessTrait
* Get the related information of an archive
* @param string $archiveId The identifier of the archive or the archive itself
* @param bool $checkAccess Check access for originator or archiver. if false, caller MUST control access before or after
*
*
* @return recordsManagement/archive
*/
public
function
getRelatedInformation
(
$archiveId
,
$checkAccess
=
true
)
...
...
@@ -466,9 +610,9 @@ trait archiveAccessTrait
}
else
{
$archive
=
$archiveId
;
}
$archive
->
digitalResources
=
$this
->
getDigitalResources
(
$archive
->
archiveId
,
$checkAccess
);
if
(
$archive
->
digitalResources
)
{
if
(
$loadBinary
)
{
foreach
(
$archive
->
digitalResources
as
$i
=>
$digitalResource
)
{
...
...
@@ -481,18 +625,18 @@ trait archiveAccessTrait
}
}
}
$archive
->
contents
=
$this
->
sdoFactory
->
find
(
"recordsManagement/archive"
,
"parentArchiveId='"
.
(
string
)
$archive
->
archiveId
.
"'"
);
if
(
$archive
->
contents
)
{
foreach
(
$archive
->
contents
as
$child
)
{
$this
->
listChildrenArchive
(
$child
,
$loadResourcesInfo
,
$loadBinary
,
$checkAccess
);
}
}
return
$archive
;
}
...
...
@@ -517,7 +661,7 @@ trait archiveAccessTrait
* Retrieve an archive resource contents
* @param string $archiveId The archive identifier
* @param bool $checkAccess Check access for originator or archiver. if false, caller MUST control access before or after
*
*
* @return digitalResource/digitalResource[] Array of digitalResource/digitalResource object
*/
public
function
getDigitalResources
(
$archiveId
,
$checkAccess
=
true
)
...
...
@@ -537,7 +681,7 @@ trait archiveAccessTrait
* @param string $archiveId The archive identifier
* @param string $resId The resource identifier
* @param bool $checkAccess Check access for originator or archiver. if false, caller MUST control access before or after
*
*
* @return digitalResource/digitalResource Archive resource contents
*/
public
function
consultation
(
$archiveId
,
$resId
,
$checkAccess
=
true
,
$isCommunication
=
false
)
...
...
@@ -617,17 +761,17 @@ trait archiveAccessTrait
}
else
{
$archive
=
$archiveId
;
}
if
(
$isCommunication
)
{
$this
->
checkRights
(
$archive
,
$isCommunication
);
$checkAccess
=
false
;
}
else
{
$this
->
checkRights
(
$archive
);
}
$this
->
getMetadata
(
$archive
,
$checkAccess
);
$archive
->
originatorOrg
=
$this
->
organizationController
->
getOrgByRegNumber
(
$archive
->
originatorOrgRegNumber
);
if
(
!
empty
(
$archive
->
archiverOrgRegNumber
))
{
$archive
->
archiverOrg
=
$this
->
organizationController
->
getOrgByRegNumber
(
$archive
->
archiverOrgRegNumber
);
}
...
...
@@ -636,7 +780,7 @@ trait archiveAccessTrait
}
$this
->
getRelatedInformation
(
$archive
,
$checkAccess
);
$this
->
listChildrenArchive
(
$archive
,
true
,
$withBinary
,
$checkAccess
);
$this
->
getParentArchive
(
$archive
);
if
(
!
empty
(
$archive
->
contents
))
{
...
...
@@ -800,8 +944,8 @@ trait archiveAccessTrait
}
if
(
!
empty
(
$args
[
'partialRetentionRule'
])
&&
$args
[
'partialRetentionRule'
]
==
"true"
)
{
$queryParts
[
'partialRetentionRule'
]
=
"(
retentionDuration=NULL
OR retentionStartDate=NULL
retentionDuration=NULL
OR retentionStartDate=NULL
OR retentionRuleCode=NULL
)"
;
}
...
...
@@ -879,7 +1023,7 @@ trait archiveAccessTrait
$queryParts
[
'hasParent'
]
=
"parentArchiveId=null"
;
}
}
if
(
isset
(
$args
[
'processingStatus'
]))
{
if
(
$args
[
'processingStatus'
]
===
true
)
{
$queryParts
[
'processingStatus'
]
=
"processingStatus!=null"
;
...
...
@@ -1140,7 +1284,7 @@ trait archiveAccessTrait
$userPositionController
=
\
laabs
::
newController
(
'organization/userPosition'
);
$userServices
=
array_values
(
$userPositionController
->
readDescandantService
(
$currentUserService
->
orgId
));
$userServices
[]
=
$currentUserService
->
registrationNumber
;
// OWNER access
if
(
!
is_null
(
$currentUserService
->
orgRoleCodes
)
&&
\
laabs\in_array
(
'owner'
,
$currentUserService
->
orgRoleCodes
))
{
...
...
src/bundle/recordsManagement/Controller/description.php
View file @
4cbe2e3a
...
...
@@ -136,6 +136,25 @@ class description implements \bundle\recordsManagement\Controller\archiveDescrip
*/
public
function
search
(
$description
=
null
,
$text
=
null
,
array
$archiveArgs
=
[],
$checkAccess
=
true
,
$maxResults
=
null
)
{
list
(
$queryString
,
$queryParams
)
=
$this
->
getQueryStringAndParams
(
$description
,
$text
,
$archiveArgs
,
$checkAccess
);
$archiveUnits
=
$this
->
sdoFactory
->
find
(
'recordsManagement/archiveUnit'
,
$queryString
,
$queryParams
,
false
,
false
,
$maxResults
);
foreach
(
$archiveUnits
as
$archiveUnit
)
{
if
(
!
empty
(
$archiveUnit
->
description
))
{
$archiveUnit
->
descriptionObject
=
json_decode
(
$archiveUnit
->
description
);
}
}
return
$archiveUnits
;
}
protected
function
getQueryStringAndParams
(
$description
=
null
,
$text
=
null
,
array
$archiveArgs
=
[],
$checkAccess
=
true
)
{
$queryParams
=
[];
$queryParts
=
[
'(description!=null and text!=null)'
];
...
...
@@ -204,22 +223,32 @@ class description implements \bundle\recordsManagement\Controller\archiveDescrip
$queryString
=
\
laabs\implode
(
' and '
,
$queryParts
);
$archiveUnits
=
$this
->
sdoFactory
->
find
(
'recordsManagement/archiveUnit'
,
$queryString
,
$queryParams
,
false
,
false
,
$maxResults
);
return
[
$queryString
,
$queryParams
];
}
/**
* Count the description objects
*
* @param string $description The search args on description object
* @param string $text The search args on text
* @param array $archiveArgs The search args on archive std properties
* @param bool $checkAccess Use access control. If not, called MUST control access before or after retrieving data
*
* @return integer $count Research count
*/
public
function
count
(
$description
=
null
,
$text
=
null
,
array
$archiveArgs
=
[],
$checkAccess
=
true
)
{
list
(
$queryString
,
$queryParams
)
=
$this
->
getQueryStringAndParams
(
$description
,
$text
,
$archiveArgs
,
$checkAccess
);
foreach
(
$archiveUnits
as
$archiveUnit
)
{
if
(
!
empty
(
$archiveUnit
->
description
))
{
$archiveUnit
->
descriptionObject
=
json_decode
(
$archiveUnit
->
description
);
}
}
$count
=
$this
->
sdoFactory
->
count
(
'recordsManagement/archiveUnit'
,
$queryString
,
$queryParams
);
return
$
archiveUnits
;
return
$
count
;
}
/**
* Update the description
* @param mixed $description The description object
* @param string $archiveId The archive identifier
*
*
* @return bool The result of the operation
*/
public
function
update
(
$archive
)
...
...
src/bundle/recordsManagement/Controller/log.php
View file @
4cbe2e3a
...
...
@@ -158,6 +158,19 @@ class log implements archiveDescriptionInterface
return
$archives
;
}
/**
* Count log objects
* @param string $description The search args on description object
* @param string $text The search args on text
* @param array $args The search args on archive std properties
*
* @return object Array of description objects
*/
public
function
count
(
$description
=
null
,
$text
=
null
,
array
$args
=
[],
$checkAccess
=
null
,
$maxResults
=
null
)
{
return
count
(
$this
->
search
(
$description
,
$text
,
$args
,
$checkAccess
,
$maxResults
=
null
);
}
/**
* Retrieve a journal by evenement date
* @param string $type The journal type
...
...
src/bundle/recordsManagement/archivesInterface.php
View file @
4cbe2e3a
...
...
@@ -85,6 +85,65 @@ interface archivesInterface
$maxResults
=
null
);
/*
RETRIEVE ARCHIVES
*/
/**
* Count archives by profile / dates / agreement
*
* @param string $archiveId
* @param string $profileReference
* @param string $status
* @param string $archiveName
* @param string $agreementReference
* @param string $archiveExpired
* @param string $finalDisposition
* @param string $originatorOrgRegNumber
* @param string $originatorOwnerOrgId
* @param string $originatorArchiveId
* @param array $originatingDate
* @param string $filePlanPosition
* @param bool $hasParent
* @param string $description
* @param string $text
* @param bool $partialRetentionRule
* @param string $retentionRuleCode
* @param string $depositStartDate
* @param string $depositEndDate
* @param string $originatingStartDate
* @param string $originatingEndDate
* @param string $archiverArchiveId
* @param integer $maxResults
*
* @action recordsManagement/archive/count
*
*/
public
function
readCount
(
$archiveId
=
null
,
$profileReference
=
null
,
$status
=
null
,
$archiveName
=
null
,
$agreementReference
=
null
,
$archiveExpired
=
null
,
$finalDisposition
=
null
,
$originatorOrgRegNumber
=
null
,
$originatorOwnerOrgId
=
null
,
$originatorArchiveId
=
null
,
$originatingDate
=
null
,
$filePlanPosition
=
null
,
$hasParent
=
null
,
$description
=
null
,
$text
=
null
,
$partialRetentionRule
=
null
,
$retentionRuleCode
=
null
,
$depositStartDate
=
null
,
$depositEndDate
=
null
,
$originatingStartDate
=
null
,
$originatingEndDate
=
null
,
$archiverArchiveId
=
null
,
$maxResults
=
null
);
/**
* Search archives by profile / dates / agreement
* @param string $archiveId
...
...
@@ -147,15 +206,15 @@ interface archivesInterface
public
function
readList
(
$originatorOrgRegNumber
,
$filePlanPosition
=
null
,
$archiveUnit
=
false
);
/**
* Get archives Count witho
t
u limit
* Get archives Count withou
t
limit
*
* @param string $originatorOrgRegNumber The organization registration number
* @param string $filePlanPosition The file plan position
* @param boolean $archiveUnit List the archive unit
*
* @action recordsManagement/archive/count
* @action recordsManagement/archive/count
List
*/
public
function
readCount
(
$originatorOrgRegNumber
,
$filePlanPosition
=
null
,
$archiveUnit
=
false
);
public
function
readCount
List
(
$originatorOrgRegNumber
,
$filePlanPosition
=
null
,
$archiveUnit
=
false
);
/*
MODIFY ARCHIVES
...
...
src/presentation/maarchRM/Presenter/recordsManagement/welcome.php
View file @
4cbe2e3a
...
...
@@ -112,11 +112,17 @@ class welcome
$depositPrivilege
=
\
laabs
::
callService
(
'auth/userAccount/readHasprivilege'
,
"archiveDeposit/deposit"
);
$maxResults
=
null
;
if
(
isset
(
\
laabs
::
configuration
(
'presentation.maarchRM'
)[
'maxResults'
]))
{
$maxResults
=
\
laabs
::
configuration
(
'presentation.maarchRM'
)[
'maxResults'
];
}
$this
->
view
->
setSource
(
"userArchivalProfiles"
,
$this
->
userArchivalProfiles
);
$this
->
view
->
setSource
(
"depositPrivilege"
,
$depositPrivilege
);
$this
->
view
->
setSource
(
"syncImportPrivilege"
,
$syncImportPrivilege
);
$this
->
view
->
setSource
(
"asyncImportPrivilege"
,
$asyncImportPrivilege
);
$this
->
view
->
setSource
(
"filePlanPrivileges"
,
$filePlanPrivileges
);
$this
->
view
->
setSource
(
"maxResults"
,
$maxResults
);
$this
->
view
->
setSource
(
'retentionRules'
,
$retentionRules
);
$this
->
view
->
setSource
(
'user'
,
$user
);
...
...
src/presentation/maarchRM/Resources/view/recordsManagement/archive/fulltextSearchForm.html
View file @
4cbe2e3a
...
...
@@ -7,6 +7,7 @@
#-->
<!-- Search field -->
<div
class=
"form-horizontal"
id=
"fullTextSearchForm"
data-translate-catalog=
"recordsManagement/message"
>
<input
type=
"hidden"
name=
"maxResults"
id =
"maxResults"
value=
"[?merge maxResults ?]"
>
<div
class=
"form-group"
>
<div
class=
"input-group"
>
<div
id=
"profileSelection"
class=
"input-group-btn"
>
...
...
@@ -252,6 +253,7 @@ FulltextSearchForm = {
serialize
:
function
()
{
var
advancedSearchPanel
=
$
(
'
#advancedSearchPanel
'
);
var
query
=
{
text
:
""
,
description
:
[],
...
...
@@ -259,7 +261,8 @@ FulltextSearchForm = {
filePlanPosition
:
this
.
form
.
data
(
'
folderid
'
),
orgRegNumber
:
this
.
form
.
data
(
'
orgregnumber
'
),
originatingStartDate
:
advancedSearchPanel
.
find
(
'
[name="originatingDateMin"]
'
).
data
(
'
datepicker
'
).
getFormattedDate
(
'
yyyy-mm-dd
'
),
originatingEndDate
:
advancedSearchPanel
.
find
(
'
[name="originatingDateMax"]
'
).
data
(
'
datepicker
'
).
getFormattedDate
(
'
yyyy-mm-dd
'
)
originatingEndDate
:
advancedSearchPanel
.
find
(
'
[name="originatingDateMax"]
'
).
data
(
'
datepicker
'
).
getFormattedDate
(
'
yyyy-mm-dd
'
),
maxResults
:
this
.
form
.
find
(
'
[name="maxResults"]
'
).
val
()
};
var
text
=
this
.
form
.
find
(
'
[name="searchForm_inputSearch"]
'
).
val
().
trim
();
...
...
@@ -377,7 +380,7 @@ FulltextSearchForm = {
},
clearForm
:
function
()
{
$
(
'
#fullTextSearchForm > inpu
t
'
).
val
(
''
);
this
.
form
.
find
(
'
input[type=search], input[type=text], input[type=number], input[type=date], selec
t
'
).
val
(
''
);
this
.
advancedSearchForm
.
find
(
'
input[type=text], input[type=number], input[type=date], select
'
).
val
(
''
);
}
}
...
...
src/presentation/maarchRM/UserStory/app/appInterface.php
View file @
4cbe2e3a
...
...
@@ -21,7 +21,7 @@ interface appInterface
* @param boolean $archiveUnit List the archive unit
*
* @uses recordsManagement/archives/readList
* @uses recordsManagement/archives/readCount
* @uses recordsManagement/archives/readCount
List
*
* @return recordsManagement/welcome/folderContents
*/
...
...
@@ -107,6 +107,7 @@ interface appInterface
* @param string $originatingEndDate
*
* @uses recordsManagement/archives/read
* @uses recordsManagement/archives/readCount
*
* @return recordsManagement/welcome/folderContents
*/
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment