Lines 22-27
use Modern::Perl;
Link Here
|
22 |
use C4::Context; |
22 |
use C4::Context; |
23 |
|
23 |
|
24 |
use Koha::Patron::Restriction::Types; |
24 |
use Koha::Patron::Restriction::Types; |
|
|
25 |
use Koha::Patron::Restrictions; |
25 |
|
26 |
|
26 |
our ( @ISA, @EXPORT_OK ); |
27 |
our ( @ISA, @EXPORT_OK ); |
27 |
|
28 |
|
Lines 73-88
sub AddDebarment {
Link Here
|
73 |
my $manager_id; |
74 |
my $manager_id; |
74 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
75 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
75 |
|
76 |
|
76 |
my $sql = " |
77 |
my $restriction = Koha::Patron::Restriction->new( |
77 |
INSERT INTO borrower_debarments ( borrowernumber, expiration, type, comment, manager_id, created ) |
78 |
{ |
78 |
VALUES ( ?, ?, ?, ?, ?, NOW() ) |
79 |
borrowernumber => $borrowernumber, |
79 |
"; |
80 |
expiration => $expiration, |
80 |
|
81 |
type => $type, |
81 |
my $r = C4::Context->dbh->do( $sql, {}, ( $borrowernumber, $expiration, $type, $comment, $manager_id ) ); |
82 |
comment => $comment, |
|
|
83 |
manager_id => $manager_id, |
84 |
} |
85 |
)->store(); |
82 |
|
86 |
|
83 |
UpdateBorrowerDebarmentFlags($borrowernumber); |
87 |
UpdateBorrowerDebarmentFlags($borrowernumber); |
84 |
|
88 |
|
85 |
return $r; |
89 |
return $restriction ? 1 : 0; |
86 |
} |
90 |
} |
87 |
|
91 |
|
88 |
=head2 DelDebarment |
92 |
=head2 DelDebarment |
89 |
- |
|
|