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

(-)a/t/db_dependent/Circulation/SwitchOnSiteCheckouts.t (-2 / +24 lines)
Lines 15-21 Link Here
15
# with Koha; if not, see <http://www.gnu.org/licenses>.
15
# with Koha; if not, see <http://www.gnu.org/licenses>.
16
16
17
use Modern::Perl;
17
use Modern::Perl;
18
use Test::More tests => 9;
18
use Test::More tests => 10;
19
use C4::Context;
19
use C4::Context;
20
20
21
use C4::Biblio;
21
use C4::Biblio;
Lines 53-58 my $patron = $builder->build({ Link Here
53
    source => 'Borrower',
53
    source => 'Borrower',
54
    value => {
54
    value => {
55
        branchcode => $branch->{branchcode},
55
        branchcode => $branch->{branchcode},
56
        debarred => undef,
56
    },
57
    },
57
});
58
});
58
59
Lines 68-73 my $item = $builder->build({ Link Here
68
        biblionumber => $biblio->{biblionumber},
69
        biblionumber => $biblio->{biblionumber},
69
        homebranch => $branch->{branchcode},
70
        homebranch => $branch->{branchcode},
70
        holdingbranch => $branch->{branchcode},
71
        holdingbranch => $branch->{branchcode},
72
        notforloan => 0,
73
        withdrawn => 0,
74
        lost => 0,
71
    },
75
    },
72
});
76
});
73
77
Lines 87-92 my $issuingrule = $builder->build({ Link Here
87
C4::Context->_new_userenv ('DUMMY_SESSION_ID');
91
C4::Context->_new_userenv ('DUMMY_SESSION_ID');
88
C4::Context->set_userenv($patron->{borrowernumber}, $patron->{userid}, 'usercnum', 'First name', 'Surname', $branch->{branchcode}, 'My Library', 0);
92
C4::Context->set_userenv($patron->{borrowernumber}, $patron->{userid}, 'usercnum', 'First name', 'Surname', $branch->{branchcode}, 'My Library', 0);
89
93
94
t::lib::Mocks::mock_preference('AllowTooManyOverride', 0);
95
90
# Add onsite checkout
96
# Add onsite checkout
91
C4::Circulation::AddIssue( $patron, $item->{barcode}, dt_from_string, undef, dt_from_string, undef, { onsite_checkout => 1 } );
97
C4::Circulation::AddIssue( $patron, $item->{barcode}, dt_from_string, undef, dt_from_string, undef, { onsite_checkout => 1 } );
92
98
Lines 113-118 my $another_item = $builder->build({ Link Here
113
        biblionumber => $biblio->{biblionumber},
119
        biblionumber => $biblio->{biblionumber},
114
        homebranch => $branch->{branchcode},
120
        homebranch => $branch->{branchcode},
115
        holdingbranch => $branch->{branchcode},
121
        holdingbranch => $branch->{branchcode},
122
        notforloan => 0,
123
        withdrawn => 0,
124
        lost => 0,
116
    },
125
    },
117
});
126
});
118
127
Lines 121-126 C4::Circulation::AddIssue( $patron, $another_item->{barcode}, dt_from_string, un Link Here
121
is( $messages->{ONSITE_CHECKOUT_WILL_BE_SWITCHED}, 1, 'Specific case 1 - Switch is allowed' );
130
is( $messages->{ONSITE_CHECKOUT_WILL_BE_SWITCHED}, 1, 'Specific case 1 - Switch is allowed' );
122
is( exists $impossible->{TOO_MANY}, '', 'Specific case 1 - Switch is allowed' );
131
is( exists $impossible->{TOO_MANY}, '', 'Specific case 1 - Switch is allowed' );
123
132
133
my $yet_another_item = $builder->build({
134
    source => 'Item',
135
    value => {
136
        biblionumber => $biblio->{biblionumber},
137
        homebranch => $branch->{branchcode},
138
        holdingbranch => $branch->{branchcode},
139
        notforloan => 0,
140
        withdrawn => 0,
141
        lost => 0,
142
    },
143
});
144
( $impossible, undef, undef, undef ) = C4::Circulation::CanBookBeIssued( $patron, $yet_another_item->{barcode} );
145
is( $impossible->{TOO_MANY}, 'TOO_MANY_CHECKOUTS', 'Not a specific case, $delta should not be incremented' );
146
124
$dbh->do(q|DELETE FROM issuingrules|);
147
$dbh->do(q|DELETE FROM issuingrules|);
125
my $borrower_circ_rule = $builder->build({
148
my $borrower_circ_rule = $builder->build({
126
    source => 'DefaultCircRule',
149
    source => 'DefaultCircRule',
127
- 

Return to bug 18321