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

(-)a/Koha/REST/V1/Checkouts.pm (-2 / +23 lines)
Lines 102-108 sub get { Link Here
102
    };
102
    };
103
}
103
}
104
104
105
=head3 get_availablity
105
=head3 get_availability
106
106
107
Controller function that handles retrieval of Checkout availability
107
Controller function that handles retrieval of Checkout availability
108
108
Lines 123-128 sub get_availability { Link Here
123
      CanBookBeIssued( $patron, undef, undef, $inprocess, $ignore_reserves,
123
      CanBookBeIssued( $patron, undef, undef, $inprocess, $ignore_reserves,
124
        $params );
124
        $params );
125
125
126
    # Upgrade some confirmations to blockers if public
127
    if ( $c->stash('is_public') ) {
128
        my @should_block = qw/TOO_MANY ISSUED_TO_ANOTHER RESERVED RESERVED_WAITING TRANSFERRED PROCESSING AGE_RESTRICTION/;
129
        for my $block ( @should_block ) {
130
            if ( exists($confirmation->{$block}) ) {
131
                $impossible->{$block} = $confirmation->{$block};
132
                delete $confirmation->{$block};
133
            }
134
        }
135
    }
136
126
    my $token;
137
    my $token;
127
    if (keys %{$confirmation}) {
138
    if (keys %{$confirmation}) {
128
        my $claims = { map { $_ => 1 } keys %{$confirmation} };
139
        my $claims = { map { $_ => 1 } keys %{$confirmation} };
Lines 131-136 sub get_availability { Link Here
131
        $token = Mojo::JWT->new( claims => $claims, secret => $secret )->encode;
142
        $token = Mojo::JWT->new( claims => $claims, secret => $secret )->encode;
132
    }
143
    }
133
144
145
    # Remove any non-public info that's returned by CanBookBeIssued
146
    if ( $c->stash('is_public') ) {
147
        my @restricted_keys = qw/issued_borrowernumber issued_cardnumber issued_firstname issued_surname resborrowernumber resbranchcode rescardnumber reserve_id resfirstname resreservedate ressurname item_notforloan/;
148
        for my $key (@restricted_keys) {
149
            delete $confirmation->{$key};
150
            delete $impossible->{$key};
151
            delete $alerts->{$key};
152
            delete $messages->{$key};
153
        }
154
    }
155
134
    my $response = {
156
    my $response = {
135
        blockers           => $impossible,
157
        blockers           => $impossible,
136
        confirms           => $confirmation,
158
        confirms           => $confirmation,
137
- 

Return to bug 30979