Differential D20311 Diff 48484 src/applications/legalpad/xaction/LegalpadDocumentRequireSignatureTransaction.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/legalpad/xaction/LegalpadDocumentRequireSignatureTransaction.php
| Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | if ($new) { | ||||
| $this->renderAuthor(), | $this->renderAuthor(), | ||||
| $this->renderObject()); | $this->renderObject()); | ||||
| } | } | ||||
| } | } | ||||
| public function validateTransactions($object, array $xactions) { | public function validateTransactions($object, array $xactions) { | ||||
| $errors = array(); | $errors = array(); | ||||
| $is_admin = $this->getActor()->getIsAdmin(); | $old = (bool)$object->getRequireSignature(); | ||||
| foreach ($xactions as $xaction) { | |||||
| $new = (bool)$xaction->getNewValue(); | |||||
| if ($old === $new) { | |||||
| continue; | |||||
| } | |||||
| $is_admin = $this->getActor()->getIsAdmin(); | |||||
| if (!$is_admin) { | if (!$is_admin) { | ||||
| $errors[] = $this->newInvalidError( | $errors[] = $this->newInvalidError( | ||||
| pht('Only admins may require signature.')); | pht( | ||||
| 'Only administrators may change whether a document '. | |||||
| 'requires a signature.'), | |||||
| $xaction); | |||||
| } | |||||
| } | } | ||||
| return $errors; | return $errors; | ||||
| } | } | ||||
| public function getIcon() { | public function getIcon() { | ||||
| return 'fa-pencil-square'; | return 'fa-pencil-square'; | ||||
| } | } | ||||
| } | } | ||||