diff --git a/CHANGELOG.md b/CHANGELOG.md index 85cc061..4e09382 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/docs/document.md b/docs/document.md index 367fd91..7bd0dfd 100644 --- a/docs/document.md +++ b/docs/document.md @@ -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); ``` @@ -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()__ diff --git a/src/Document.php b/src/Document.php index b43cf25..d6fab7e 100644 --- a/src/Document.php +++ b/src/Document.php @@ -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; @@ -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 */