View | Details | Raw Unified | Return to bug 31458
Collapse All | Expand All

(-)a/Koha/Patron.pm (-2 / +32 lines)
Lines 1223-1230 sub overdues { Link Here
1223
    );
1223
    );
1224
}
1224
}
1225
1225
1226
=head3 Patron Restrictions
1226
1227
1227
=head3 restrictions
1228
=head4 restrictions
1228
1229
1229
  my $restrictions = $patron->restrictions;
1230
  my $restrictions = $patron->restrictions;
1230
1231
Lines 1238-1243 sub restrictions { Link Here
1238
    return Koha::Patron::Restrictions->_new_from_dbic($restrictions_rs);
1239
    return Koha::Patron::Restrictions->_new_from_dbic($restrictions_rs);
1239
}
1240
}
1240
1241
1242
=head4 add_restriction
1243
1244
  my $new_restriction = $patron->add_restriction({});
1245
1246
Method to add a new restriction to a patrons account
1247
1248
=cut
1249
1250
sub add_restriction {
1251
    my ($self, $params) = @_;
1252
1253
    my $manager_id = $params->{'manager_id'};
1254
    $manager_id //= C4::Context->userenv ? C4::Context->userenv->{'number'} : undef;
1255
1256
    my $restriction_rs = $self->_result->add_to_borrower_debarments(
1257
        {
1258
            expiration => $params->{expiration},
1259
            type       => $params->{type},
1260
            comment    => $params->{comment},
1261
            manager_id => $manager_id,
1262
            created    => \'NOW()'
1263
        }
1264
    )->discard_changes;
1265
1266
    # FIXME: Drop this next
1267
    Koha::Patron::Debarments::UpdateBorrowerDebarmentFlags($self->borrowernumber);
1268
1269
    return Koha::Patron::Restriction->_new_from_dbic($restriction_rs);
1270
}
1271
1241
=head3 get_routing_lists
1272
=head3 get_routing_lists
1242
1273
1243
my $routinglists = $patron->get_routing_lists
1274
my $routinglists = $patron->get_routing_lists
1244
- 

Return to bug 31458