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

(-)a/Koha/Hold.pm (+20 lines)
Lines 678-683 sub to_api_mapping { Link Here
678
    };
678
    };
679
}
679
}
680
680
681
=head3 can_change_branch_opac
682
683
returns if a hold can change pickup location from opac
684
685
my $can_change_branch_opac = $hold->can_change_branch_opac;
686
687
=cut
688
689
sub can_change_branch_opac {
690
    my ($self) = @_;
691
692
    my @statuses = split /,/, C4::Context->preference("OPACAllowUserToChangeBranch");
693
    foreach my $status ( @statuses ){
694
        return 1 if ($status eq 'pending' && !$self->is_found && !$self->is_suspended );
695
        return 1 if ($status eq 'intransit' && $self->is_in_transit);
696
        return 1 if ($status eq 'suspended' && $self->is_suspended);
697
    }
698
    return 0;
699
}
700
681
=head2 Internal methods
701
=head2 Internal methods
682
702
683
=head3 _type
703
=head3 _type
(-)a/installer/data/mysql/atomicupdate/bug_14783-add_OpacAllowPickupLocationChange_syspref.perl (+8 lines)
Line 0 Link Here
1
2
3
$DBversion = 'XXX'; # will be replaced by the RM
4
if( CheckVersion( $DBversion ) ) {
5
    $dbh->do( "INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) VALUES ('OPACAllowUserToChangeBranch','','Pending, In-Transit, Suspended','Allow users to change the library to pick up a hold for these statuses:','multiple');" );
6
    # Always end with this (adjust the bug info)
7
    NewVersion( $DBversion, 14783, "Allow patrons to change pickup location for non-waiting holds");
8
}
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+1 lines)
Lines 393-398 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
393
('OpacAllowPublicListCreation','1',NULL,'If set, allows opac users to create public lists','YesNo'),
393
('OpacAllowPublicListCreation','1',NULL,'If set, allows opac users to create public lists','YesNo'),
394
('OpacAllowSharingPrivateLists','0',NULL,'If set, allows opac users to share private lists with other patrons','YesNo'),
394
('OpacAllowSharingPrivateLists','0',NULL,'If set, allows opac users to share private lists with other patrons','YesNo'),
395
('OPACAllowUserToChooseBranch','1','1','Allow the user to choose the branch they want to pickup their hold from','YesNo'),
395
('OPACAllowUserToChooseBranch','1','1','Allow the user to choose the branch they want to pickup their hold from','YesNo'),
396
('OPACAllowUserToChangeBranch','','Pending, In-Transit, Suspended','Allow users to change the library to pick up a hold for these statuses:','multiple'),
396
('OPACAmazonCoverImages','0','','Display cover images on OPAC from Amazon Web Services','YesNo'),
397
('OPACAmazonCoverImages','0','','Display cover images on OPAC from Amazon Web Services','YesNo'),
397
('OpacAuthorities','1',NULL,'If ON, enables the search authorities link on OPAC','YesNo'),
398
('OpacAuthorities','1',NULL,'If ON, enables the search authorities link on OPAC','YesNo'),
398
('OPACBaseURL','',NULL,'Specify the Base URL of the OPAC, e.g., http://opac.mylibrary.com, including the protocol (http:// or https://). Otherwise, the http:// will be added automatically by Koha upon saving.','Free'),
399
('OPACBaseURL','',NULL,'Specify the Base URL of the OPAC, e.g., http://opac.mylibrary.com, including the protocol (http:// or https://). Otherwise, the http:// will be added automatically by Koha upon saving.','Free'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+7 lines)
Lines 767-772 Circulation: Link Here
767
                  1: Allow
767
                  1: Allow
768
                  0: "Don't allow"
768
                  0: "Don't allow"
769
            - a user to choose the library to pick up a hold from.
769
            - a user to choose the library to pick up a hold from.
770
        -
771
            - 'Allow users to change the library to pick up a hold for these statuses:'
772
            - pref: OPACAllowUserToChangeBranch
773
              multiple:
774
                pending: Pending
775
                intransit: In transit
776
                suspended: Suspended
770
        -
777
        -
771
            - pref: ReservesNeedReturns
778
            - pref: ReservesNeedReturns
772
              choices:
779
              choices:
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc (-1 / +11 lines)
Lines 84-90 Link Here
84
                        [% UNLESS( singleBranchMode) %]
84
                        [% UNLESS( singleBranchMode) %]
85
                            <td class="branch">
85
                            <td class="branch">
86
                                <span class="tdlabel">Pick up location:</span>
86
                                <span class="tdlabel">Pick up location:</span>
87
                                [% HOLD.branch.branchname | html %]
87
                                [% IF ( HOLD.can_change_branch_opac ) %]
88
                                    <form class="change_branch" action="/cgi-bin/koha/opac-modrequest.pl" method="post">
89
                                        <select name="new_branch" >
90
                                            [% PROCESS options_for_libraries libraries = Branches.pickup_locations({    search_params => { biblio => HOLD.biblionumber, patron => HOLD.borrower }, selected => HOLD.branchcode }) %]
91
                                       </select>
92
                                       <input type="hidden" name="new_branch_reserveid" value="[% HOLD.reserve_id | html %]" />
93
                                       <button class="btn btn-primary" type="submit" name="change_branch" value="1">Change</button>
94
                                    </form>
95
                                [% ELSE %]
96
                                    [% HOLD.branch.branchname | html %]
97
                                [% END  %]
88
                            </td>
98
                            </td>
89
                        [% END %]
99
                        [% END %]
90
                        [% IF ( showpriority ) %]
100
                        [% IF ( showpriority ) %]
(-)a/opac/opac-modrequest.pl (-1 / +11 lines)
Lines 48-51 if ($reserve_id && $borrowernumber) { Link Here
48
    }
48
    }
49
}
49
}
50
50
51
#Change pickup location for hold
52
my $change_branch = $query->param('change_branch');
53
if ($change_branch){
54
    my $new_branch_reserveid = $query->param('new_branch_reserveid');
55
    my $new_branch = $query->param('new_branch');
56
    my $hold = Koha::Holds->find( $new_branch_reserveid );
57
    if ($hold && $hold->can_change_branch_opac){
58
        $hold->branchcode($new_branch)->store();
59
    }
60
}
61
51
print $query->redirect("/cgi-bin/koha/opac-user.pl#opac-user-holds");
62
print $query->redirect("/cgi-bin/koha/opac-user.pl#opac-user-holds");
52
- 

Return to bug 14783