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

(-)a/installer/data/mysql/atomicupdate/bug_32776_-_add_ConvertSelectedHoldsToRecalls_syspref.pl (+14 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => "32776",
5
    description => "Convert selected reserves to recalls",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
10
        $dbh->do(q{INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ('ConvertSelectedHoldsToRecalls', 'oldest', 'oldest|recallable', 'Choose whether the convert_reserves_to_recalls.pl cronjob should convert only the oldest reserve on the record to a recall, or one reserve for each item available to be recalled', 'Choice') });
11
12
        say $out "Added system preference 'ConvertSelectedHoldsToRecalls'";
13
    },
14
};
(-)a/installer/data/mysql/atomicupdate/bug_32776_-_add_ConvertSelectedReservesToRecalls_syspref.pl (-14 lines)
Lines 1-14 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => "32776",
5
    description => "Convert selected reserves to recalls",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
10
        $dbh->do(q{INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ('ConvertSelectedReservesToRecalls', 'oldest', 'oldest|recallable', 'Choose whether the convert_reserves_to_recalls.pl cronjob should convert only the oldest reserve on the record to a recall, or one reserve for each item available to be recalled', 'Choice') });
11
12
        say $out "Added system preference 'ConvertSelectedReservesToRecalls'";
13
    },
14
};
(-)a/installer/data/mysql/mandatory/sysprefs.sql (-1 / +1 lines)
Lines 167-173 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
167
('ConfirmFutureHolds','0','','Number of days for confirming future holds','Integer'),
167
('ConfirmFutureHolds','0','','Number of days for confirming future holds','Integer'),
168
('ConsiderOnSiteCheckoutsAsNormalCheckouts','1',NULL,'Consider on-site checkouts as normal checkouts','YesNo'),
168
('ConsiderOnSiteCheckoutsAsNormalCheckouts','1',NULL,'Consider on-site checkouts as normal checkouts','YesNo'),
169
('ContentWarningField', '', NULL, 'MARC field to use for content warnings', 'Free'),
169
('ContentWarningField', '', NULL, 'MARC field to use for content warnings', 'Free'),
170
('ConvertSelectedReservesToRecalls', 'oldest', 'oldest|recallable', 'Choose whether the convert_reserves_to_recalls.pl cronjob should convert only the oldest reserve on the record to a recall, or one reserve for each item available to be recalled', 'Choice'),
170
('ConvertSelectedHoldsToRecalls', 'oldest', 'oldest|recallable', 'Choose whether the convert_holds_to_recalls.pl cronjob should convert only the oldest hold on the record to a recall, or one hold for each item available to be recalled', 'Choice'),
171
('CookieConsent', '0', NULL, 'Require cookie consent to be displayed', 'YesNo'),
171
('CookieConsent', '0', NULL, 'Require cookie consent to be displayed', 'YesNo'),
172
('CookieConsentedJS', '', NULL, 'Add Javascript code that will run if cookie consent is provided (e.g. tracking code).', 'Free'),
172
('CookieConsentedJS', '', NULL, 'Add Javascript code that will run if cookie consent is provided (e.g. tracking code).', 'Free'),
173
('CreateAVFromCataloguing', '1', '', 'Ability to create authorized values from the cataloguing module', 'YesNo'),
173
('CreateAVFromCataloguing', '1', '', 'Ability to create authorized values from the cataloguing module', 'YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (-5 / +5 lines)
Lines 1368-1380 Circulation: Link Here
1368
            - . (Requires <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=UseRecalls">UseRecalls</a>.)
1368
            - . (Requires <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=UseRecalls">UseRecalls</a>.)
1369
        -
1369
        -
1370
            - Automatically convert
1370
            - Automatically convert
1371
            - pref: ConvertSelectedReservesToRecalls
1371
            - pref: ConvertedSelectedHoldsToRecalls
1372
              default: oldest
1372
              default: oldest
1373
              choices:
1373
              choices:
1374
                  oldest: the oldest reserve placed on the record
1374
                  oldest: the oldest hold placed on the record
1375
                  recallable: one reserve for each item available to be recalled
1375
                  recallable: one hold for each item available to be recalled
1376
            - to a recall, once a specific number of reserves have been requested on the record.
1376
            - to a recall, once a specific number of holds have been requested on the record.
1377
            - <span class="hint">This system preference is used by the convert_reserves_to_recalls.pl cronjob.</span>
1377
            - <span class="hint">This system preference is used by the convert_holds_to_recalls.pl cronjob.</span>
1378
1378
1379
    SIP2:
1379
    SIP2:
1380
        -
1380
        -
(-)a/misc/cronjobs/recalls/convert_holds_to_recalls.pl (-8 / +7 lines)
Lines 46-56 This script converts holds to recalls when a record has a set minimum number of Link Here
46
46
47
If a record is found to have the specified minimum number of holds, the script will find the oldest hold and convert it to a recall, as long as it would be a legal recall.
47
If a record is found to have the specified minimum number of holds, the script will find the oldest hold and convert it to a recall, as long as it would be a legal recall.
48
48
49
This script uses the ConvertSelectedReservesToRecalls system preference.
49
This script uses the ConvertedSelectedHoldsToRecalls system preference.
50
50
51
When ConvertSelectedReservesToRecalls is set to 'oldest', this script will only convert the single oldest hold. Once converted, the script will move on to the next record, it will not continue to convert holds on this record.
51
When ConvertedSelectedHoldsToRecalls is set to 'oldest', this script will only convert the single oldest hold. Once converted, the script will move on to the next record, it will not continue to convert holds on this record.
52
52
53
When ConvertSelectedReservesToRecalls is set to 'recallable', this script will convert reserves one-by-one, oldest first, until all recallable items have been recalled.
53
When ConvertedSelectedHoldsToRecalls is set to 'recallable', this script will convert reserves one-by-one, oldest first, until all recallable items have been recalled.
54
54
55
  Options:
55
  Options:
56
    -v          verbose
56
    -v          verbose
Lines 99-105 foreach my $bib ( @bib_holds ) { Link Here
99
        # Get all holds on this biblio
99
        # Get all holds on this biblio
100
        my @holds = Koha::Holds->search({ biblionumber => $bib->{biblionumber}, found => undef }, { order_by => { -asc => 'reservedate' } })->as_list;
100
        my @holds = Koha::Holds->search({ biblionumber => $bib->{biblionumber}, found => undef }, { order_by => { -asc => 'reservedate' } })->as_list;
101
101
102
        if ( C4::Context->preference('ConvertSelectedReservesToRecalls') eq 'oldest' ) {
102
        if ( C4::Context->preference('ConvertedSelectedHoldsToRecalls') eq 'oldest' ) {
103
103
104
            my $hold_to_convert = $holds[0];
104
            my $hold_to_convert = $holds[0];
105
            my $itemnumber_to_allocate = can_convert( $hold_to_convert );
105
            my $itemnumber_to_allocate = can_convert( $hold_to_convert );
Lines 109-115 foreach my $bib ( @bib_holds ) { Link Here
109
                report( $hold_to_convert, ++$count );
109
                report( $hold_to_convert, ++$count );
110
            }
110
            }
111
111
112
        } elsif ( C4::Context->preference('ConvertSelectedReservesToRecalls') eq 'recallable' ) {
112
        } elsif ( C4::Context->preference('ConvertedSelectedHoldsToRecalls') eq 'recallable' ) {
113
113
114
            my $this_record_holds_converted = 0;
114
            my $this_record_holds_converted = 0;
115
115
Lines 138-145 sub can_convert { Link Here
138
    my $hold = shift;
138
    my $hold = shift;
139
    my $item = shift;
139
    my $item = shift;
140
140
141
    my $patron = Koha::Patrons->find( $hold_to_convert->borrowernumber );
141
    my $patron = Koha::Patrons->find( $hold->borrowernumber );
142
    my $biblio = Koha::Biblios->find( $hold_to_convert->biblionumber );
142
    my $biblio = Koha::Biblios->find( $hold->biblionumber );
143
143
144
    if ( $hold->item_level_hold ) {
144
    if ( $hold->item_level_hold ) {
145
145
146
- 

Return to bug 32776