|
Lines 1247-1252
Method to add a new restriction to a patrons account
Link Here
|
| 1247 |
|
1247 |
|
| 1248 |
=cut |
1248 |
=cut |
| 1249 |
|
1249 |
|
|
|
1250 |
sub _update_patron_restriction_fields { |
| 1251 |
my $self = $_; |
| 1252 |
|
| 1253 |
# OPTION ONE |
| 1254 |
my $restrictions = $self->restrictions->search( |
| 1255 |
{ expiration => [ undef, { '>=' => \'CURRENT_DATE()' } ] }, |
| 1256 |
{ |
| 1257 |
order_by => [ |
| 1258 |
{ '-desc' => \'expiration IS NULL' }, |
| 1259 |
{ '-desc' => 'expiration' } |
| 1260 |
], |
| 1261 |
rows => 1 |
| 1262 |
} |
| 1263 |
); |
| 1264 |
|
| 1265 |
# OPTION TWO |
| 1266 |
# my $restrictions = $self->restrictions->search( |
| 1267 |
# { expiration => [ undef, { '>=' => \'CURRENT_DATE()' } ] }, |
| 1268 |
# { |
| 1269 |
# order_by => { '-desc' => [ \'expiration IS NULL', 'expiration' ] }, |
| 1270 |
# rows => 1 |
| 1271 |
# } |
| 1272 |
#); |
| 1273 |
|
| 1274 |
my ( $expiration, $comment ); |
| 1275 |
if ( my $restriction = $restrictions->next ) { |
| 1276 |
$expiration = |
| 1277 |
defined( $restriction->expiration ) |
| 1278 |
? $restriction->expiration |
| 1279 |
: '9999-12-31'; |
| 1280 |
$comment = $restriction->comment; |
| 1281 |
} |
| 1282 |
$self->set( { debarred => $expiration, debarredcomment => $comment } ) |
| 1283 |
->store; |
| 1284 |
} |
| 1285 |
|
| 1250 |
sub add_restriction { |
1286 |
sub add_restriction { |
| 1251 |
my ($self, $params) = @_; |
1287 |
my ($self, $params) = @_; |
| 1252 |
|
1288 |
|
| 1253 |
- |
|
|