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
888a9b24
Commit
888a9b24
authored
Jul 29, 2022
by
Charlotte Bataille
Browse files
fix/21614 : prevent delete used archival profile
parent
a0e05e96
Pipeline
#19744
failed with stages
in 21 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/bundle/recordsManagement/Controller/archivalProfile.php
View file @
888a9b24
...
...
@@ -359,14 +359,27 @@ class archivalProfile
*/
public
function
isUsed
(
$archivalProfile
)
{
$archivalProfileReference
=
$archivalProfile
->
reference
;
$archivalAgreementController
=
\
laabs
::
newController
(
'medona/archivalAgreement'
);
$archivalAgreement
=
$archivalAgreementController
->
getByProfileReference
(
$archivalProfile
->
reference
);
if
(
!
empty
(
$archivalAgreement
))
{
return
false
;
return
true
;
}
$archivalProfileAccessController
=
\
laabs
::
newController
(
'organization/organization'
);
$archivalProfileAccess
=
$archivalProfileAccessController
->
getArchivalProfileAccess
(
null
,
$archivalProfileReference
);
if
(
!
empty
(
$archivalProfileAccess
))
{
return
true
;
}
return
(
bool
)
$this
->
sdoFactory
->
count
(
'recordsManagement/archive'
,
"archivalProfileReference = '
$archivalProfile->reference
'"
);
if
((
bool
)
$this
->
sdoFactory
->
count
(
'recordsManagement/archivalProfileContents'
,
"containedProfileId = '
$archivalProfile->archivalProfileId
'"
))
{
return
true
;
}
if
((
bool
)
$this
->
sdoFactory
->
count
(
'recordsManagement/archive'
,
"archivalProfileReference = '
$archivalProfileReference
'"
))
{
return
true
;
}
return
false
;
}
/**
...
...
@@ -619,20 +632,4 @@ class archivalProfile
return
$archivalProfile
->
archivalProfileId
;
}
/**
* Get identifiers of used archival profiles
*
* @return recordsManagement/archivalProfile[] Array of archival profiles
*/
public
function
getUsedArchivalProfilesReference
()
{
$usedArchivalProfilesReference
=
[];
$archivalProfileUses
=
$this
->
sdoFactory
->
summarise
(
"organization/archivalProfileAccess"
,
"archivalProfileReference"
);
foreach
(
$archivalProfileUses
as
$archivalProfileReference
=>
$uses
)
{
if
((
$uses
>
0
)
&&
(
$archivalProfileReference
!=
'*'
))
{
$usedArchivalProfilesReference
[]
=
$archivalProfileReference
;
}
}
return
$usedArchivalProfilesReference
;
}
}
src/bundle/recordsManagement/archivalProfileInterface.php
View file @
888a9b24
...
...
@@ -129,11 +129,4 @@ interface archivalProfileInterface
*/
public
function
readArchivalprofileExport_profileReference_
();
/**
* Get used archival profiles
*
* @action recordsManagement/archivalProfile/getUsedArchivalProfilesReference
*/
public
function
readUsedArchivalProfiles
();
}
src/presentation/maarchRM/Presenter/recordsManagement/archivalProfile.php
View file @
888a9b24
...
...
@@ -61,7 +61,6 @@ class archivalProfile
public
function
index
()
{
$archivalProfiles
=
\
laabs
::
callService
(
'recordsManagement/archivalProfile/readIndex'
);
$usedArchivalProfilesReference
=
\
laabs
::
callService
(
'recordsManagement/archivalProfile/readUsedArchivalProfiles'
);
$this
->
view
->
addContentFile
(
'recordsManagement/archivalProfile/index.html'
);
...
...
@@ -70,12 +69,6 @@ class archivalProfile
$dataTable
->
setUnsortableColumns
(
3
);
$this
->
view
->
translate
();
foreach
(
$archivalProfiles
as
$key
=>
$archivalProfile
)
{
if
(
in_array
(
$archivalProfile
->
reference
,
$usedArchivalProfilesReference
))
{
$archivalProfile
->
used
=
true
;
}
}
$this
->
view
->
setSource
(
"profile"
,
$archivalProfiles
);
$this
->
view
->
merge
();
...
...
src/presentation/maarchRM/Resources/view/recordsManagement/archivalProfile/index.html
View file @
888a9b24
...
...
@@ -47,7 +47,7 @@ file that was distributed with this source code.
<button
type=
"button"
data-edit-archivalProfile=
"[?merge .archivalProfileId ?]"
class=
"btn btn-info"
title=
"Edit"
>
<span
class=
"fa fa-fw fa-edit"
></span>
</button>
<button
type=
"button"
data-profileid=
"[?merge .archivalProfileId ?]"
class=
"deleteProfile btn btn-danger
[?merge .used.bool().then('disabled') ?]
"
title=
"Delete"
>
<button
type=
"button"
data-profileid=
"[?merge .archivalProfileId ?]"
class=
"deleteProfile btn btn-danger"
title=
"Delete"
>
<span
class=
"fa fa-fw fa-trash"
></span>
</button>
<button
type=
"button"
data-reference=
"[?merge .reference ?]"
class=
"generateBarCode btn btn-warning"
title=
"Generate bar code"
data-label=
"[?merge .name ?]"
>
...
...
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