Registers the cancellation event in the activity stream,
allowing users to see signature request cancellations
in their activity history.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Implements email notification for canceled signature requests.
Sends email to users informing them that their signature
request has been canceled.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Implements the notification message formatting in Notifier
to display cancellation notifications with proper subject
and message text.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Implements the notification handler for canceled signature requests.
Sends in-app notifications to users when their signature request
is canceled, respecting user activity settings preferences.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Creates the Activity components for the cancellation notification:
- SignRequestCanceled settings class
- SignRequestCanceled provider for activity stream
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
When a signature request with status ABLE_TO_SIGN is deleted,
dispatch the SignRequestCanceledEvent for each identify method.
This allows notification and email listeners to inform users
about the cancellation.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
This event is dispatched when a signature request is canceled,
allowing listeners to send notifications to the affected user.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Added confirmation dialogs before sending signature requests to improve
user awareness and prevent accidental submissions.
Changes:
- Added confirmation dialog for global 'Request signatures' button
- Added confirmation dialog for individual signer 'Request signature' action
- Created confirmRequest() and confirmRequestSigner() methods
- Added state management: showConfirmRequest, showConfirmRequestSigner, selectedSigner
- Modified request() to show confirmation instead of directly executing
- Modified requestSignatureForSigner() to show confirmation and store selected signer
The confirmation dialogs use NcDialog with @closing event for proper
closing behavior when user clicks X, ESC, or Cancel button.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
The button in the signature positions modal now always shows 'Save'
instead of conditionally showing 'Send' or 'Save' based on draft status.
Changes:
- Button always calls save() method without changing status
- Removed confirmation dialog (showConfirm) from VisibleElements
- Removed request() method that was changing status to ABLE_TO_SIGN
- Removed unused Send icon component import
- Simplified button logic by removing isDraft condition
This improves UX by making the modal's purpose clear: it's for
positioning signatures, not for requesting them.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
The 'Request signatures' button now appears conditionally based on signing flow:
- Parallel flow: Shows when any signer has DRAFT status (status === 0)
- Sequential flow: Shows only when current signing order has draft signers
- Finds the lowest pending order among unsigned signers
- Checks if that order contains any draft signers
This prevents requesting signatures from signers who aren't in their turn yet
in sequential signing, while maintaining flexibility in parallel signing.
Refactored logic into smaller, focused methods:
- hasAnyDraftSigner: Checks for any draft signer (parallel mode)
- hasSequentialDraftSigners: Orchestrates sequential mode verification
- getCurrentSigningOrder: Gets current order that should sign
- hasOrderDraftSigners: Checks if specific order has draft signers
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Added two unit tests to validate status determination logic:
1. testParallelFlowIgnoresSignerDraftStatusWhenFileIsAbleToSign:
Validates that in parallel flow, all signers are set to ABLE_TO_SIGN
when file status is ABLE_TO_SIGN, ignoring individual DRAFT status
sent by frontend.
2. testOrderedFlowRespectsSigningOrderWhenFileIsAbleToSign:
Validates that in ordered flow, only the first signer (order 1)
gets ABLE_TO_SIGN status, while subsequent signers remain DRAFT
until their turn.
Also updated getService() method to accept optional
SequentialSigningService parameter for testing different flows.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
When file status is ABLE_TO_SIGN (1) in parallel flow, all signers
should be set to ABLE_TO_SIGN regardless of individual signer status
sent by frontend. This fixes the issue where signers remained in DRAFT
status (0) even after clicking 'Request signatures'.
The logic now:
1. Check file status DRAFT first - keep all signers as DRAFT
2. Check file status ABLE_TO_SIGN - apply flow-based logic:
- Parallel: All signers get ABLE_TO_SIGN
- Ordered: Only first signer gets ABLE_TO_SIGN
3. Fallback to individual signer status for other cases
Resolves issue where sign_request records stayed at status 0 while
libresign_file was updated to status 1.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
When user provides a specific signing order, the next auto-assigned
order should be the provided value + 1.
Changed condition from > to >= and set currentOrder to userProvidedOrder + 1
instead of just userProvidedOrder.
This ensures proper order sequencing when mixing user-provided and
auto-assigned orders.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Complete the OpenAPI schema update by adding signatureFlow field to
the ValidateFile schema definition.
This was manually corrected after the initial automated update.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Add comprehensive unit tests for the signature flow implementation.
- SequentialSigningServiceTest: Test flow detection and order assignment
- FileTest: Test enum conversion methods in File entity
- RequestSignatureServiceTest: Fix constructor to include IAppConfig mock
Tests validate the core logic without focusing on coverage metrics.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Replace global config usage with file-level signature flow from store.
- RequestSignatureTab.vue: Compute signatureFlow from file data
- Signer.vue: Read signatureFlow from file instead of loadState
- Signers.vue: Check file.signatureFlow for ordered flow mode
- files.js: Use file.signatureFlow for signer order management
This enables per-file signature flow configuration in the UI.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Add signatureFlow field to ValidateFile schema in OpenAPI specs and
ResponseDefinitions.
- Update openapi.json and openapi-full.json schemas
- Add signatureFlow to LibresignValidateFile psalm type
- Mark as required field with integer type
This fixes OpenAPI validation errors in API tests.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Move database value constants from File entity to SignatureFlow enum
where they belong as the single source of truth.
- Add SignatureFlow::NUMERIC_PARALLEL and NUMERIC_ORDERED_NUMERIC
- Remove circular dependency between File and SignatureFlow
- Update all references to use enum constants
- Use descriptive names instead of abbreviations
This follows single responsibility principle: the enum owns its
database representation.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Update API documentation for request-signature endpoint.
- Add signatureFlow parameter to request body schema
- Type: string, nullable
- Description documents accepted values and fallback behavior
This ensures API consumers have accurate documentation for the
signature flow parameter.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Expose signature flow configuration in file list and detail endpoints.
FileService changes:
- Add signatureFlow to fileData object in formatFile()
SignRequestMapper changes:
- Include f.signature_flow in SELECT query
- Convert numeric value to enum string in formatListRow()
- Remove signature_flow from response (cleanup after conversion)
This enables frontend to display and use per-file signature flow
configuration.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Add signature flow parameter processing and file configuration logic.
- Parse signatureFlow from request data and convert to enum
- Fall back to global config if parameter invalid or missing
- Set file entity signature flow via setSignatureFlowEnum()
- Initialize SequentialSigningService with file entity context
- Add IAppConfig dependency for global fallback
This completes the backend logic for per-file signature flow
configuration with graceful fallback to system defaults.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Add optional signatureFlow parameter to POST /request-signature API.
- Accepts 'parallel' or 'ordered_numeric' values
- Falls back to global configuration if not provided
- Documented in PHPDoc and OpenAPI annotations
This enables clients to specify signature flow mode per document
when creating signature requests.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Replace global config dependency with file-level signature flow.
- Add setFile() method to inject File entity
- Replace getSignatureFlow() to read from file instead of IAppConfig
- Remove IAppConfig dependency (no longer needed)
- Add validation: throws LogicException if getSignatureFlow() called without file
This enables per-file signature flow configuration while maintaining
backward compatibility through database default values.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Add signatureFlow property and enum conversion helper methods to File entity.
- New protected property: signatureFlow (SMALLINT, default 1)
- getSignatureFlowEnum(): Returns SignatureFlow enum from integer
- setSignatureFlowEnum(): Sets integer from SignatureFlow enum
These methods provide type-safe access to signature flow configuration
stored in the database.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Add toNumeric() and fromNumeric() methods to enable conversion between
SignatureFlow enum values and their integer database representations.
- PARALLEL = 1
- ORDERED_NUMERIC = 2
This allows storing signature flow as integers in the database while
maintaining type-safe enum usage in the code.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Set default value of 0 for signer_order column to prevent NULL values
that would cause issues with sequential signing feature.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Remove internal validation methods from RequestSignatureService and
delegate to SequentialSigningService for better separation of concerns.
Changes:
- Remove hasPendingLowerOrderSigners() private method
- Remove isStatusUpgrade() private method
- Replace inline ordering validation with call to
validateStatusByOrder()
- Simplify determineInitialStatus() by delegating validation logic
This reduces complexity in RequestSignatureService and makes the code
more maintainable by following single responsibility principle. All
sequential signing logic is now centralized in the specialized service.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Move status-related validation logic to SequentialSigningService where
it belongs, improving code cohesion and testability.
Changes:
- Add hasPendingLowerOrderSigners() method to check for incomplete
lower-order signers
- Add isStatusUpgrade() method to validate status transitions
- Add validateStatusByOrder() method to encapsulate ordering
validation logic for status transitions
These methods are now public and easily testable, centralizing all
sequential signing validation logic in a single specialized service.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
In ordered numeric signing flow, the frontend now validates that
all lower-order signers have signed before showing 'Request signature'
or 'Send reminder' buttons for higher-order signers.
Changes:
- Extract duplicate ordering validation logic into shared method
canSignerActInOrder
- Apply ordering validation to both canRequestSignature and
canSendReminder computed properties
- Move canSignerActInOrder to methods section (takes parameter)
This prevents users from requesting signatures or sending reminders
to signers out of turn when sequential signing is enabled.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
The modal dialog was displaying 'Add new signer' title when clicking
an existing signer to edit, which was confusing. Added a computed
property 'modalTitle' that dynamically returns 'Edit signer' when
editing an existing signer or 'Add new signer' when adding a new one.
The logic checks if signerToEdit object has properties to determine
the correct context.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Remove box-shadow from .app-sidebar__tab to eliminate the blue line
that appeared above tab content when clicking on sidebar tabs.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
The Signer component expects signerIndex prop but VisibleElements
was passing current-signer instead. This caused Vue warnings about
missing required prop and errors when trying to access signer data.
Changed :current-signer to :signer-index and removed obsolete
:signer prop since the component now fetches signer data from
the store using the signerIndex.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>