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

(-)a/C4/ILSDI/Services.pm (-2 / +6 lines)
Lines 815-822 sub HoldTitle { Link Here
815
815
816
    my $resdate = $cgi->param('start_date');
816
    my $resdate = $cgi->param('start_date');
817
    my $expdate;
817
    my $expdate;
818
    if ( C4::Context->preference('ReserveExpiration') and $cgi->param('expiry_date') ) {
818
    if ( C4::Context->preference('ReserveExpiration') ) {
819
        $expdate = $cgi->param('expiry_date');
819
        if ( $cgi->param('expiry_date') ) {
820
            $expdate = $cgi->param('expiry_date');
821
        }
822
    } else {
823
        return { code => 'expirationDateDisabled' };
820
    }
824
    }
821
825
822
    # Add the reserve
826
    # Add the reserve
(-)a/C4/Reserves.pm (+4 lines)
Lines 194-199 sub AddReserve { Link Here
194
    my $item_group_id          = $params->{item_group_id};
194
    my $item_group_id          = $params->{item_group_id};
195
    my $hold_group_id          = $params->{hold_group_id};
195
    my $hold_group_id          = $params->{hold_group_id};
196
196
197
    if ( !C4::Context->preference('ReserveExpiration') and $params->{expiration_date} ) {
198
        Koha::Exceptions::Hold::ExpirationDateDisabled->throw;
199
    }
200
197
    $resdate ||= dt_from_string;
201
    $resdate ||= dt_from_string;
198
202
199
    # if we have an item selectionned, and the pickup branch is the same as the holdingbranch
203
    # if we have an item selectionned, and the pickup branch is the same as the holdingbranch
(-)a/Koha/Club/Hold.pm (-1 / +5 lines)
Lines 70-75 sub add { Link Here
70
        unless scalar @enrollments;
70
        unless scalar @enrollments;
71
71
72
    my $biblio = Koha::Biblios->find( $params->{biblio_id} );
72
    my $biblio = Koha::Biblios->find( $params->{biblio_id} );
73
    
74
    if ( !C4::Context->preference('ReserveExpiration') and $params->{expiration_date} ) {
75
        Koha::Exceptions::Hold::ExpirationDateDisabled->throw;
76
    }
73
77
74
    my $club_params = {
78
    my $club_params = {
75
        club_id   => $params->{club_id},
79
        club_id   => $params->{club_id},
Lines 131-137 sub add { Link Here
131
                borrowernumber  => $patron_id,
135
                borrowernumber  => $patron_id,
132
                biblionumber    => $params->{biblio_id},
136
                biblionumber    => $params->{biblio_id},
133
                priority        => $priority,
137
                priority        => $priority,
134
                expiration_date => C4::Context->preference('ReserveExpiration') ? $params->{expiration_date} : undef,
138
                expiration_date => $params->{expiration_date},
135
                notes           => $params->{notes},
139
                notes           => $params->{notes},
136
                title           => $biblio->title,
140
                title           => $biblio->title,
137
                itemnumber      => $params->{item_id},
141
                itemnumber      => $params->{item_id},
(-)a/Koha/Exceptions/Hold.pm (+4 lines)
Lines 39-44 use Exception::Class ( Link Here
39
    'Koha::Exceptions::Hold::MissingPickupLocation' => {
39
    'Koha::Exceptions::Hold::MissingPickupLocation' => {
40
        isa         => 'Koha::Exceptions::Hold',
40
        isa         => 'Koha::Exceptions::Hold',
41
        description => 'You must supply a pickup location when placing a hold'
41
        description => 'You must supply a pickup location when placing a hold'
42
    },
43
    'Koha::Exceptions::Hold::ExpirationDateDisabled' => {
44
        isa         => 'Koha::Exceptions::Hold',
45
        description => 'Expiration date not allowed'
42
    }
46
    }
43
);
47
);
44
48
(-)a/Koha/REST/V1/Clubs/Holds.pm (+7 lines)
Lines 88-93 sub add { Link Here
88
        return $c->render_resource_not_found("Bibliographic record")
88
        return $c->render_resource_not_found("Bibliographic record")
89
            unless $biblio;
89
            unless $biblio;
90
90
91
        if ( !C4::Context->preference('ReserveExpiration') and $expiration_date ) {
92
            return $c->render(
93
                status  => 400,
94
                openapi => { error => "Expiration date not allowed" }
95
            );
96
        }
97
91
        my $club_hold = Koha::Club::Hold::add(
98
        my $club_hold = Koha::Club::Hold::add(
92
            {
99
            {
93
                club_id             => $club_id,
100
                club_id             => $club_id,
(-)a/Koha/REST/V1/Holds.pm (-2 / +8 lines)
Lines 82-88 sub add { Link Here
82
        my $item_id           = $body->{item_id};
82
        my $item_id           = $body->{item_id};
83
        my $patron_id         = $body->{patron_id};
83
        my $patron_id         = $body->{patron_id};
84
        my $item_type         = $body->{item_type};
84
        my $item_type         = $body->{item_type};
85
        my $expiration_date   = C4::Context->preference('ReserveExpiration') ? $body->{expiration_date} : undef;
85
        my $expiration_date   = $body->{expiration_date};
86
        my $notes             = $body->{notes};
86
        my $notes             = $body->{notes};
87
        my $hold_date         = $body->{hold_date};
87
        my $hold_date         = $body->{hold_date};
88
        my $non_priority      = $body->{non_priority};
88
        my $non_priority      = $body->{non_priority};
Lines 99-104 sub add { Link Here
99
            );
99
            );
100
        }
100
        }
101
101
102
        if ( !C4::Context->preference('ReserveExpiration') and $expiration_date ) {
103
            return $c->render(
104
                status  => 400,
105
                openapi => { error => "Expiration date not allowed" }
106
            );
107
        }
108
102
        if ( $item_id and $biblio_id ) {
109
        if ( $item_id and $biblio_id ) {
103
110
104
            $biblio = Koha::Biblios->find($biblio_id);
111
            $biblio = Koha::Biblios->find($biblio_id);
105
- 

Return to bug 24194