Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sarun Mungthanya
SpnPatch-Laravel
Commits
56424562
Commit
56424562
authored
Nov 29, 2024
by
Chanon.u
Browse files
Add declaration no to be required field for cancel
parent
50d9b931
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/Http/Livewire/Pages/ManualResponse/ManualResponse.php
View file @
56424562
...
...
@@ -255,11 +255,13 @@ class ManualResponse extends Component
}
private
function
validateBeforeSend
(){
$referenceNo
=
$this
->
xmlData
[
'ReferenceNumber'
];
$messageType
=
$this
->
xmlData
[
'MessageType'
]
??
''
;
$referenceNo
=
$this
->
xmlData
[
'ReferenceNumber'
]
??
''
;
$declarationNo
=
$this
->
xmlData
[
'DeclarationNumber'
]
??
''
;
$profileProds
=
ConfListProfile
::
where
(
'type'
,
'PROD'
)
->
pluck
(
'name'
)
->
toArray
();
//Validate reference number format
if
(
isset
(
$referenceNo
)
&&
!
preg_match
(
'/^[A-Z]{4}[0-9]{9}$/'
,
$referenceNo
))
{
if
(
!
preg_match
(
'/^[A-Z]{4}[0-9]{9}$/'
,
$referenceNo
))
{
return
[
"success"
=>
false
,
'message'
=>
'Reference Number is incorrect format.'
...
...
@@ -267,13 +269,21 @@ class ManualResponse extends Component
}
//Validate profile production
if
(
isset
(
$referenceNo
)
&&
in_array
(
substr
(
$referenceNo
,
0
,
1
),
$profileProds
)){
if
(
in_array
(
substr
(
$referenceNo
,
0
,
1
),
$profileProds
)){
return
[
"success"
=>
false
,
'message'
=>
'Profile production is not allowed.'
];
}
//Validate profile production
if
(
in_array
(
$messageType
,
[
'XCDA'
,
'XCDR'
])
||
$declarationNo
==
''
){
return
[
"success"
=>
false
,
'message'
=>
'Cancel template is required "Declaration Number" field.'
];
}
return
[
'success'
=>
true
,
'message'
=>
''
];
}
...
...
Write
Preview
Markdown
is supported
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