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

(-)a/installer/data/mysql/atomicupdate/bug_23659_add_default_pickup_location_syspref.pl (+17 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => "23659",
5
    description => "Add DefaultHoldPickupLocation syspref",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
        # Do you stuffs here
10
        $dbh->do(q{
11
            INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
12
            ('DefaultHoldPickupLocation','loggedinlibrary','loggedinlibrary|homebranch|holdingbranch','Which branch should a hold pickup location default to. ','choice')
13
        });
14
        # Print useful stuff here
15
        say $out "Added DefaultHoldPickupLocation syspref";
16
    },
17
};
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+1 lines)
Lines 164-169 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
164
('DefaultHoldExpirationdate','0','','Automatically set expiration date for holds','YesNo'),
164
('DefaultHoldExpirationdate','0','','Automatically set expiration date for holds','YesNo'),
165
('DefaultHoldExpirationdatePeriod','0','','How long into the future default expiration date is set to be.','integer'),
165
('DefaultHoldExpirationdatePeriod','0','','How long into the future default expiration date is set to be.','integer'),
166
('DefaultHoldExpirationdateUnitOfTime','days','days|months|years','Which unit of time is used when setting the default expiration date. ','choice'),
166
('DefaultHoldExpirationdateUnitOfTime','days','days|months|years','Which unit of time is used when setting the default expiration date. ','choice'),
167
('DefaultHoldPickupLocation','loggedinlibrary','loggedinlibrary|homelibrary','Which branch should a hold pickup location default to. ','choice'),
167
('DefaultLanguageField008','','','Fill in the default language for field 008 Range 35-37 of MARC21 records (e.g. eng, nor, ger, see <a href=\"http://www.loc.gov/marc/languages/language_code.html\">MARC Code List for Languages</a>)','Free'),
168
('DefaultLanguageField008','','','Fill in the default language for field 008 Range 35-37 of MARC21 records (e.g. eng, nor, ger, see <a href=\"http://www.loc.gov/marc/languages/language_code.html\">MARC Code List for Languages</a>)','Free'),
168
('DefaultLongOverdueSkipLostStatuses', '', NULL, 'Skip these lost statuses by default in longoverdue.pl', 'Free'),
169
('DefaultLongOverdueSkipLostStatuses', '', NULL, 'Skip these lost statuses by default in longoverdue.pl', 'Free'),
169
('DefaultLongOverdueChargeValue', '', NULL, "Charge a lost item to the borrower's account when the LOST value of the item changes to n.", 'integer'),
170
('DefaultLongOverdueChargeValue', '', NULL, "Charge a lost item to the borrower's account when the LOST value of the item changes to n.", 'integer'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+8 lines)
Lines 930-935 Circulation: Link Here
930
                  months: months
930
                  months: months
931
                  years: years
931
                  years: years
932
            - from reserve date.
932
            - from reserve date.
933
        -
934
            - When placing a hold via the staff client default the pickup location to the
935
            - pref: DefaultHoldPickupLocation
936
              default: loggedinlibrary
937
              choices:
938
                  loggedinlibrary: "logged in library"
939
                  homebranch: "item's home branch"
940
                  holdingbranch: "item's holding branch"
933
    Interlibrary loans:
941
    Interlibrary loans:
934
        -
942
        -
935
            - pref: ILLModule
943
            - pref: ILLModule
(-)a/reserve/request.pl (-6 / +12 lines)
Lines 489-494 if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) Link Here
489
489
490
                    $item->{item_level_holds} = Koha::CirculationRules->get_opacitemholds_policy( { item => $item_object, patron => $patron } );
490
                    $item->{item_level_holds} = Koha::CirculationRules->get_opacitemholds_policy( { item => $item_object, patron => $patron } );
491
491
492
                    my $default_hold_pickup_location_pref = C4::Context->preference('DefaultHoldPickupLocation');
493
                    my $default_pickup_branch;
494
                    if( $default_hold_pickup_location_pref eq 'homebranch' ){
495
                        $default_pickup_branch = $item->{homebranch};
496
                    } elsif ( $default_hold_pickup_location_pref eq 'holdingbranch' ){
497
                        $default_pickup_branch = $item->{holdingbranch};
498
                    } else {
499
                        $default_pickup_branch = C4::Context->userenv->{branch};
500
                    }
501
492
                    if (
502
                    if (
493
                           !$item->{cantreserve}
503
                           !$item->{cantreserve}
494
                        && !$exceeded_maxreserves
504
                        && !$exceeded_maxreserves
Lines 505-511 if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) Link Here
505
                            $num_available++;
515
                            $num_available++;
506
                            $item->{available} = 1;
516
                            $item->{available} = 1;
507
                            # pass the holding branch for use as default
517
                            # pass the holding branch for use as default
508
                            my $default_pickup_location = $pickup_locations->search({ branchcode => $item->{holdingbranch} })->next;
518
                            my $default_pickup_location = $pickup_locations->search({ branchcode => $default_pickup_branch })->next;
509
                            $item->{default_pickup_location} = $default_pickup_location;
519
                            $item->{default_pickup_location} = $default_pickup_location;
510
                        }
520
                        }
511
                        else {
521
                        else {
Lines 529-538 if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) Link Here
529
539
530
                                my $default_pickup_location;
540
                                my $default_pickup_location;
531
541
532
                                # Default to logged-in, if valid
542
                                ($default_pickup_location) = grep { $_->branchcode eq $default_pickup_branch } @pickup_locations;
533
                                if ( C4::Context->userenv->{branch} ) {
534
                                    ($default_pickup_location) = grep { $_->branchcode eq C4::Context->userenv->{branch} } @pickup_locations;
535
                                }
536
543
537
                                $item->{default_pickup_location} = $default_pickup_location;
544
                                $item->{default_pickup_location} = $default_pickup_location;
538
                            }
545
                            }
539
- 

Return to bug 23659