Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Maarch
MaarchCourrier
Commits
1f189e6f
Commit
1f189e6f
authored
Sep 09, 2021
by
Guillaume Heurtier
Browse files
FEAT #17268 TIME 1:30 make doctype not mandatory
parent
c6805919
Changes
9
Hide whitespace changes
Inline
Side-by-side
sql/structure.sql
View file @
1f189e6f
...
...
@@ -1130,12 +1130,12 @@ SELECT r.res_id,
r
.
binding
,
en
.
entity_label
,
en
.
entity_type
AS
entitytype
FROM
doctypes
d
,
doctypes_first_level
dfl
,
doctypes_second_level
dsl
,
res_letterbox
r
LEFT
JOIN
entities
en
ON
r
.
destination
::
text
=
en
.
entity_id
::
text
WHERE
r
.
type_id
=
d
.
type_id
AND
d
.
doctypes_first_level_id
=
dfl
.
doctypes_first_level_id
AND
d
.
doctypes_second_level_id
=
dsl
.
doctypes_second_level_id
;
FROM
res_letterbox
r
LEFT
JOIN
doctypes
d
ON
r
.
type_id
=
d
.
type_id
LEFT
JOIN
doctypes_first_level
dfl
ON
d
.
doctypes_first_level_id
=
dfl
.
doctypes_first_level_id
LEFT
JOIN
doctypes_second_level
dsl
ON
d
.
doctypes_second_level_id
=
dsl
.
doctypes_second_level_id
LEFT
JOIN
entities
en
ON
r
.
destination
::
TEXT
=
en
.
entity_id
::
TEXT
;
/* ORDER ON CHRONO */
CREATE
OR
REPLACE
FUNCTION
order_alphanum
(
text
)
RETURNS
text
AS
$$
...
...
src/app/action/controllers/AcknowledgementReceiptTrait.php
View file @
1f189e6f
...
...
@@ -71,7 +71,10 @@ trait AcknowledgementReceiptTrait
}
}
$doctype
=
DoctypeModel
::
getById
([
'id'
=>
$resource
[
'type_id'
],
'select'
=>
[
'process_mode'
]]);
$doctype
[
'process_mode'
]
=
''
;
if
(
!
empty
(
$resource
[
'type_id'
]))
{
$doctype
=
DoctypeModel
::
getById
([
'id'
=>
$resource
[
'type_id'
],
'select'
=>
[
'process_mode'
]]);
}
if
(
$doctype
[
'process_mode'
]
==
'SVA'
)
{
$templateAttachmentType
=
'sva'
;
...
...
src/app/action/controllers/PreProcessActionController.php
View file @
1f189e6f
...
...
@@ -261,7 +261,10 @@ class PreProcessActionController
continue
;
}
$doctype
=
DoctypeModel
::
getById
([
'id'
=>
$resource
[
'type_id'
],
'select'
=>
[
'process_mode'
]]);
$doctype
[
'process_mode'
]
=
''
;
if
(
!
empty
(
$resource
[
'type_id'
]))
{
$doctype
=
DoctypeModel
::
getById
([
'id'
=>
$resource
[
'type_id'
],
'select'
=>
[
'process_mode'
]]);
}
if
(
empty
(
$resource
[
'destination'
])
&&
$currentMode
==
'auto'
)
{
$noSendAR
[
'number'
]
+=
1
;
...
...
src/app/configuration/controllers/ConfigurationController.php
View file @
1f189e6f
...
...
@@ -348,7 +348,7 @@ class ConfigurationController
$doctype
=
DoctypeModel
::
getById
([
'select'
=>
[
1
],
'id'
=>
$body
[
'metadata'
][
'typeId'
]]);
if
(
empty
(
$doctype
))
{
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'
Basket
not found'
,
'lang'
=>
'typeIdDoesNotExist'
]);
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'
Doctype
not found'
,
'lang'
=>
'typeIdDoesNotExist'
]);
}
$customId
=
CoreConfigModel
::
getCustomId
();
...
...
src/app/external/alfresco/controllers/AlfrescoController.php
View file @
1f189e6f
...
...
@@ -646,8 +646,10 @@ class AlfrescoController
if
(
$alfrescoParameter
==
'alfrescoLogin'
)
{
$properties
[
$key
]
=
$entityInformations
[
'alfresco'
][
'login'
];
}
elseif
(
$alfrescoParameter
==
'doctypeLabel'
)
{
$doctype
=
DoctypeModel
::
getById
([
'select'
=>
[
'description'
],
'id'
=>
$document
[
'type_id'
]]);
$properties
[
$key
]
=
$doctype
[
'description'
];
if
(
!
empty
(
$document
[
'type_id'
]))
{
$doctype
=
DoctypeModel
::
getById
([
'select'
=>
[
'description'
],
'id'
=>
$document
[
'type_id'
]]);
}
$properties
[
$key
]
=
$doctype
[
'description'
]
??
''
;
}
elseif
(
$alfrescoParameter
==
'priorityLabel'
)
{
if
(
!
empty
(
$document
[
'priority'
]))
{
$priority
=
PriorityModel
::
getById
([
'select'
=>
[
'label'
],
'id'
=>
$document
[
'priority'
]]);
...
...
@@ -693,9 +695,11 @@ class AlfrescoController
}
$properties
[
$key
]
=
$contactToDisplay
[
'contact'
][
'address'
]
??
''
;
}
elseif
(
$alfrescoParameter
==
'doctypeSecondLevelLabel'
)
{
$doctype
=
DoctypeModel
::
getById
([
'select'
=>
[
'doctypes_second_level_id'
],
'id'
=>
$document
[
'type_id'
]]);
$doctypeSecondLevel
=
SecondLevelModel
::
getById
([
'id'
=>
$doctype
[
'doctypes_second_level_id'
],
'select'
=>
[
'doctypes_second_level_label'
]]);
$properties
[
$key
]
=
$doctypeSecondLevel
[
'doctypes_second_level_label'
];
if
(
!
empty
(
$document
[
'type_id'
]))
{
$doctype
=
DoctypeModel
::
getById
([
'select'
=>
[
'doctypes_second_level_id'
],
'id'
=>
$document
[
'type_id'
]]);
$doctypeSecondLevel
=
SecondLevelModel
::
getById
([
'id'
=>
$doctype
[
'doctypes_second_level_id'
],
'select'
=>
[
'doctypes_second_level_label'
]]);
}
$properties
[
$key
]
=
$doctypeSecondLevel
[
'doctypes_second_level_label'
]
??
''
;
}
elseif
(
strpos
(
$alfrescoParameter
,
'customField_'
)
!==
false
)
{
$customId
=
explode
(
'_'
,
$alfrescoParameter
)[
1
];
$customValue
=
json_decode
(
$document
[
'custom_fields'
],
true
);
...
...
src/app/external/messageExchange/controllers/SendMessageExchangeController.php
View file @
1f189e6f
...
...
@@ -154,7 +154,9 @@ class SendMessageExchangeController
}
$AllInfoMainMail
=
ResModel
::
getById
([
'select'
=>
[
'*'
],
'resId'
=>
$args
[
'resId'
]]);
$doctype
=
DoctypeModel
::
getById
([
'select'
=>
[
'description'
],
'id'
=>
$AllInfoMainMail
[
'type_id'
]]);
if
(
!
empty
(
$AllInfoMainMail
[
'type_id'
]))
{
$doctype
=
DoctypeModel
::
getById
([
'select'
=>
[
'description'
],
'id'
=>
$AllInfoMainMail
[
'type_id'
]]);
}
$tmpMainExchangeDoc
=
explode
(
"__"
,
$body
[
'mainExchangeDoc'
]);
$MainExchangeDoc
=
[
'tablename'
=>
$tmpMainExchangeDoc
[
0
],
'res_id'
=>
$tmpMainExchangeDoc
[
1
]];
...
...
@@ -163,7 +165,7 @@ class SendMessageExchangeController
if
(
!
empty
(
$body
[
'joinFile'
])
||
$MainExchangeDoc
[
'tablename'
]
==
'res_letterbox'
)
{
$AllInfoMainMail
[
'Title'
]
=
$AllInfoMainMail
[
'subject'
];
$AllInfoMainMail
[
'OriginatingAgencyArchiveUnitIdentifier'
]
=
$AllInfoMainMail
[
'alt_identifier'
];
$AllInfoMainMail
[
'DocumentType'
]
=
$doctype
[
'description'
];
$AllInfoMainMail
[
'DocumentType'
]
=
$doctype
[
'description'
]
??
null
;
$AllInfoMainMail
[
'tablenameExchangeMessage'
]
=
'res_letterbox'
;
$fileInfo
=
[
$AllInfoMainMail
];
}
...
...
src/app/resource/controllers/FolderPrintController.php
View file @
1f189e6f
...
...
@@ -910,8 +910,10 @@ class FolderPrintController
'resId'
=>
$resId
]);
$doctype
=
DoctypeModel
::
getById
([
'select'
=>
[
'description'
],
'id'
=>
$resource
[
'type_id'
]]);
$resource
[
'type_label'
]
=
$doctype
[
'description'
];
if
(
!
empty
(
$resource
[
'type_id'
]))
{
$doctype
=
DoctypeModel
::
getById
([
'select'
=>
[
'description'
],
'id'
=>
$resource
[
'type_id'
]]);
}
$resource
[
'type_label'
]
=
$doctype
[
'description'
]
??
''
;
$data
=
SummarySheetController
::
prepareData
([
'units'
=>
$units
,
'resourcesIds'
=>
[
$resId
]]);
...
...
src/app/resource/controllers/ResourceControlController.php
View file @
1f189e6f
...
...
@@ -45,17 +45,19 @@ class ResourceControlController
if
(
empty
(
$body
))
{
return
[
'errors'
=>
'Body is not set or empty'
];
}
elseif
(
!
Validator
::
intVal
()
->
notEmpty
()
->
validate
(
$body
[
'doctype'
]))
{
return
[
'errors'
=>
'Body doctype is
empty or
not an integer'
];
}
elseif
(
!
empty
(
$body
[
'doctype'
])
&&
!
Validator
::
intVal
()
->
validate
(
$body
[
'doctype'
]))
{
return
[
'errors'
=>
'Body doctype is not an integer'
];
}
elseif
(
!
Validator
::
intVal
()
->
notEmpty
()
->
validate
(
$body
[
'modelId'
]))
{
return
[
'errors'
=>
'Body modelId is empty or not an integer'
];
}
elseif
(
$isWebServiceUser
&&
!
Validator
::
stringType
()
->
notEmpty
()
->
validate
(
$body
[
'status'
]))
{
return
[
'errors'
=>
'Body status is empty or not a string'
];
}
$doctype
=
DoctypeModel
::
getById
([
'id'
=>
$body
[
'doctype'
],
'select'
=>
[
1
]]);
if
(
empty
(
$doctype
))
{
return
[
'errors'
=>
'Body doctype does not exist'
];
if
(
!
empty
(
$body
[
'doctype'
]))
{
$doctype
=
DoctypeModel
::
getById
([
'id'
=>
$body
[
'doctype'
],
'select'
=>
[
1
]]);
if
(
empty
(
$doctype
))
{
return
[
'errors'
=>
'Body doctype does not exist'
];
}
}
$indexingModel
=
IndexingModelModel
::
getById
([
'id'
=>
$body
[
'modelId'
],
'select'
=>
[
'master'
,
'enabled'
,
'mandatory_file'
]]);
...
...
@@ -171,12 +173,14 @@ class ResourceControlController
}
}
if
(
!
Validator
::
intVal
()
->
notEmpty
()
->
validate
(
$body
[
'doctype'
]))
{
return
[
'errors'
=>
'Body doctype is
empty or
not an integer'
];
if
(
!
Validator
::
intVal
()
->
validate
(
$body
[
'doctype'
]))
{
return
[
'errors'
=>
'Body doctype is not an integer'
];
}
$doctype
=
DoctypeModel
::
getById
([
'id'
=>
$body
[
'doctype'
],
'select'
=>
[
1
]]);
if
(
empty
(
$doctype
))
{
return
[
'errors'
=>
'Body doctype does not exist'
];
if
(
!
empty
(
$body
[
'doctype'
]))
{
$doctype
=
DoctypeModel
::
getById
([
'id'
=>
$body
[
'doctype'
],
'select'
=>
[
1
]]);
if
(
empty
(
$doctype
))
{
return
[
'errors'
=>
'Body doctype does not exist'
];
}
}
$control
=
ResourceControlController
::
controlAdjacentData
([
'body'
=>
$body
]);
...
...
test/unitTests/app/resource/ResControllerTest.php
View file @
1f189e6f
...
...
@@ -178,7 +178,7 @@ class ResControllerTest extends TestCase
$response
=
$resController
->
create
(
$fullRequest
,
new
\
Slim\Http\Response
());
$this
->
assertSame
(
400
,
$response
->
getStatusCode
());
$responseBody
=
json_decode
((
string
)
$response
->
getBody
(),
true
);
$this
->
assertSame
(
'Body doctype is
empty or
not an integer'
,
$responseBody
[
'errors'
]);
$this
->
assertSame
(
'Body doctype is not an integer'
,
$responseBody
[
'errors'
]);
$body
=
[
'doctype'
=>
102
,
...
...
@@ -787,6 +787,7 @@ class ResControllerTest extends TestCase
$aArgs
=
[
'status'
=>
'NEW'
,
'doctype'
=>
'wrong format'
,
'encodedFile'
=>
$encodedFile
,
'format'
=>
'txt'
,
'confidentiality'
=>
false
,
...
...
@@ -806,7 +807,7 @@ class ResControllerTest extends TestCase
$response
=
$resController
->
update
(
$fullRequest
,
new
\
Slim\Http\Response
(),
[
'resId'
=>
self
::
$id
]);
$responseBody
=
json_decode
((
string
)
$response
->
getBody
(),
true
);
$this
->
assertSame
(
'Body doctype is
empty or
not an integer'
,
$responseBody
[
'errors'
]);
$this
->
assertSame
(
'Body doctype is not an integer'
,
$responseBody
[
'errors'
]);
$response
=
$resController
->
update
(
$fullRequest
,
new
\
Slim\Http\Response
(),
[
'resId'
=>
'wrong format'
]);
$this
->
assertSame
(
400
,
$response
->
getStatusCode
());
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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