Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93523202
LegalpadDocumentRequireSignatureTransaction.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Nov 29, 10:47
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Dec 1, 10:47 (1 d, 21 h)
Engine
blob
Format
Raw Data
Handle
22657476
Attached To
rPH Phabricator
LegalpadDocumentRequireSignatureTransaction.php
View Options
<?php
final
class
LegalpadDocumentRequireSignatureTransaction
extends
LegalpadDocumentTransactionType
{
const
TRANSACTIONTYPE
=
'legalpad:require-signature'
;
public
function
generateOldValue
(
$object
)
{
return
(
int
)
$object
->
getRequireSignature
();
}
public
function
applyInternalEffects
(
$object
,
$value
)
{
$object
->
setRequireSignature
((
int
)
$value
);
}
public
function
applyExternalEffects
(
$object
,
$value
)
{
if
(
$value
)
{
$session
=
new
PhabricatorAuthSession
();
queryfx
(
$session
->
establishConnection
(
'w'
),
'UPDATE %T SET signedLegalpadDocuments = 0'
,
$session
->
getTableName
());
}
}
public
function
getTitle
()
{
$new
=
$this
->
getNewValue
();
if
(
$new
)
{
return
pht
(
'%s set the document to require signatures.'
,
$this
->
renderAuthor
());
}
else
{
return
pht
(
'%s set the document to not require signatures.'
,
$this
->
renderAuthor
());
}
}
public
function
getTitleForFeed
()
{
$new
=
$this
->
getNewValue
();
if
(
$new
)
{
return
pht
(
'%s set the document %s to require signatures.'
,
$this
->
renderAuthor
(),
$this
->
renderObject
());
}
else
{
return
pht
(
'%s set the document %s to not require signatures.'
,
$this
->
renderAuthor
(),
$this
->
renderObject
());
}
}
public
function
validateTransactions
(
$object
,
array
$xactions
)
{
$errors
=
array
();
$is_admin
=
$this
->
getActor
()->
getIsAdmin
();
if
(!
$is_admin
)
{
$errors
[]
=
$this
->
newInvalidError
(
pht
(
'Only admins may require signature.'
));
}
return
$errors
;
}
public
function
getIcon
()
{
return
'fa-pencil-square'
;
}
}
Event Timeline
Log In to Comment