Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92686477
PhortuneAccountBillingNameTransaction.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 22, 18:41
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Nov 24, 18:41 (1 d, 19 h)
Engine
blob
Format
Raw Data
Handle
22487020
Attached To
rPH Phabricator
PhortuneAccountBillingNameTransaction.php
View Options
<?php
final
class
PhortuneAccountBillingNameTransaction
extends
PhortuneAccountTransactionType
{
const
TRANSACTIONTYPE
=
'billing-name'
;
public
function
generateOldValue
(
$object
)
{
return
$object
->
getBillingName
();
}
public
function
applyInternalEffects
(
$object
,
$value
)
{
$object
->
setBillingName
(
$value
);
}
public
function
getTitle
()
{
$old
=
$this
->
getOldValue
();
$new
=
$this
->
getNewValue
();
if
(
strlen
(
$old
)
&&
strlen
(
$new
))
{
return
pht
(
'%s changed the billing name for this account from %s to %s.'
,
$this
->
renderAuthor
(),
$this
->
renderOldValue
(),
$this
->
renderNewValue
());
}
else
if
(
strlen
(
$old
))
{
return
pht
(
'%s removed the billing name for this account (was %s).'
,
$this
->
renderAuthor
(),
$this
->
renderOldValue
());
}
else
{
return
pht
(
'%s set the billing name for this account to %s.'
,
$this
->
renderAuthor
(),
$this
->
renderNewValue
());
}
}
public
function
validateTransactions
(
$object
,
array
$xactions
)
{
$errors
=
array
();
$max_length
=
$object
->
getColumnMaximumByteLength
(
'billingName'
);
foreach
(
$xactions
as
$xaction
)
{
$new_value
=
$xaction
->
getNewValue
();
$new_length
=
strlen
(
$new_value
);
if
(
$new_length
>
$max_length
)
{
$errors
[]
=
$this
->
newRequiredError
(
pht
(
'The billing name can be no longer than %s characters.'
,
new
PhutilNumber
(
$max_length
)));
}
}
return
$errors
;
}
}
Event Timeline
Log In to Comment