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

(-)a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/koha-backend.js (-2 / +10 lines)
Lines 23-28 define( [ '/cgi-bin/koha/svc/cataloguing/framework?frameworkcode=&callback=defin Link Here
23
    var _framework_mappings = {};
23
    var _framework_mappings = {};
24
    var _framework_kohafields = {};
24
    var _framework_kohafields = {};
25
25
26
    function _biblioSaveError( data ) {
27
        var error;
28
        if (data.responseXML) {
29
            error = $(data.responseXML).find('error').first().text();
30
        }
31
        return error || _('Could not save record');
32
    }
33
26
    function _fromXMLStruct( data ) {
34
    function _fromXMLStruct( data ) {
27
        result = {};
35
        result = {};
28
36
Lines 148-154 define( [ '/cgi-bin/koha/svc/cataloguing/framework?frameworkcode=&callback=defin Link Here
148
                }
156
                }
149
                callback( record );
157
                callback( record );
150
            } ).fail( function( data ) {
158
            } ).fail( function( data ) {
151
                callback( { error: _('Could not save record') } );
159
                callback( { error: _biblioSaveError( data ) } );
152
            } );
160
            } );
153
        },
161
        },
154
162
Lines 169-175 define( [ '/cgi-bin/koha/svc/cataloguing/framework?frameworkcode=&callback=defin Link Here
169
                }
177
                }
170
                callback( record );
178
                callback( record );
171
            } ).fail( function( data ) {
179
            } ).fail( function( data ) {
172
                callback( { error: _('Could not save record') } );
180
                callback( { error: _biblioSaveError( data ) } );
173
            } );
181
            } );
174
        },
182
        },
175
183
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc (+2 lines)
Lines 1108-1113 require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr Link Here
1108
                    humanMsg.displayAlert( _("Incorrect syntax, cannot save"), { className: 'humanError' } );
1108
                    humanMsg.displayAlert( _("Incorrect syntax, cannot save"), { className: 'humanError' } );
1109
                } else if ( result.error == 'invalid' ) {
1109
                } else if ( result.error == 'invalid' ) {
1110
                    humanMsg.displayAlert( _("Record structure invalid, cannot save"), { className: 'humanError' } );
1110
                    humanMsg.displayAlert( _("Record structure invalid, cannot save"), { className: 'humanError' } );
1111
                } else if ( result.error == 'missing_marc_modification_template' ) {
1112
                    humanMsg.displayAlert( _("Missing marc modification template, cannot save"), { className: 'humanError' } );
1111
                } else if ( result.error ) {
1113
                } else if ( result.error ) {
1112
                    humanMsg.displayAlert( _("Something went wrong, cannot save"), { className: 'humanError' } );
1114
                    humanMsg.displayAlert( _("Something went wrong, cannot save"), { className: 'humanError' } );
1113
                } else if ( !result.error ) {
1115
                } else if ( !result.error ) {
(-)a/svc/bib (-4 / +6 lines)
Lines 102-111 sub update_bib { Link Here
102
102
103
    my $result = {};
103
    my $result = {};
104
    my $inxml = $query->param('POSTDATA');
104
    my $inxml = $query->param('POSTDATA');
105
    print $query->header(-type => 'text/xml', -charset => 'utf-8');
106
105
107
    my $record = eval {MARC::Record::new_from_xml( $inxml, "UTF-8", C4::Context->preference('marcflavour'))};
106
    my $record = eval {MARC::Record::new_from_xml( $inxml, "UTF-8", C4::Context->preference('marcflavour'))};
108
    my $do_not_escape = 0;
107
    my $do_not_escape = 0;
108
109
109
    if ($@) {
110
    if ($@) {
110
        $result->{'status'} = "failed";
111
        $result->{'status'} = "failed";
111
        $result->{'error'} = $@;
112
        $result->{'error'} = $@;
Lines 134-140 sub update_bib { Link Here
134
            if ($template) {
135
            if ($template) {
135
                ModifyRecordWithTemplate( $template_id, $record );
136
                ModifyRecordWithTemplate( $template_id, $record );
136
            } else {
137
            } else {
137
                croak "No MARC modification template exists with id \"$template_id\"";
138
                print $query->header(-type => 'text/xml', -status => '500 Internal Server Error');
139
                print XMLout({ error => 'missing_marc_modification_template' }, NoAttr => 1, RootName => 'response', XMLDecl => 1);
140
                exit 0;
138
            }
141
            }
139
        }
142
        }
140
143
Lines 149-155 sub update_bib { Link Here
149
        $result->{'marcxml'} =  $xml;
152
        $result->{'marcxml'} =  $xml;
150
        $do_not_escape = 1;
153
        $do_not_escape = 1;
151
    }
154
    }
152
   
155
    print $query->header(-type => 'text/xml', -charset => 'utf-8');
153
    print XMLout($result, NoAttr => 1, RootName => 'response', XMLDecl => 1, NoEscape => $do_not_escape); 
156
    print XMLout($result, NoAttr => 1, RootName => 'response', XMLDecl => 1, NoEscape => $do_not_escape); 
154
}
157
}
155
158
156
- 

Return to bug 18138