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

(-)a/C4/Circulation.pm (+3 lines)
Lines 1051-1056 sub CanBookBeIssued { Link Here
1051
                    $needsconfirmation{'resreservedate'} = $res->{reservedate};
1051
                    $needsconfirmation{'resreservedate'} = $res->{reservedate};
1052
                    $needsconfirmation{'reserve_id'} = $res->{reserve_id};
1052
                    $needsconfirmation{'reserve_id'} = $res->{reserve_id};
1053
                }
1053
                }
1054
                elsif ( $restype eq "Processing" && C4::Context->interface eq 'sip' ) {
1055
                    $issuingimpossible{PROCESSING} = 1;
1056
                }
1054
            }
1057
            }
1055
        }
1058
        }
1056
    }
1059
    }
(-)a/C4/Reserves.pm (-9 / +16 lines)
Lines 709-714 sub GetReserveStatus { Link Here
709
709
710
    if(defined $found) {
710
    if(defined $found) {
711
        return 'Waiting'  if $found eq 'W' and $priority == 0;
711
        return 'Waiting'  if $found eq 'W' and $priority == 0;
712
        return 'Processing'  if $found eq 'P';
712
        return 'Finished' if $found eq 'F';
713
        return 'Finished' if $found eq 'F';
713
    }
714
    }
714
715
Lines 823-829 sub CheckReserves { Link Here
823
            if ( $res->{'itemnumber'} && $res->{'itemnumber'} == $itemnumber && $res->{'priority'} == 0) {
824
            if ( $res->{'itemnumber'} && $res->{'itemnumber'} == $itemnumber && $res->{'priority'} == 0) {
824
                if ($res->{'found'} eq 'W') {
825
                if ($res->{'found'} eq 'W') {
825
                    return ( "Waiting", $res, \@reserves ); # Found it, it is waiting
826
                    return ( "Waiting", $res, \@reserves ); # Found it, it is waiting
826
                } else {
827
                } elsif ($res->{'found'} eq 'P') {
828
                    return ( "Processing", $res, \@reserves ); # Found determinated hold, e. g. the tranferred one
829
                 } else {
827
                    return ( "Reserved", $res, \@reserves ); # Found determinated hold, e. g. the tranferred one
830
                    return ( "Reserved", $res, \@reserves ); # Found determinated hold, e. g. the tranferred one
828
                }
831
                }
829
            } else {
832
            } else {
Lines 1151-1157 sub ModReserveAffect { Link Here
1151
1154
1152
    $hold->itemnumber($itemnumber);
1155
    $hold->itemnumber($itemnumber);
1153
1156
1154
    if( !$transferToDo ){
1157
    if ($transferToDo) {
1158
        $hold->set_transfer();
1159
    } elsif (C4::Context->preference('HoldsNeedProcessingSIP')
1160
             && C4::Context->interface eq 'sip'
1161
             && !$already_on_shelf) {
1162
        $hold->set_processing();
1163
    } else {
1155
        $hold->set_waiting();
1164
        $hold->set_waiting();
1156
        _koha_notify_reserve( $hold->reserve_id ) unless $already_on_shelf;
1165
        _koha_notify_reserve( $hold->reserve_id ) unless $already_on_shelf;
1157
        my $transfers = Koha::Item::Transfers->search({
1166
        my $transfers = Koha::Item::Transfers->search({
Lines 1161-1169 sub ModReserveAffect { Link Here
1161
        while( my $transfer = $transfers->next ){
1170
        while( my $transfer = $transfers->next ){
1162
            $transfer->datearrived( dt_from_string() )->store;
1171
            $transfer->datearrived( dt_from_string() )->store;
1163
        };
1172
        };
1164
     } else {
1173
    }
1165
        $hold->set_transfer();
1166
     }
1167
1174
1168
1175
1169
    _FixPriority( { biblionumber => $biblionumber } );
1176
    _FixPriority( { biblionumber => $biblionumber } );
Lines 1536-1542 sub _FixPriority { Link Here
1536
            UPDATE reserves
1543
            UPDATE reserves
1537
            SET    priority = 0
1544
            SET    priority = 0
1538
            WHERE reserve_id = ?
1545
            WHERE reserve_id = ?
1539
            AND found IN ('W', 'T')
1546
            AND found IN ('W', 'T', 'P')
1540
        ";
1547
        ";
1541
        my $sth = $dbh->prepare($query);
1548
        my $sth = $dbh->prepare($query);
1542
        $sth->execute( $reserve_id );
1549
        $sth->execute( $reserve_id );
Lines 1548-1554 sub _FixPriority { Link Here
1548
        SELECT reserve_id, borrowernumber, reservedate
1555
        SELECT reserve_id, borrowernumber, reservedate
1549
        FROM   reserves
1556
        FROM   reserves
1550
        WHERE  biblionumber   = ?
1557
        WHERE  biblionumber   = ?
1551
          AND  ((found <> 'W' AND found <> 'T') OR found IS NULL)
1558
          AND  ((found <> 'W' AND found <> 'T' AND found <> 'P') OR found IS NULL)
1552
        ORDER BY priority ASC
1559
        ORDER BY priority ASC
1553
    ";
1560
    ";
1554
    my $sth = $dbh->prepare($query);
1561
    my $sth = $dbh->prepare($query);
Lines 1960-1966 sub MergeHolds { Link Here
1960
"UPDATE reserves SET priority = ? WHERE biblionumber = ? AND borrowernumber = ?
1967
"UPDATE reserves SET priority = ? WHERE biblionumber = ? AND borrowernumber = ?
1961
        AND reservedate = ? AND (itemnumber = ? or itemnumber is NULL) "
1968
        AND reservedate = ? AND (itemnumber = ? or itemnumber is NULL) "
1962
        );
1969
        );
1963
        $sth->execute( $to_biblio, 'W', 'T' );
1970
        $sth->execute( $to_biblio, 'W', 'T', 'P' );
1964
        my $priority = 1;
1971
        my $priority = 1;
1965
        while ( my $reserve = $sth->fetchrow_hashref() ) {
1972
        while ( my $reserve = $sth->fetchrow_hashref() ) {
1966
            $upd_sth->execute(
1973
            $upd_sth->execute(
Lines 2142-2148 sub CalculatePriority { Link Here
2142
        AND   priority > 0
2149
        AND   priority > 0
2143
        AND   (found IS NULL OR found = '')
2150
        AND   (found IS NULL OR found = '')
2144
    };
2151
    };
2145
    #skip found==W or found==T (waiting or transit holds)
2152
    #skip found==W or found==T or found==P (waiting, transit or processing holds)
2146
    if( $resdate ) {
2153
    if( $resdate ) {
2147
        $sql.= ' AND ( reservedate <= ? )';
2154
        $sql.= ' AND ( reservedate <= ? )';
2148
    }
2155
    }
(-)a/C4/RotatingCollections.pm (-1 / +1 lines)
Lines 446-452 sub TransferCollection { Link Here
446
    while ( my $item = $sth->fetchrow_hashref ) {
446
    while ( my $item = $sth->fetchrow_hashref ) {
447
        my ($status) = CheckReserves( $item->{itemnumber} );
447
        my ($status) = CheckReserves( $item->{itemnumber} );
448
        my @transfers = C4::Circulation::GetTransfers( $item->{itemnumber} );
448
        my @transfers = C4::Circulation::GetTransfers( $item->{itemnumber} );
449
        C4::Circulation::transferbook( $colBranchcode, $item->{barcode}, 1, 'RotatingCollection' ) unless ( $status eq 'Waiting' || @transfers );
449
        C4::Circulation::transferbook( $colBranchcode, $item->{barcode}, 1, 'RotatingCollection' ) unless ( $status eq 'Waiting' || $status eq 'Processing' || @transfers );
450
    }
450
    }
451
451
452
    return 1;
452
    return 1;
(-)a/Koha/Hold.pm (-2 / +33 lines)
Lines 94-99 sub suspend_hold { Link Here
94
        elsif ( $self->is_in_transit ) {
94
        elsif ( $self->is_in_transit ) {
95
            Koha::Exceptions::Hold::CannotSuspendFound->throw( status => 'T' );
95
            Koha::Exceptions::Hold::CannotSuspendFound->throw( status => 'T' );
96
        }
96
        }
97
        elsif ( $self->is_in_processing ) {
98
            Koha::Exceptions::Hold::CannotSuspendFound->throw( status => 'P' );
99
        }
97
        else {
100
        else {
98
            Koha::Exceptions::Hold::CannotSuspendFound->throw(
101
            Koha::Exceptions::Hold::CannotSuspendFound->throw(
99
                      'Unhandled data exception on found hold (id='
102
                      'Unhandled data exception on found hold (id='
Lines 215-223 sub set_waiting { Link Here
215
    return $self;
218
    return $self;
216
}
219
}
217
220
221
=head3 set_processing
222
223
=cut
224
225
sub set_processing {
226
    my ( $self ) = @_;
227
228
    $self->priority(0);
229
    $self->found('P');
230
    $self->store();
231
232
    return $self;
233
}
234
218
=head3 is_found
235
=head3 is_found
219
236
220
Returns true if hold is a waiting or in transit
237
Returns true if hold is waiting, in transit or in processing
221
238
222
=cut
239
=cut
223
240
Lines 227-232 sub is_found { Link Here
227
    return 0 unless $self->found();
244
    return 0 unless $self->found();
228
    return 1 if $self->found() eq 'W';
245
    return 1 if $self->found() eq 'W';
229
    return 1 if $self->found() eq 'T';
246
    return 1 if $self->found() eq 'T';
247
    return 1 if $self->found() eq 'P';
230
}
248
}
231
249
232
=head3 is_waiting
250
=head3 is_waiting
Lines 255-260 sub is_in_transit { Link Here
255
    return $self->found() eq 'T';
273
    return $self->found() eq 'T';
256
}
274
}
257
275
276
=head3 is_in_processing
277
278
Returns true if hold is a in_processing hold
279
280
=cut
281
282
sub is_in_processing {
283
    my ($self) = @_;
284
285
    return 0 unless $self->found();
286
    return $self->found() eq 'P';
287
}
288
258
=head3 is_cancelable_from_opac
289
=head3 is_cancelable_from_opac
259
290
260
Returns true if hold is a cancelable hold
291
Returns true if hold is a cancelable hold
Lines 269-275 sub is_cancelable_from_opac { Link Here
269
    my ($self) = @_;
300
    my ($self) = @_;
270
301
271
    return 1 unless $self->is_found();
302
    return 1 unless $self->is_found();
272
    return 0; # if ->is_in_transit or if ->is_waiting
303
    return 0; # if ->is_in_transit or if ->is_waiting or ->is_in_processing
273
}
304
}
274
305
275
=head3 is_at_destination
306
=head3 is_at_destination
(-)a/installer/data/mysql/atomicupdate/bug_12556.perl (+8 lines)
Line 0 Link Here
1
$DBversion = 'XXX'; # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
    $dbh->do(q{
4
        INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
5
        ('HoldsNeedProcessingSIP', '0', NULL, 'Require staff to check-in before hold is set to waiting state', 'YesNo' )
6
    });
7
    NewVersion( $DBversion, 12556, "Add new syspref HoldsNeedProcessingSIP");
8
}
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 224-229 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
224
('HoldsAutoFill','0',NULL,'If on, librarian will not be asked if hold should be filled, it will be filled automatically','YesNo'),
224
('HoldsAutoFill','0',NULL,'If on, librarian will not be asked if hold should be filled, it will be filled automatically','YesNo'),
225
('HoldsAutoFillPrintSlip','0',NULL,'If on, hold slip print dialog will be displayed automatically','YesNo'),
225
('HoldsAutoFillPrintSlip','0',NULL,'If on, hold slip print dialog will be displayed automatically','YesNo'),
226
('HoldsLog','0',NULL,'If ON, log create/cancel/suspend/resume actions on holds.','YesNo'),
226
('HoldsLog','0',NULL,'If ON, log create/cancel/suspend/resume actions on holds.','YesNo'),
227
('HoldsNeedProcessingSIP', '0', NULL, 'Require staff to check-in before hold is set to waiting state', 'YesNo' ),
227
('HoldsQueueSkipClosed', '0', NULL, 'If enabled, any libraries that are closed when the holds queue is built will be ignored for the purpose of filling holds.', 'YesNo'),
228
('HoldsQueueSkipClosed', '0', NULL, 'If enabled, any libraries that are closed when the holds queue is built will be ignored for the purpose of filling holds.', 'YesNo'),
228
('HoldsSplitQueue','nothing','nothing|branch|itemtype|branch_itemtype','In the staff client, split the holds view by the given criteria','Choice'),
229
('HoldsSplitQueue','nothing','nothing|branch|itemtype|branch_itemtype','In the staff client, split the holds view by the given criteria','Choice'),
229
('HoldsToPullStartDate','2',NULL,'Set the default start date for the Holds to pull list to this many days ago','Integer'),
230
('HoldsToPullStartDate','2',NULL,'Set the default start date for the Holds to pull list to this many days ago','Integer'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc (-5 / +5 lines)
Lines 39-44 Link Here
39
                    [% IF ( hold.found ) %]
39
                    [% IF ( hold.found ) %]
40
                        [% IF ( hold.intransit ) %]
40
                        [% IF ( hold.intransit ) %]
41
                            <option value="T" selected="selected">In transit</option>
41
                            <option value="T" selected="selected">In transit</option>
42
                        [% ELSIF (hold.inprocessing) %]
43
                            <option value="P" selected="selected">In processing</option>
42
                        [% ELSE %]
44
                        [% ELSE %]
43
                            <option value="W" selected="selected">Waiting</option>
45
                            <option value="W" selected="selected">Waiting</option>
44
                        [% END %]
46
                        [% END %]
Lines 118-130 Link Here
118
            <td>
120
            <td>
119
                [% IF ( hold.found ) %]
121
                [% IF ( hold.found ) %]
120
                    [% IF ( hold.atdestination ) %]
122
                    [% IF ( hold.atdestination ) %]
121
                        [% IF ( hold.found ) %]
122
                            Item waiting at <b> [% hold.wbrname | html %]</b> <input type="hidden" name="pickup" value="[% hold.wbrcode | html %]" /> since [% hold.waiting_date | $KohaDates %]
123
                            Item waiting at <b> [% hold.wbrname | html %]</b> <input type="hidden" name="pickup" value="[% hold.wbrcode | html %]" /> since [% hold.waiting_date | $KohaDates %]
123
                        [% ELSE %]
124
                    [% ELSIF (hold.intransit) %]
124
                            Waiting to be pulled <input type="hidden" name="pickup" value="[% hold.wbrcode | html %]" />
125
                        [% END %]
126
                    [% ELSE %]
127
                        Item being transferred to <b> [% hold.wbrname | html %]</b> <input type="hidden" name="pickup" value="[% hold.wbrcode | html %]" />
125
                        Item being transferred to <b> [% hold.wbrname | html %]</b> <input type="hidden" name="pickup" value="[% hold.wbrcode | html %]" />
126
                    [% ELSIF (hold.inprocessing) %]
127
                        Item being processed at <b> [% hold.wbrname | html %]</b> <input type="hidden" name="pickup" value="[% hold.wbrcode | html %]" />
128
                    [% END %]
128
                    [% END %]
129
                [% ELSE %]
129
                [% ELSE %]
130
                    [% IF Koha.Preference('IndependentBranches') && Branches.all().size == 1 %]
130
                    [% IF Koha.Preference('IndependentBranches') && Branches.all().size == 1 %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+6 lines)
Lines 539-544 Circulation: Link Here
539
                  no: "Don't"
539
                  no: "Don't"
540
            - automatically fill holds instead of asking the librarian.
540
            - automatically fill holds instead of asking the librarian.
541
        -
541
        -
542
            - pref: HoldsNeedProcessingSIP
543
              choices:
544
                  yes: "Don't fulfill"
545
                  no: Fulfill
546
            - holds automatically if matching item is returned via SIP protocol.
547
        -
542
            - pref: HoldsAutoFillPrintSlip
548
            - pref: HoldsAutoFillPrintSlip
543
              choices:
549
              choices:
544
                  yes: Do
550
                  yes: Do
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/holdshistory.tt (+2 lines)
Lines 99-104 Link Here
99
              Cancelled
99
              Cancelled
100
          [% ELSIF hold.found == 'W' %]
100
          [% ELSIF hold.found == 'W' %]
101
              Waiting
101
              Waiting
102
          [% ELSIF hold.found == 'P' %]
103
              Processing
102
          [% ELSIF hold.found == 'T' %]
104
          [% ELSIF hold.found == 'T' %]
103
              In transit
105
              In transit
104
          [% ELSE %]
106
          [% ELSE %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc (-1 / +3 lines)
Lines 34-40 Link Here
34
            <tbody>
34
            <tbody>
35
                [% SET all_holds_waiting = 1 %]
35
                [% SET all_holds_waiting = 1 %]
36
                [% FOREACH HOLD IN HOLDS %]
36
                [% FOREACH HOLD IN HOLDS %]
37
                    [% UNLESS ( HOLD.is_waiting || HOLD.is_in_transit ) %]
37
                    [% UNLESS ( HOLD.is_waiting || HOLD.is_in_transit || HOLD.is_in_processing) %]
38
                        [% SET all_holds_waiting = 0 %]
38
                        [% SET all_holds_waiting = 0 %]
39
                    [% END %]
39
                    [% END %]
40
                    [% IF ( HOLD.is_at_destination ) %]
40
                    [% IF ( HOLD.is_at_destination ) %]
Lines 114-119 Link Here
114
                                    [% SET transfer = HOLD.item.get_transfer %]
114
                                    [% SET transfer = HOLD.item.get_transfer %]
115
                                    Item in transit from <strong> [% Branches.GetName( transfer.frombranch ) | html %]</strong> since
115
                                    Item in transit from <strong> [% Branches.GetName( transfer.frombranch ) | html %]</strong> since
116
                                    [% transfer.datesent | $KohaDates %]
116
                                    [% transfer.datesent | $KohaDates %]
117
                                [% ELSIF ( HOLD.is_in_processing ) %]
118
                                    Item in processing
117
                                [% ELSIF ( HOLD.suspend ) %]
119
                                [% ELSIF ( HOLD.suspend ) %]
118
                                    Suspended [% IF ( HOLD.suspend_until ) %] until [% HOLD.suspend_until | $KohaDates %] [% END %]
120
                                    Suspended [% IF ( HOLD.suspend_until ) %] until [% HOLD.suspend_until | $KohaDates %] [% END %]
119
                                [% ELSE %]
121
                                [% ELSE %]
(-)a/reserve/request.pl (+1 lines)
Lines 665-670 foreach my $biblionumber (@biblionumbers) { Link Here
665
            $reserve{'wbrname'}       = $res->branch()->branchname();
665
            $reserve{'wbrname'}       = $res->branch()->branchname();
666
            $reserve{'atdestination'} = $res->is_at_destination();
666
            $reserve{'atdestination'} = $res->is_at_destination();
667
            $reserve{'found'}     = $res->is_found();
667
            $reserve{'found'}     = $res->is_found();
668
            $reserve{'inprocessing'} = $res->is_in_processing();
668
            $reserve{'intransit'} = $res->is_in_transit();
669
            $reserve{'intransit'} = $res->is_in_transit();
669
        }
670
        }
670
        elsif ( $res->priority() > 0 ) {
671
        elsif ( $res->priority() > 0 ) {
(-)a/t/db_dependent/Hold.t (-3 / +18 lines)
Lines 29-35 use Koha::Item; Link Here
29
use Koha::DateUtils;
29
use Koha::DateUtils;
30
use t::lib::TestBuilder;
30
use t::lib::TestBuilder;
31
31
32
use Test::More tests => 29;
32
use Test::More tests => 33;
33
use Test::Exception;
33
use Test::Exception;
34
use Test::Warn;
34
use Test::Warn;
35
35
Lines 112-121 isnt( $hold->is_waiting, 1, 'The hold is not waiting (T)' ); Link Here
112
is( $hold->is_found, 1, 'The hold is found');
112
is( $hold->is_found, 1, 'The hold is found');
113
is( $hold->is_in_transit, 1, 'The hold is in transit' );
113
is( $hold->is_in_transit, 1, 'The hold is in transit' );
114
114
115
$hold->found('P');
116
is( $hold->is_found, 1, 'The hold is found');
117
is( $hold->is_in_processing, 1, 'The hold is in processing' );
118
115
$hold->found(q{});
119
$hold->found(q{});
116
isnt( $hold->is_waiting, 1, 'The hold is not waiting (W)' );
120
isnt( $hold->is_waiting, 1, 'The hold is not waiting (W)' );
117
is( $hold->is_found, 0, 'The hold is not found' );
121
is( $hold->is_found, 0, 'The hold is not found' );
118
ok( !$hold->is_in_transit, 'The hold is not in transit' );
122
ok( !$hold->is_in_transit, 'The hold is not in transit' );
123
ok( !$hold->is_in_processing, 'The hold is not in processing' );
119
124
120
# Test method is_cancelable_from_opac
125
# Test method is_cancelable_from_opac
121
$hold->found(undef);
126
$hold->found(undef);
Lines 124-129 $hold->found('W'); Link Here
124
is( $hold->is_cancelable_from_opac, 0, "Waiting hold is not cancelable" );
129
is( $hold->is_cancelable_from_opac, 0, "Waiting hold is not cancelable" );
125
$hold->found('T');
130
$hold->found('T');
126
is( $hold->is_cancelable_from_opac, 0, "In transit hold is not cancelable" );
131
is( $hold->is_cancelable_from_opac, 0, "In transit hold is not cancelable" );
132
$hold->found('P');
133
is( $hold->is_cancelable_from_opac, 0, "In processing hold is not cancelable" );
127
134
128
# Test method is_at_destination
135
# Test method is_at_destination
129
$hold->found(undef);
136
$hold->found(undef);
Lines 178-184 subtest "delete() tests" => sub { Link Here
178
185
179
subtest 'suspend() tests' => sub {
186
subtest 'suspend() tests' => sub {
180
187
181
    plan tests => 16;
188
    plan tests => 18;
182
189
183
    $schema->storage->txn_begin;
190
    $schema->storage->txn_begin;
184
191
Lines 232-237 subtest 'suspend() tests' => sub { Link Here
232
239
233
    is( $@->status, 'T', 'Exception gets the \'status\' parameter set correctly' );
240
    is( $@->status, 'T', 'Exception gets the \'status\' parameter set correctly' );
234
241
242
    # set hold found=T
243
    $hold->set_processing();
244
    throws_ok
245
        { $hold->suspend_hold; }
246
        'Koha::Exceptions::Hold::CannotSuspendFound',
247
        'Exception is thrown when a found hold is tried to suspend';
248
249
    is( $@->status, 'P', 'Exception gets the \'status\' parameter set correctly' );
250
235
    my $holds_module = Test::MockModule->new('Koha::Hold');
251
    my $holds_module = Test::MockModule->new('Koha::Hold');
236
    $holds_module->mock( 'is_found', 1 );
252
    $holds_module->mock( 'is_found', 1 );
237
253
238
- 

Return to bug 12556