Lines 36-41
use C4::Members qw();
Link Here
|
36 |
use C4::Letters; |
36 |
use C4::Letters; |
37 |
use C4::Branch qw( GetBranchDetail ); |
37 |
use C4::Branch qw( GetBranchDetail ); |
38 |
use C4::Dates qw( format_date_in_iso ); |
38 |
use C4::Dates qw( format_date_in_iso ); |
|
|
39 |
|
40 |
use Koha::DateUtils; |
41 |
|
39 |
use List::MoreUtils qw( firstidx ); |
42 |
use List::MoreUtils qw( firstidx ); |
40 |
|
43 |
|
41 |
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); |
44 |
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); |
Lines 1517-1536
be cleared when it is unsuspended.
Link Here
|
1517 |
=cut |
1520 |
=cut |
1518 |
|
1521 |
|
1519 |
sub ToggleSuspend { |
1522 |
sub ToggleSuspend { |
1520 |
my ( $borrowernumber, $biblionumber ) = @_; |
1523 |
my ( $borrowernumber, $biblionumber, $suspend_until ) = @_; |
|
|
1524 |
|
1525 |
$suspend_until = output_pref( dt_from_string( $suspend_until ), 'iso' ) if ( $suspend_until ); |
1526 |
|
1527 |
my $do_until = ( $suspend_until ) ? '?' : 'NULL'; |
1521 |
|
1528 |
|
1522 |
my $dbh = C4::Context->dbh; |
1529 |
my $dbh = C4::Context->dbh; |
1523 |
|
1530 |
|
1524 |
my $sth = $dbh->prepare( |
1531 |
my $sth = $dbh->prepare( |
1525 |
"UPDATE reserves SET suspend = NOT suspend, |
1532 |
"UPDATE reserves SET suspend = NOT suspend, |
1526 |
suspend_until = CASE WHEN suspend = 0 THEN NULL ELSE suspend_until END |
1533 |
suspend_until = CASE WHEN suspend = 0 THEN NULL ELSE $do_until END |
1527 |
WHERE biblionumber = ? |
1534 |
WHERE biblionumber = ? |
1528 |
AND borrowernumber = ? |
1535 |
AND borrowernumber = ? |
1529 |
"); |
1536 |
"); |
1530 |
$sth->execute( |
1537 |
|
1531 |
$biblionumber, |
1538 |
my @params; |
1532 |
$borrowernumber, |
1539 |
push( @params, $suspend_until ) if ( $suspend_until ); |
1533 |
); |
1540 |
push( @params, $biblionumber ); |
|
|
1541 |
push( @params, $borrowernumber ); |
1542 |
|
1543 |
$sth->execute( @params ); |
1534 |
$sth->finish; |
1544 |
$sth->finish; |
1535 |
} |
1545 |
} |
1536 |
|
1546 |
|