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

(-)a/C4/Reserves.pm (-3 / +3 lines)
Lines 1136-1142 sub ModReserveStatus { Link Here
1136
1136
1137
=head2 ModReserveAffect
1137
=head2 ModReserveAffect
1138
1138
1139
  &ModReserveAffect($itemnumber,$borrowernumber,$diffBranchSend,$reserve_id);
1139
  &ModReserveAffect($itemnumber,$borrowernumber,$diffBranchSend,$reserve_id, $desk_id);
1140
1140
1141
This function affect an item and a status for a given reserve, either fetched directly
1141
This function affect an item and a status for a given reserve, either fetched directly
1142
by record_id, or by borrowernumber and itemnumber or biblionumber. If only biblionumber
1142
by record_id, or by borrowernumber and itemnumber or biblionumber. If only biblionumber
Lines 1150-1156 take care of the waiting status Link Here
1150
=cut
1150
=cut
1151
1151
1152
sub ModReserveAffect {
1152
sub ModReserveAffect {
1153
    my ( $itemnumber, $borrowernumber, $transferToDo, $reserve_id ) = @_;
1153
    my ( $itemnumber, $borrowernumber, $transferToDo, $reserve_id, $desk_id ) = @_;
1154
    my $dbh = C4::Context->dbh;
1154
    my $dbh = C4::Context->dbh;
1155
1155
1156
    # we want to attach $itemnumber to $borrowernumber, find the biblionumber
1156
    # we want to attach $itemnumber to $borrowernumber, find the biblionumber
Lines 1183-1189 sub ModReserveAffect { Link Here
1183
             && !$already_on_shelf) {
1183
             && !$already_on_shelf) {
1184
        $hold->set_processing();
1184
        $hold->set_processing();
1185
    } else {
1185
    } else {
1186
        $hold->set_waiting();
1186
        $hold->set_waiting($desk_id);
1187
        _koha_notify_reserve( $hold->reserve_id ) unless $already_on_shelf;
1187
        _koha_notify_reserve( $hold->reserve_id ) unless $already_on_shelf;
1188
        my $transfers = Koha::Item::Transfers->search({
1188
        my $transfers = Koha::Item::Transfers->search({
1189
            itemnumber => $itemnumber,
1189
            itemnumber => $itemnumber,
(-)a/Koha/Hold.pm (-1 / +15 lines)
Lines 175-181 sub set_transfer { Link Here
175
=cut
175
=cut
176
176
177
sub set_waiting {
177
sub set_waiting {
178
    my ( $self ) = @_;
178
    my ( $self, $desk_id ) = @_;
179
179
180
    $self->priority(0);
180
    $self->priority(0);
181
181
Lines 183-188 sub set_waiting { Link Here
183
    my $values = {
183
    my $values = {
184
        found => 'W',
184
        found => 'W',
185
        waitingdate => $today->ymd,
185
        waitingdate => $today->ymd,
186
        desk_id => $desk_id,
186
    };
187
    };
187
188
188
    my $requested_expiration;
189
    my $requested_expiration;
Lines 365-370 sub branch { Link Here
365
    return $self->{_branch};
366
    return $self->{_branch};
366
}
367
}
367
368
369
=head3 desk
370
371
Returns the related Koha::Desk object for this Hold
372
373
=cut
374
375
sub desk {
376
    my $self = shift;
377
    my $desk_rs = $self->_result->desk;
378
    return unless $desk_rs;
379
    return Koha::Desk->_new_from_dbic($desk_rs);
380
}
381
368
=head3 borrower
382
=head3 borrower
369
383
370
Returns the related Koha::Patron object for this Hold
384
Returns the related Koha::Patron object for this Hold
(-)a/circ/returns.pl (-2 / +3 lines)
Lines 71-76 my ( $template, $librarian, $cookie, $flags ) = get_template_and_user( Link Here
71
71
72
my $sessionID = $query->cookie("CGISESSID");
72
my $sessionID = $query->cookie("CGISESSID");
73
my $session = get_session($sessionID);
73
my $session = get_session($sessionID);
74
my $desk_id = C4::Context->userenv->{"desk_id"} || '';
74
75
75
# Print a reserve slip on this page
76
# Print a reserve slip on this page
76
if ( $query->param('print_slip') ) {
77
if ( $query->param('print_slip') ) {
Lines 155-161 if ( $query->param('reserve_id') ) { Link Here
155
        my $diffBranchSend = ($userenv_branch ne $diffBranchReturned) ? $diffBranchReturned : undef;
156
        my $diffBranchSend = ($userenv_branch ne $diffBranchReturned) ? $diffBranchReturned : undef;
156
        # diffBranchSend tells ModReserveAffect whether document is expected in this library or not,
157
        # diffBranchSend tells ModReserveAffect whether document is expected in this library or not,
157
        # i.e., whether to apply waiting status
158
        # i.e., whether to apply waiting status
158
        ModReserveAffect( $itemnumber, $borrowernumber, $diffBranchSend, $reserve_id );
159
        ModReserveAffect( $itemnumber, $borrowernumber, $diffBranchSend, $reserve_id, $desk_id );
159
    }
160
    }
160
#   check if we have other reserves for this document, if we have a return send the message of transfer
161
#   check if we have other reserves for this document, if we have a return send the message of transfer
161
    my ( $messages, $nextreservinfo ) = GetOtherReserves($itemnumber);
162
    my ( $messages, $nextreservinfo ) = GetOtherReserves($itemnumber);
Lines 422-428 if ( $messages->{'ResFound'}) { Link Here
422
        my $biblio = $item->biblio;
423
        my $biblio = $item->biblio;
423
424
424
        my $diffBranchSend = !$branchCheck ? $reserve->{branchcode} : undef;
425
        my $diffBranchSend = !$branchCheck ? $reserve->{branchcode} : undef;
425
        ModReserveAffect( $reserve->{itemnumber}, $reserve->{borrowernumber}, $diffBranchSend, $reserve->{reserve_id} );
426
        ModReserveAffect( $reserve->{itemnumber}, $reserve->{borrowernumber}, $diffBranchSend, $reserve->{reserve_id}, $desk_id );
426
        my ( $messages, $nextreservinfo ) = GetOtherReserves($reserve->{itemnumber});
427
        my ( $messages, $nextreservinfo ) = GetOtherReserves($reserve->{itemnumber});
427
428
428
        $template->param(
429
        $template->param(
(-)a/installer/data/mysql/atomicupdate/bug_24412_Attach_waiting_reserve_to_desk.perl (-12 / +13 lines)
Lines 1-16 Link Here
1
$DBversion = 'XXX';  # will be replaced by the RM
1
$DBversion = 'XXX';  # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
2
if( CheckVersion( $DBversion ) ) {
3
    # you can use $dbh here like:
3
    if ( !column_exists( 'reserves', 'desk_id' ) ) {
4
    $dbh->do(q{
4
        $dbh->do(q{
5
ALTER TABLE reserves ADD COLUMN desk_id INT(11) DEFAULT NULL AFTER branchcode,
5
                 ALTER TABLE reserves ADD COLUMN desk_id INT(11) DEFAULT NULL AFTER branchcode,
6
  ADD KEY desk_id (`desk_id`),
6
                 ADD KEY desk_id (`desk_id`),
7
  ADD CONSTRAINT `reserves_ibfk_6` FOREIGN KEY (`desk_id`) REFERENCES `desks` (`desk_id`) ON DELETE CASCADE ON UPDATE CASCADE ;
7
                 ADD CONSTRAINT `reserves_ibfk_6` FOREIGN KEY (`desk_id`) REFERENCES `desks` (`desk_id`) ON DELETE CASCADE ON UPDATE CASCADE ;
8
             });
8
                 });
9
    $dbh->do(q{
9
        $dbh->do(q{
10
ALTER TABLE old_reserves ADD COLUMN desk_id INT(11) DEFAULT NULL AFTER branchcode,
10
                 ALTER TABLE old_reserves ADD COLUMN desk_id INT(11) DEFAULT NULL AFTER branchcode,
11
  ADD KEY `old_desk_id` (`desk_id`);
11
                 ADD KEY `old_desk_id` (`desk_id`);
12
             });
12
                 });
13
13
14
    SetVersion( $DBversion );
14
        SetVersion( $DBversion );
15
    print "Upgrade to $DBversion done (Bug XXXXX - Attach waiting reserve to desk)\n";
15
        print "Upgrade to $DBversion done (Bug XXXXX - Attach waiting reserve to desk)\n";
16
    }
16
}
17
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc (-1 / +1 lines)
Lines 122-128 Link Here
122
            <td>
122
            <td>
123
                [% IF ( hold.found ) %]
123
                [% IF ( hold.found ) %]
124
                    [% IF ( hold.atdestination ) %]
124
                    [% IF ( hold.atdestination ) %]
125
                            Item waiting at <strong> [% hold.wbrname | html %]</strong> <input type="hidden" name="pickup" value="[% hold.wbrcode | html %]" /> since [% hold.waiting_date | $KohaDates %]
125
                            Item waiting at <strong> [% hold.wbrname | html %]</strong>[% IF hold.desk_name %], [% hold.desk_name | html %],[% END %] <input type="hidden" name="pickup" value="[% hold.wbrcode | html %]" /> since [% hold.waiting_date | $KohaDates %]
126
                    [% ELSIF (hold.intransit) %]
126
                    [% ELSIF (hold.intransit) %]
127
                        Item being transferred to <strong> [% hold.wbrname | html %]</strong> <input type="hidden" name="pickup" value="[% hold.wbrcode | html %]" />
127
                        Item being transferred to <strong> [% hold.wbrname | html %]</strong> <input type="hidden" name="pickup" value="[% hold.wbrcode | html %]" />
128
                    [% ELSIF (hold.inprocessing) %]
128
                    [% ELSIF (hold.inprocessing) %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/waiting_holds.inc (-1 / +1 lines)
Lines 37-43 Link Here
37
                    [% END %]
37
                    [% END %]
38
                </td>
38
                </td>
39
                <td>[% Branches.GetName( reserveloo.item.homebranch ) | html %]</td>
39
                <td>[% Branches.GetName( reserveloo.item.homebranch ) | html %]</td>
40
                <td>[% Branches.GetName( reserveloo.item.holdingbranch ) | html %]</td>
40
                <td>[% Branches.GetName( reserveloo.item.holdingbranch ) | html %][% IF (reserveloo.desk_id  ) %], [% Desks.GetName (reserveloo.desk_id) | html %][% END %]</td>
41
                <td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => reserveloo.item.location) | html %]</td>
41
                <td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => reserveloo.item.location) | html %]</td>
42
                <td>[% reserveloo.item.itemcallnumber | html %]</td>
42
                <td>[% reserveloo.item.itemcallnumber | html %]</td>
43
                <td>[% reserveloo.item.copynumber | html %]</td>
43
                <td>[% reserveloo.item.copynumber | html %]</td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-1 / +1 lines)
Lines 461-467 Note that permanent location is a code, and location may be an authval. Link Here
461
                        [% SET hold = item.first_hold %]
461
                        [% SET hold = item.first_hold %]
462
                        [% IF hold %]
462
                        [% IF hold %]
463
                            [% IF hold.waitingdate %]
463
                            [% IF hold.waitingdate %]
464
                                <span class="waitingat">Waiting at [% Branches.GetName( hold.branchcode ) | html %] since [% hold.waitingdate | $KohaDates %].</span>
464
                                <span class="waitingat">Waiting at [% Branches.GetName( hold.branchcode ) | html %][% IF ( hold.desk_id ) %], [% hold.desk.desk_name | html %][% END %] since [% hold.waitingdate | $KohaDates %].</span>
465
                                [% IF canreservefromotherbranches AND ( hold.waitingdate OR hold.priority == 1 ) %]
465
                                [% IF canreservefromotherbranches AND ( hold.waitingdate OR hold.priority == 1 ) %]
466
                                    <span class="heldfor">Hold for:</span>
466
                                    <span class="heldfor">Hold for:</span>
467
                                    [% INCLUDE 'patron-title.inc' patron=hold.borrower hide_patron_infos_if_needed=1 %]
467
                                    [% INCLUDE 'patron-title.inc' patron=hold.borrower hide_patron_infos_if_needed=1 %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/holds.js (+7 lines)
Lines 161-169 $(document).ready(function() { Link Here
161
161
162
                                    if ( oObj.waiting_here ) {
162
                                    if ( oObj.waiting_here ) {
163
                                        data += __("Item is <strong>waiting here</strong>");
163
                                        data += __("Item is <strong>waiting here</strong>");
164
					if (oObj.desk_name) {
165
					    data += ", " + __("at %s").format( oObj.desk_name );
166
					}
164
                                    } else {
167
                                    } else {
165
                                        data += __("Item is <strong>waiting</strong>");
168
                                        data += __("Item is <strong>waiting</strong>");
166
                                        data += " " + __("at %s").format(oObj.waiting_at);
169
                                        data += " " + __("at %s").format(oObj.waiting_at);
170
					if (oObj.desk_name) {
171
					    data += ", " + __("at %s").format( oObj.desk_name );
172
					}
173
167
                                    }
174
                                    }
168
175
169
                                } else if ( oObj.transferred ) {
176
                                } else if ( oObj.transferred ) {
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc (+1 lines)
Lines 100-105 Link Here
100
                                <i class="fa fa-exclamation-circle text-warning" aria-hidden="true"></i>
100
                                <i class="fa fa-exclamation-circle text-warning" aria-hidden="true"></i>
101
                                [% IF ( HOLD.is_at_destination ) %]
101
                                [% IF ( HOLD.is_at_destination ) %]
102
                                    Item waiting at <strong> [% HOLD.branch.branchname | html %]</strong>
102
                                    Item waiting at <strong> [% HOLD.branch.branchname | html %]</strong>
103
				    [% IF ( HOLD.desk_id ) %], [% Desks.GetName ( HOLD.desk_id ) | html %],[% END %]
103
                                    [% IF ( HOLD.waitingdate ) %]
104
                                    [% IF ( HOLD.waitingdate ) %]
104
                                        since [% HOLD.waitingdate | $KohaDates %]
105
                                        since [% HOLD.waitingdate | $KohaDates %]
105
                                        [% IF HOLD.expirationdate %]
106
                                        [% IF HOLD.expirationdate %]
(-)a/reserve/request.pl (+1 lines)
Lines 658-663 foreach my $biblionumber (@biblionumbers) { Link Here
658
            $reserve{'itemnumber'}    = $res->itemnumber();
658
            $reserve{'itemnumber'}    = $res->itemnumber();
659
            $reserve{'wbrname'}       = $res->branch()->branchname();
659
            $reserve{'wbrname'}       = $res->branch()->branchname();
660
            $reserve{'atdestination'} = $res->is_at_destination();
660
            $reserve{'atdestination'} = $res->is_at_destination();
661
            $reserve{'desk_name'}     = $res->desk()->desk_name();
661
            $reserve{'found'}     = $res->is_found();
662
            $reserve{'found'}     = $res->is_found();
662
            $reserve{'inprocessing'} = $res->is_in_processing();
663
            $reserve{'inprocessing'} = $res->is_in_processing();
663
            $reserve{'intransit'} = $res->is_in_transit();
664
            $reserve{'intransit'} = $res->is_in_transit();
(-)a/svc/holds (-1 / +1 lines)
Lines 97-102 while ( my $h = $holds_rs->next() ) { Link Here
97
        reserve_id     => $h->reserve_id(),
97
        reserve_id     => $h->reserve_id(),
98
        branchcode     => $h->branch()->branchname(),
98
        branchcode     => $h->branch()->branchname(),
99
        branches       => $libraries,
99
        branches       => $libraries,
100
        desk_name      => $h->desk()->desk_name(),
100
        reservedate    => $h->reservedate(),
101
        reservedate    => $h->reservedate(),
101
        expirationdate => $h->expirationdate(),
102
        expirationdate => $h->expirationdate(),
102
        suspend        => $h->suspend(),
103
        suspend        => $h->suspend(),
103
- 

Return to bug 24412