Lines 22-27
use Modern::Perl;
Link Here
|
22 |
use C4::Context; |
22 |
use C4::Context; |
23 |
use C4::Log qw( logaction ); |
23 |
use C4::Log qw( logaction ); |
24 |
|
24 |
|
|
|
25 |
use Koha::Database; |
25 |
use Koha::Patron::Restriction::Types; |
26 |
use Koha::Patron::Restriction::Types; |
26 |
use Koha::Patron::Restrictions; |
27 |
use Koha::Patron::Restrictions; |
27 |
|
28 |
|
Lines 102-121
Deletes a debarment.
Link Here
|
102 |
=cut |
103 |
=cut |
103 |
|
104 |
|
104 |
sub DelDebarment { |
105 |
sub DelDebarment { |
105 |
my ($id) = @_; |
106 |
my ($borrower_debarment_id) = @_; |
106 |
|
|
|
107 |
my $borrowernumber = _GetBorrowernumberByDebarmentId($id); |
108 |
|
107 |
|
109 |
my $sql = "DELETE FROM borrower_debarments WHERE borrower_debarment_id = ?"; |
108 |
my $restriction = Koha::Patron::Restrictions->find($borrower_debarment_id); |
110 |
|
109 |
|
111 |
my $r = C4::Context->dbh->do( $sql, {}, ($id) ); |
110 |
return unless $restriction; |
112 |
|
111 |
|
113 |
UpdateBorrowerDebarmentFlags($borrowernumber); |
112 |
Koha::Database->new->schema->txn_do( |
|
|
113 |
sub { |
114 |
my $borrowernumber = $restriction->borrowernumber; |
115 |
logaction( "MEMBERS", "DELETE_RESTRICTION", $borrowernumber, $restriction ) |
116 |
if C4::Context->preference("BorrowersLog"); |
114 |
|
117 |
|
115 |
logaction( "MEMBERS", "DELETE_RESTRICTION", $borrowernumber, q{} ) |
118 |
$restriction->delete; |
116 |
if C4::Context->preference("BorrowersLog"); |
119 |
UpdateBorrowerDebarmentFlags($borrowernumber); |
|
|
120 |
} |
121 |
); |
117 |
|
122 |
|
118 |
return $r; |
123 |
return 1; |
119 |
} |
124 |
} |
120 |
|
125 |
|
121 |
=head2 ModDebarment |
126 |
=head2 ModDebarment |