Browse Source

Bug 23019: (follow-up) Fix other things

This patch:
* Fixes table name change
* Adds schema file
* Changes api parameter name
* Fixes string escaping
* Fixes error handling

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
20.11.x
Agustin Moyano 4 years ago
committed by Jonathan Druart
parent
commit
9f5596afd6
  1. 2
      Koha/ImportBatchProfile.pm
  2. 2
      Koha/ImportBatchProfiles.pm
  3. 4
      Koha/REST/V1/ImportBatchProfiles.pm
  4. 8
      Koha/Schema/Result/ImportBatch.pm
  5. 29
      Koha/Schema/Result/ImportBatchProfile.pm
  6. 4
      api/v1/swagger/parameters.json
  7. 4
      api/v1/swagger/parameters/import_batch_profile.json
  8. 2
      api/v1/swagger/paths/import_batch_profiles.json
  9. 6
      koha-tmpl/intranet-tmpl/prog/en/modules/tools/stage-marc-import.tt

2
Koha/ImportBatchProfile.pm

@ -48,7 +48,7 @@ sub to_api_mapping {
=cut
sub _type {
return 'ImportBatchesProfile';
return 'ImportBatchProfile';
}
1;

2
Koha/ImportBatchProfiles.pm

@ -37,7 +37,7 @@ Koha::ImportBatchProfiles - Koha ImportBatchProfiles Object class
=cut
sub _type {
return 'ImportBatchesProfile';
return 'ImportBatchProfile';
}
=head3 object_class

4
Koha/REST/V1/ImportBatchProfiles.pm

@ -91,7 +91,7 @@ sub edit {
my $c = shift->openapi->valid_input or return;
return try {
my $profile_id = $c->validation->param('profile_id');
my $profile_id = $c->validation->param('import_batch_profile_id');
my $profile = Koha::ImportBatchProfiles->find( $profile_id );
unless ($profile) {
return $c->render( status => 404,
@ -121,7 +121,7 @@ Method that handles deleting a Koha::ImportBatchProfile object
sub delete {
my $c = shift->openapi->valid_input or return;
my $profile_id = $c->validation->param('profile_id');
my $profile_id = $c->validation->param('import_batch_profile_id');
my $profile = Koha::ImportBatchProfiles->find( $profile_id );
unless ($profile) {

8
Koha/Schema/Result/ImportBatch.pm

@ -246,13 +246,13 @@ __PACKAGE__->has_many(
Type: belongs_to
Related object: L<Koha::Schema::Result::ImportBatchesProfile>
Related object: L<Koha::Schema::Result::ImportBatchProfile>
=cut
__PACKAGE__->belongs_to(
"profile",
"Koha::Schema::Result::ImportBatchesProfile",
"Koha::Schema::Result::ImportBatchProfile",
{ id => "profile_id" },
{
is_deferrable => 1,
@ -263,8 +263,8 @@ __PACKAGE__->belongs_to(
);
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-06-03 15:47:08
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:jGfBdM8ht823HaxSr2c9Wg
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-11-06 13:52:29
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:nnGJ0Nvgiz123+ic7v0GqQ
=head2 koha_object_class

29
Koha/Schema/Result/ImportBatchesProfile.pm → Koha/Schema/Result/ImportBatchProfile.pm

@ -1,12 +1,12 @@
use utf8;
package Koha::Schema::Result::ImportBatchesProfile;
package Koha::Schema::Result::ImportBatchProfile;
# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE
=head1 NAME
Koha::Schema::Result::ImportBatchesProfile
Koha::Schema::Result::ImportBatchProfile
=cut
@ -15,11 +15,11 @@ use warnings;
use base 'DBIx::Class::Core';
=head1 TABLE: C<import_batches_profile>
=head1 TABLE: C<import_batch_profiles>
=cut
__PACKAGE__->table("import_batches_profile");
__PACKAGE__->table("import_batch_profiles");
=head1 ACCESSORS
@ -132,6 +132,20 @@ __PACKAGE__->add_columns(
__PACKAGE__->set_primary_key("id");
=head1 UNIQUE CONSTRAINTS
=head2 C<u_import_batch_profiles__name>
=over 4
=item * L</name>
=back
=cut
__PACKAGE__->add_unique_constraint("u_import_batch_profiles__name", ["name"]);
=head1 RELATIONS
=head2 import_batches
@ -150,8 +164,11 @@ __PACKAGE__->has_many(
);
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-06-03 15:47:08
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:BWFz5yLEEP6ANuAWKAMCeg
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-11-06 13:52:29
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:kThbQZTT2c0fuWAGgvoDLQ
# You can replace this text with custom code or comments, and it will be preserved on regeneration
__PACKAGE__->add_columns(
'+parse_items' => { is_boolean => 1 },

4
api/v1/swagger/parameters.json

@ -11,8 +11,8 @@
"patron_id_qp": {
"$ref": "parameters/patron.json#/patron_id_qp"
},
"profile_id_pp": {
"$ref": "parameters/import_batch_profile.json#/profile_id_pp"
"import_batch_profile_id_pp": {
"$ref": "parameters/import_batch_profile.json#/import_batch_profile_id_pp"
},
"city_id_pp": {
"$ref": "parameters/city.json#/city_id_pp"

4
api/v1/swagger/parameters/import_batch_profile.json

@ -1,6 +1,6 @@
{
"profile_id_pp": {
"name": "profile_id",
"import_batch_profile_id_pp": {
"name": "import_batch_profile_id",
"in": "path",
"description": "Internal profile identifier",
"required": true,

2
api/v1/swagger/paths/import_batch_profiles.json

@ -352,7 +352,7 @@
},
"x-koha-authorization": {
"permissions": {
"catalogue": "1"
"tools": "stage_marc_import"
}
}
}

6
koha-tmpl/intranet-tmpl/prog/en/modules/tools/stage-marc-import.tt

@ -362,7 +362,7 @@
return getProfiles(profile.profile_id);
})
.catch(function(error) {
alert(_("An error occurred")+"\n\n"+error);
alert(_("An error occurred")+"\n\n"+((error.responseJSON && error.responseJSON.error) || error.responseText || error.statusText));
})
});
@ -386,7 +386,7 @@
return getProfiles();
})
.catch(function(error) {
alert(_("An error occurred")+"\n\n"+error);
alert(_("An error occurred")+"\n\n"+((error.responseJSON && error.responseJSON.error) || error.responseText || error.statusText));
})
});
});
@ -460,7 +460,7 @@
opt.prop('selected', true);
}
opt.attr("value", profile.profile_id);
opt.html(profile.name);
opt.text(profile.name);
opt.data("profile", profile);
});
})

Loading…
Cancel
Save