Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]
### Added
- `Document::getDocumentOrder()` and `Document::setDocumentOrder(int)` — expose the `documentOrder` field (display order of documents shown to signers). The field is now included in both create (`POST /documents`) and update (`PUT /documents/{id}`) requests.
### Changed
### Removed

Expand Down
7 changes: 7 additions & 0 deletions docs/document.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ $myDocument->setFile('/path/to/document.pdf');
// Make the document signable
$myDocument->makeSignable();

// Optionally set the display order (0-indexed; controls the order signers see documents)
$myDocument->setDocumentOrder(0);

// Finally, persist the object
Document::persist($myDocument);
```
Expand Down Expand Up @@ -122,6 +125,10 @@ Returns the date and time when the document was last modified as a _DateTime_ ob
Returns the date and time when the document signing process was finalized as a _DateTime_ object.
* __getDocumentId()__
Returns the unique ID that is stamped on every page in the document for identification purposes.
* __getDocumentOrder()__
Returns the display order of the document (integer, 0-indexed). Controls the order in which signers see documents within a case file.
* __setDocumentOrder($order)__
Sets the display order. Can be called before `persist()` (create) or before `Document::persist($doc)` on an existing document (update).
* __getFormat()__
Returns the document format as a string (typically `"pdf"`). Returns `null` for locally created documents that have not been persisted yet.
* __getOptions()__
Expand Down
28 changes: 26 additions & 2 deletions src/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,21 @@ class Document extends Entity
'type',
'@pdfFile',
'@file',
'documentTypeId' => 'documentType->getId'
'documentTypeId' => 'documentType->getId',
'documentOrder',
),
'update' => array(
'title',
'metaData',
'options',
'documentTypeId' => 'documentType->getId'
'documentTypeId' => 'documentType->getId',
'documentOrder',
)
);
protected static $relativeUrl = 'documents';

protected $documentId;
protected $documentOrder = 0;
protected $title;
protected $metaData;
protected $options;
Expand Down Expand Up @@ -243,6 +246,27 @@ public function getDocumentId()
return $this->documentId;
}

/**
* Order in which the document is shown to the user when signing.
*
* @return int
*/
public function getDocumentOrder(): int
{
return $this->documentOrder ?? 0;
}

/**
* Set the order in which the document is shown to the user when signing.
*
* @param int $documentOrder
* @return void
*/
public function setDocumentOrder(int $documentOrder): void
{
$this->documentOrder = $documentOrder;
}

/**
* @return string|null
*/
Expand Down