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

(-)a/Koha/REST/V1/Holds.pm (-7 / +4 lines)
Lines 91-108 sub add { Link Here
91
91
92
        if ( $item_id and $biblio_id ) {
92
        if ( $item_id and $biblio_id ) {
93
93
94
            $biblio = Koha::Biblios->find($biblio_id);
95
            $item   = $biblio->items->find($item_id);
96
94
            # check they are consistent
97
            # check they are consistent
95
            unless ( Koha::Items->search( { itemnumber => $item_id, biblionumber => $biblio_id } )
98
            unless ($item) {
96
                ->count > 0 )
97
            {
98
                return $c->render(
99
                return $c->render(
99
                    status  => 400,
100
                    status  => 400,
100
                    openapi => { error => "Item $item_id doesn't belong to biblio $biblio_id" }
101
                    openapi => { error => "Item $item_id doesn't belong to biblio $biblio_id" }
101
                );
102
                );
102
            }
103
            }
103
            else {
104
                $biblio = Koha::Biblios->find($biblio_id);
105
            }
106
        }
104
        }
107
        elsif ($item_id) {
105
        elsif ($item_id) {
108
            $item = Koha::Items->find($item_id);
106
            $item = Koha::Items->find($item_id);
109
- 

Return to bug 35053