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

(-)a/C4/Circulation.pm (+3 lines)
Lines 1105-1110 sub CanBookBeIssued { Link Here
1105
                    $needsconfirmation{'resreservedate'} = $res->{reservedate};
1105
                    $needsconfirmation{'resreservedate'} = $res->{reservedate};
1106
                    $needsconfirmation{'reserve_id'} = $res->{reserve_id};
1106
                    $needsconfirmation{'reserve_id'} = $res->{reserve_id};
1107
                }
1107
                }
1108
                elsif ( $restype eq "Processing" && C4::Context->interface eq 'sip' ) {
1109
                    $issuingimpossible{PROCESSING} = 1;
1110
                }
1108
            }
1111
            }
1109
        }
1112
        }
1110
    }
1113
    }
(-)a/C4/Reserves.pm (-9 / +16 lines)
Lines 712-717 sub GetReserveStatus { Link Here
712
712
713
    if(defined $found) {
713
    if(defined $found) {
714
        return 'Waiting'  if $found eq 'W' and $priority == 0;
714
        return 'Waiting'  if $found eq 'W' and $priority == 0;
715
        return 'Processing'  if $found eq 'P';
715
        return 'Finished' if $found eq 'F';
716
        return 'Finished' if $found eq 'F';
716
    }
717
    }
717
718
Lines 826-832 sub CheckReserves { Link Here
826
            if ( $res->{'itemnumber'} && $res->{'itemnumber'} == $itemnumber && $res->{'priority'} == 0) {
827
            if ( $res->{'itemnumber'} && $res->{'itemnumber'} == $itemnumber && $res->{'priority'} == 0) {
827
                if ($res->{'found'} eq 'W') {
828
                if ($res->{'found'} eq 'W') {
828
                    return ( "Waiting", $res, \@reserves ); # Found it, it is waiting
829
                    return ( "Waiting", $res, \@reserves ); # Found it, it is waiting
829
                } else {
830
                } elsif ($res->{'found'} eq 'P') {
831
                    return ( "Processing", $res, \@reserves ); # Found determinated hold, e. g. the tranferred one
832
                 } else {
830
                    return ( "Reserved", $res, \@reserves ); # Found determinated hold, e. g. the tranferred one
833
                    return ( "Reserved", $res, \@reserves ); # Found determinated hold, e. g. the tranferred one
831
                }
834
                }
832
            } else {
835
            } else {
Lines 1154-1160 sub ModReserveAffect { Link Here
1154
1157
1155
    $hold->itemnumber($itemnumber);
1158
    $hold->itemnumber($itemnumber);
1156
1159
1157
    if( !$transferToDo ){
1160
    if ($transferToDo) {
1161
        $hold->set_transfer();
1162
    } elsif (C4::Context->preference('HoldsNeedProcessingSIP')
1163
             && C4::Context->interface eq 'sip'
1164
             && !$already_on_shelf) {
1165
        $hold->set_processing();
1166
    } else {
1158
        $hold->set_waiting();
1167
        $hold->set_waiting();
1159
        _koha_notify_reserve( $hold->reserve_id ) unless $already_on_shelf;
1168
        _koha_notify_reserve( $hold->reserve_id ) unless $already_on_shelf;
1160
        my $transfers = Koha::Item::Transfers->search({
1169
        my $transfers = Koha::Item::Transfers->search({
Lines 1164-1172 sub ModReserveAffect { Link Here
1164
        while( my $transfer = $transfers->next ){
1173
        while( my $transfer = $transfers->next ){
1165
            $transfer->datearrived( dt_from_string() )->store;
1174
            $transfer->datearrived( dt_from_string() )->store;
1166
        };
1175
        };
1167
     } else {
1176
    }
1168
        $hold->set_transfer();
1169
     }
1170
1177
1171
1178
1172
    _FixPriority( { biblionumber => $biblionumber } );
1179
    _FixPriority( { biblionumber => $biblionumber } );
Lines 1539-1545 sub _FixPriority { Link Here
1539
            UPDATE reserves
1546
            UPDATE reserves
1540
            SET    priority = 0
1547
            SET    priority = 0
1541
            WHERE reserve_id = ?
1548
            WHERE reserve_id = ?
1542
            AND found IN ('W', 'T')
1549
            AND found IN ('W', 'T', 'P')
1543
        ";
1550
        ";
1544
        my $sth = $dbh->prepare($query);
1551
        my $sth = $dbh->prepare($query);
1545
        $sth->execute( $reserve_id );
1552
        $sth->execute( $reserve_id );
Lines 1551-1557 sub _FixPriority { Link Here
1551
        SELECT reserve_id, borrowernumber, reservedate
1558
        SELECT reserve_id, borrowernumber, reservedate
1552
        FROM   reserves
1559
        FROM   reserves
1553
        WHERE  biblionumber   = ?
1560
        WHERE  biblionumber   = ?
1554
          AND  ((found <> 'W' AND found <> 'T') OR found IS NULL)
1561
          AND  ((found <> 'W' AND found <> 'T' AND found <> 'P') OR found IS NULL)
1555
        ORDER BY priority ASC
1562
        ORDER BY priority ASC
1556
    ";
1563
    ";
1557
    my $sth = $dbh->prepare($query);
1564
    my $sth = $dbh->prepare($query);
Lines 1963-1969 sub MergeHolds { Link Here
1963
"UPDATE reserves SET priority = ? WHERE biblionumber = ? AND borrowernumber = ?
1970
"UPDATE reserves SET priority = ? WHERE biblionumber = ? AND borrowernumber = ?
1964
        AND reservedate = ? AND (itemnumber = ? or itemnumber is NULL) "
1971
        AND reservedate = ? AND (itemnumber = ? or itemnumber is NULL) "
1965
        );
1972
        );
1966
        $sth->execute( $to_biblio, 'W', 'T' );
1973
        $sth->execute( $to_biblio, 'W', 'T', 'P' );
1967
        my $priority = 1;
1974
        my $priority = 1;
1968
        while ( my $reserve = $sth->fetchrow_hashref() ) {
1975
        while ( my $reserve = $sth->fetchrow_hashref() ) {
1969
            $upd_sth->execute(
1976
            $upd_sth->execute(
Lines 2133-2139 sub CalculatePriority { Link Here
2133
        AND   priority > 0
2140
        AND   priority > 0
2134
        AND   (found IS NULL OR found = '')
2141
        AND   (found IS NULL OR found = '')
2135
    };
2142
    };
2136
    #skip found==W or found==T (waiting or transit holds)
2143
    #skip found==W or found==T or found==P (waiting, transit or processing holds)
2137
    if( $resdate ) {
2144
    if( $resdate ) {
2138
        $sql.= ' AND ( reservedate <= ? )';
2145
        $sql.= ' AND ( reservedate <= ? )';
2139
    }
2146
    }
(-)a/C4/RotatingCollections.pm (-1 / +1 lines)
Lines 452-458 sub TransferCollection { Link Here
452
            barcode => $item->{barcode},
452
            barcode => $item->{barcode},
453
            ignore_reserves => 1,
453
            ignore_reserves => 1,
454
            trigger => 'RotatingCollection'
454
            trigger => 'RotatingCollection'
455
        }) unless ( $status eq 'Waiting' || @transfers );
455
        }) unless ( $status eq 'Waiting' || $status eq 'Processing' || @transfers );
456
    }
456
    }
457
457
458
    return 1;
458
    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 223-228 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
223
('HoldsAutoFill','0',NULL,'If on, librarian will not be asked if hold should be filled, it will be filled automatically','YesNo'),
223
('HoldsAutoFill','0',NULL,'If on, librarian will not be asked if hold should be filled, it will be filled automatically','YesNo'),
224
('HoldsAutoFillPrintSlip','0',NULL,'If on, hold slip print dialog will be displayed automatically','YesNo'),
224
('HoldsAutoFillPrintSlip','0',NULL,'If on, hold slip print dialog will be displayed automatically','YesNo'),
225
('HoldsLog','0',NULL,'If ON, log create/cancel/suspend/resume actions on holds.','YesNo'),
225
('HoldsLog','0',NULL,'If ON, log create/cancel/suspend/resume actions on holds.','YesNo'),
226
('HoldsNeedProcessingSIP', '0', NULL, 'Require staff to check-in before hold is set to waiting state', 'YesNo' ),
226
('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'),
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'),
227
('HoldsSplitQueue','nothing','nothing|branch|itemtype|branch_itemtype','In the staff client, split the holds view by the given criteria','Choice'),
228
('HoldsSplitQueue','nothing','nothing|branch|itemtype|branch_itemtype','In the staff client, split the holds view by the given criteria','Choice'),
228
('HoldsToPullStartDate','2',NULL,'Set the default start date for the Holds to pull list to this many days ago','Integer'),
229
('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