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

(-)a/C4/Circulation.pm (-2 / +2 lines)
Lines 3232-3244 $code is either itemtype or collection code depending on what the pref BranchTra Link Here
3232
3232
3233
sub CreateBranchTransferLimit {
3233
sub CreateBranchTransferLimit {
3234
   my ( $toBranch, $fromBranch, $code ) = @_;
3234
   my ( $toBranch, $fromBranch, $code ) = @_;
3235
3235
   return unless ($toBranch && $fromBranch);
3236
   my $limitType = C4::Context->preference("BranchTransferLimitsType");
3236
   my $limitType = C4::Context->preference("BranchTransferLimitsType");
3237
   
3237
   
3238
   my $dbh = C4::Context->dbh;
3238
   my $dbh = C4::Context->dbh;
3239
   
3239
   
3240
   my $sth = $dbh->prepare("INSERT INTO branch_transfer_limits ( $limitType, toBranch, fromBranch ) VALUES ( ?, ?, ? )");
3240
   my $sth = $dbh->prepare("INSERT INTO branch_transfer_limits ( $limitType, toBranch, fromBranch ) VALUES ( ?, ?, ? )");
3241
   $sth->execute( $code, $toBranch, $fromBranch );
3241
   return $sth->execute( $code, $toBranch, $fromBranch );
3242
}
3242
}
3243
3243
3244
=head2 DeleteBranchTransferLimits
3244
=head2 DeleteBranchTransferLimits
(-)a/t/db_dependent/Circulation_transfers.t (-4 / +10 lines)
Lines 9-15 use C4::Circulation; Link Here
9
use Koha::DateUtils;
9
use Koha::DateUtils;
10
use DateTime::Duration;
10
use DateTime::Duration;
11
11
12
use Test::More tests => 12;
12
use Test::More tests => 15;
13
13
14
BEGIN {
14
BEGIN {
15
    use_ok('C4::Circulation');
15
    use_ok('C4::Circulation');
Lines 129-136 is( Link Here
129
    1,
129
    1,
130
    "A Branch TransferLimit has been added"
130
    "A Branch TransferLimit has been added"
131
);
131
);
132
#FIXME :The following test should pass but doesn't because currently the routine CreateBranchTransferLimit returns nothing
132
is(CreateBranchTransferLimit(),undef,
133
#is(CreateBranchTransferLimit(),undef,"Without parameters CreateBranchTransferLimit returns undef");
133
    "Without parameters CreateBranchTransferLimit returns undef");
134
is(CreateBranchTransferLimit($samplebranch2->{branchcode}),undef,
135
    "With only tobranch CreateBranchTransferLimit returns undef");
136
is(CreateBranchTransferLimit(undef,$samplebranch2->{branchcode}),undef,
137
    "With only frombranch CreateBranchTransferLimit returns undef");
138
#FIXME: Currently, we can add a transferlimit even to nonexistent branches because in the database,
139
#branch_transfer_limits.toBranch and branch_transfer_limits.fromBranch aren't foreign keys
140
#is(CreateBranchTransferLimit(-1,-1,'CODE'),0,"With wrong CreateBranchTransferLimit returns 0 - No transfertlimit added");
134
141
135
#Test GetTransfers
142
#Test GetTransfers
136
my $dt_today = dt_from_string( undef, 'sql', undef );
143
my $dt_today = dt_from_string( undef, 'sql', undef );
137
- 

Return to bug 10693