setPublicAck: Implementation
ok 48 - setPublicAck: fails supporterId invalid ok 49 - setPublicAck: fails supporterId is string ok 50 - setPublicAck: fails supporterId is undef ok 51 - setPublicAck: 1 failed calls changed nothing. ok 52 - setPublicAck: 1 failed calls changed nothing. ok 53 - setPublicAck: 1 failed calls changed nothing. ok 54 - setPublicAck: lives when valid id is given for undefining... ok 55 - setPublicAck: ...and suceeds in changing value. ok 56 - setPublicAck: lives when valid id is given for off... ok 57 - setPublicAck: ...and suceeds in changing value. ok 58 - setPublicAck: lives when valid id is given for on... ok 59 - setPublicAck: ...and suceeds in changing value.
This commit is contained in:
parent
2676dfba22
commit
1c6441e135
1 changed files with 38 additions and 0 deletions
|
@ -491,6 +491,44 @@ sub getDisplayName($$$) {
|
|||
return $_[0]->_getDonorField("display_name", $_[1]);
|
||||
}
|
||||
######################################################################
|
||||
sub _setDonorField($$$) {
|
||||
my($self, $field, $donorId, $value, $type) = @_;
|
||||
|
||||
die "set$field: invalid supporter id, $donorId" unless $self->_verifyId($donorId);
|
||||
|
||||
$self->_beginWork();
|
||||
$self->dbh->do("UPDATE donor " .
|
||||
"SET $field = " . $self->dbh->quote($value, $type) . " " .
|
||||
"WHERE id = " . $self->dbh->quote($donorId, 'SQL_INTEGER'));
|
||||
$self->_commit;
|
||||
return $value;
|
||||
}
|
||||
######################################################################
|
||||
|
||||
=begin setPublicAck
|
||||
|
||||
Arguments:
|
||||
|
||||
=over
|
||||
|
||||
=item $donorId
|
||||
|
||||
Valid donor id number currently in the database. die() will occur if
|
||||
the id number is not in the database already as a donor id.
|
||||
|
||||
=item $publicAck
|
||||
|
||||
Can be true, false, or undef and will update public acknowledgement bit
|
||||
accordingly for donor identified with C<$donorId>.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
sub setPublicAck($$$) {
|
||||
return $_[0]->_setDonorField('public_ack', $_[1], $_[2], 'SQL_BOOLEAN');
|
||||
}
|
||||
######################################################################
|
||||
|
||||
=begin addPostalAddress
|
||||
|
||||
|
|
Loading…
Reference in a new issue