Skip to content

Feature/digital signature modifications#20

Open
jekuaitk wants to merge 11 commits into
release/5.1.5from
feature/digital-signature-modifications
Open

Feature/digital signature modifications#20
jekuaitk wants to merge 11 commits into
release/5.1.5from
feature/digital-signature-modifications

Conversation

@jekuaitk

@jekuaitk jekuaitk commented Jun 16, 2026

Copy link
Copy Markdown

https://leantime.itkdev.dk/_#/tickets/showTicket/7768

  • Use state Draft for non-finished business
  • Added the ability to configure on which submission states handlers should be sent:
    • Digital Post
    • Fasit
    • FBS

Comment thread modules/os2forms_digital_post/os2forms_digital_post.install
if (($handler['id'] ?? NULL) !== 'digital_post_sf1601') {
continue;
}
$handlers[$handlerId]['settings']['additional']['states'] = ['completed'];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use WebformSubmissionInterface::STATE_COMPLETED here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will make the switch.

@jekuaitk jekuaitk force-pushed the feature/digital-signature-modifications branch from 8b1e9cc to 000ec3f Compare June 17, 2026 09:22
Comment on lines +46 to +50
foreach ($handlers as $handlerId => $handler) {
if (($handler['id'] ?? NULL) !== 'digital_post_sf1601') {
continue;
}
$handlers[$handlerId]['settings']['additional']['states'] = [WebformSubmissionInterface::STATE_COMPLETED];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is confusing: It's easy to get the impression that $handler['id'] and $handlerId are different names for the same value. They often are, but may not be.

Consider adding a comment on what $handler['id'] is and what $handlerId is.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed $handlerId to $handlerKey and added a comment explaining what $handler['id'] is.

*/
public function setCompleted(WebformSubmissionInterface $webformSubmission) {
$webformSubmission->set('in_draft', FALSE);
$webformSubmission->setCompletedTime(time());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use the request time here (cf. https://git.drupalcode.org/project/webform/-/blob/6.3.x/src/Entity/WebformSubmission.php?ref_type=heads#L883-898). We should always use the request time when we need the time.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used request time.

* Configure the webform submission as draft.
*/
public function setDraft(WebformSubmissionInterface $webform_submission) {
$webform_submission->set('in_draft', TRUE);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider (un)settings completed here to be on the safe side.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added $webformSubmission->setCompletedTime(0);

/**
* Configure the webform submission as completed.
*/
public function setCompleted(WebformSubmissionInterface $webformSubmission) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be worth noting that setDraft and setCompleted are each others opposites.

It may also be worth renaming them: setSubmissionCompleted may be a better name – but setSubmissionDraft is not …

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed to setSubmissionCompleted and setSubmissionDraft although you don't like the latter. Also added comment explaining that they are each others complementary functions.

@jekuaitk jekuaitk requested a review from rimi-itk June 17, 2026 14:20

@rimi-itk rimi-itk left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Two suggestions added, but nothing really important.

Comment thread modules/os2forms_digital_signature/src/Service/SigningService.php
Comment thread modules/os2forms_digital_signature/src/Service/SigningService.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants