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

(-)a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/koha-backend.js (-13 / +12 lines)
Lines 136-155 define( [ '/cgi-bin/koha/svc/cataloguing/framework?frameworkcode=&callback=defin Link Here
136
            record = record.clone();
136
            record = record.clone();
137
            _removeBiblionumberFields( record );
137
            _removeBiblionumberFields( record );
138
138
139
            $.ajax( {
139
            const client = APIClient.cataloguing;
140
                type: 'POST',
140
            client.catalog_bib.create({ frameworkcode, record }).then(
141
                url: '/cgi-bin/koha/svc/new_bib?frameworkcode=' + encodeURIComponent(frameworkcode),
141
                success => {
142
                data: record.toXML(),
142
                    var record = _fromXMLStruct( data );
143
                contentType: 'text/xml'
143
                    if ( record.marcxml ) {
144
            } ).done( function( data ) {
144
                        record.marcxml[0].frameworkcode = frameworkcode;
145
                var record = _fromXMLStruct( data );
145
                    }
146
                if ( record.marcxml ) {
146
                    callback( record );
147
                    record.marcxml[0].frameworkcode = frameworkcode;
147
                },
148
                error => {
149
                    callback( { error: _('Could not save record') } );
148
                }
150
                }
149
                callback( record );
151
            );
150
            } ).fail( function( data ) {
151
                callback( { error: _('Could not save record') } );
152
            } );
153
        },
152
        },
154
153
155
        SaveRecord: function( id, record, callback ) {
154
        SaveRecord: function( id, record, callback ) {
(-)a/koha-tmpl/intranet-tmpl/prog/js/fetch/api-client.js (+2 lines)
Lines 1-5 Link Here
1
import ArticleRequestAPIClient from "./article-request-api-client.js";
1
import ArticleRequestAPIClient from "./article-request-api-client.js";
2
import AVAPIClient from "./authorised-value-api-client.js";
2
import AVAPIClient from "./authorised-value-api-client.js";
3
import CataloguingAPIClient from "./cataloguing-api-client.js";
3
import CirculationAPIClient from "./circulation-api-client.js";
4
import CirculationAPIClient from "./circulation-api-client.js";
4
import ClubAPIClient from "./club-api-client.js";
5
import ClubAPIClient from "./club-api-client.js";
5
import CoverImageAPIClient from "./cover-image-api-client.js";
6
import CoverImageAPIClient from "./cover-image-api-client.js";
Lines 12-17 import TicketAPIClient from "./ticket-api-client.js"; Link Here
12
export const APIClient = {
13
export const APIClient = {
13
    article_request: new ArticleRequestAPIClient(),
14
    article_request: new ArticleRequestAPIClient(),
14
    authorised_value: new AVAPIClient(),
15
    authorised_value: new AVAPIClient(),
16
    cataloguing: new CataloguingAPIClient(),
15
    circulation: new CirculationAPIClient(),
17
    circulation: new CirculationAPIClient(),
16
    club: new ClubAPIClient(),
18
    club: new ClubAPIClient(),
17
    cover_image: new CoverImageAPIClient(),
19
    cover_image: new CoverImageAPIClient(),
(-)a/koha-tmpl/intranet-tmpl/prog/js/fetch/cataloguing-api-client.js (-1 / +26 lines)
Line 0 Link Here
0
- 
1
import HttpClient from "./http-client.js";
2
3
export class CataloguingAPIClient extends HttpClient {
4
    constructor() {
5
        super({
6
            baseURL: "/cgi-bin/koha/svc/",
7
        });
8
    }
9
10
    get catalog_bib() {
11
        return {
12
            create: bib_info =>
13
                this.post({
14
                    endpoint: "new_bib/frameworkcode=%s".format( bib_info.frameworkcode ),
15
                    body: bib_info.record.toXML(),
16
                    headers: {
17
                        "Content-Type":
18
                            "text/xml",
19
                    },
20
                }),
21
        };
22
    }
23
24
}
25
26
export default CataloguingAPIClient;

Return to bug 36351