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

(-)a/cataloguing/record_source.pl (+68 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2000-2002 Katipo Communications
4
# Copyright 2004-2010 BibLibre
5
#
6
# This file is part of Koha.
7
#
8
# Koha is free software; you can redistribute it and/or modify it
9
# under the terms of the GNU General Public License as published by
10
# the Free Software Foundation; either version 3 of the License, or
11
# (at your option) any later version.
12
#
13
# Koha is distributed in the hope that it will be useful, but
14
# WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
# GNU General Public License for more details.
17
#
18
# You should have received a copy of the GNU General Public License
19
# along with Koha; if not, see <http://www.gnu.org/licenses>.
20
21
use Modern::Perl;
22
23
use CGI;
24
use C4::Output qw( output_html_with_http_headers );
25
use C4::Auth   qw( get_template_and_user haspermission );
26
use C4::Biblio qw( ModBiblio );
27
use C4::Context;
28
use Koha::DateUtils qw( dt_from_string );
29
use Koha::Biblios;
30
use Koha::RecordSources;
31
use Koha::SearchEngine;
32
use Koha::SearchEngine::Indexer;
33
use URI::Escape qw( uri_escape_utf8 );
34
35
# ========================
36
#          MAIN
37
#=========================
38
my $input            = CGI->new;
39
my $biblionumber     = $input->param('biblionumber');
40
my $record_source_id = $input->param('record_source_id') // '';
41
my $save             = $input->param('save')             // '';
42
my $biblio           = Koha::Biblios->find($biblionumber);
43
44
if ($save) {
45
    $biblio->metadata->set( { record_source_id => $record_source_id } )->store;
46
    my $indexer = Koha::SearchEngine::Indexer->new( { index => $Koha::SearchEngine::BIBLIOS_INDEX } );
47
    $indexer->index_records( $biblionumber, "specialUpdate", "biblioserver" );
48
    print $input->redirect("/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber");
49
}
50
51
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
52
    {
53
        template_name => "cataloguing/record_source.tt",
54
        query         => $input,
55
        type          => "intranet",
56
        flagsrequired => { editcatalogue => 'set_record_sources' },
57
    }
58
);
59
60
my $record_sources = Koha::RecordSources->search();
61
62
$template->param(
63
    biblio         => $biblio,
64
    record_sources => $record_sources,
65
    current_source => { record_source_id => $biblio->metadata->record_source_id },
66
);
67
68
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc (-1 / +7 lines)
Lines 35-41 Link Here
35
    </div>
35
    </div>
36
[% END %]
36
[% END %]
37
37
38
[% IF ( CAN_user_editcatalogue_edit_catalogue || CAN_user_editcatalogue_edit_items || CAN_user_tools_items_batchmod || CAN_user_tools_items_batchdel ) or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) %]
38
[% IF ( CAN_user_editcatalogue_edit_catalogue || CAN_user_editcatalogue_edit_items || CAN_user_tools_items_batchmod || CAN_user_tools_items_batchdel || CAN_user_editcatalogue_set_record_sources ) or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) %]
39
    <div class="btn-group">
39
    <div class="btn-group">
40
    <button class="btn btn-default dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</button>
40
    <button class="btn btn-default dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</button>
41
        <ul class="dropdown-menu">
41
        <ul class="dropdown-menu">
Lines 47-52 Link Here
47
                [% END %]
47
                [% END %]
48
            [% END %]
48
            [% END %]
49
49
50
            [% IF CAN_user_editcatalogue_set_record_sources %]
51
               <li><a id="setrecordsource" href="/cgi-bin/koha/cataloguing/record_source.pl?biblionumber=[% biblionumber | html %]">Set record source</a></li>
52
            [% ELSE %]
53
               <li class="disabled"><a id="setrecordsource" href="#">Set record source</a></li>
54
            [% END %]
55
50
            [% IF CAN_user_tools_records_batchmod %]
56
            [% IF CAN_user_tools_records_batchmod %]
51
                <li>
57
                <li>
52
                    <form action="/cgi-bin/koha/tools/batch_record_modification.pl" method="post">
58
                    <form action="/cgi-bin/koha/tools/batch_record_modification.pl" method="post">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/record_source.tt (+65 lines)
Line 0 Link Here
1
[% USE raw %]
2
[% PROCESS 'i18n.inc' %]
3
[% SET footerjs = 1 %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
<title>[% FILTER collapse %]
6
    [% t("Set record sources for") | html %] [% INCLUDE 'biblio-title-head.inc' %] &rsaquo;
7
    [% t("Cataloging") | html %] &rsaquo;
8
    [% t("Koha") | html %]
9
[% END %]</title>
10
[% INCLUDE 'doc-head-close.inc' %]
11
</head>
12
<body id="catalog_set_record_source" class="catalog">
13
[% WRAPPER 'header.inc' %]
14
    [% INCLUDE 'cat-search.inc' %]
15
[% END %]
16
17
[% WRAPPER 'sub-header.inc' %]
18
    [% WRAPPER breadcrumbs %]
19
        [% WRAPPER breadcrumb_item %]
20
            <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a>
21
        [% END %]
22
        [% WRAPPER breadcrumb_item %]
23
            [% INCLUDE 'biblio-title.inc' link = 1 %]
24
        [% END %]
25
        [% WRAPPER breadcrumb_item bc_active= 1 %]
26
            <span>Set record's source</span>
27
        [% END %]
28
    [% END #/ WRAPPER breadcrumbs %]
29
[% END #/ WRAPPER sub-header.inc %]
30
31
[% SWITCH Koha.Preference('IntranetBiblioDefaultView') %]
32
[% CASE 'marc' %]         [% action_link = "/cgi-bin/koha/catalogue/MARCdetail.pl" %]
33
[% CASE 'labeled_marc' %] [% action_link = "/cgi-bin/koha/catalogue/labeledMARCdetail.pl" %]
34
[% CASE 'isbd' %]         [% action_link = "/cgi-bin/koha/catalogue/ISBDdetail.pl" %]
35
[% CASE %]                [% action_link = "/cgi-bin/koha/catalogue/detail.pl" %]
36
[% END %]
37
[% action_link = action_link _ '?biblionumber=' _ biblio.biblionumber %]
38
39
<div class="main container-fluid">
40
    <div class="row">
41
        <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
42
            [% INCLUDE 'messages.inc' %]
43
44
        <h1>Set the record source [% IF ( biblio.title ) %] for [% INCLUDE 'biblio-title.inc' %][% END %]</h1>
45
46
        <form method="get" action="/cgi-bin/koha/cataloguing/record_source.pl">
47
            <input type="hidden" name="biblionumber" value="[% biblio.biblionumber | html_entity %]" />
48
            <select id="record_source_id" name="record_source_id">
49
                <option value=''>No specified source</option>
50
                [% FOREACH source IN record_sources %]
51
                   [% IF ( source.record_source_id == current_source.record_source_id ) %]
52
                   <option value="[% source.record_source_id | html_entity %]" selected="selected">[% source.name | html_entity %]</option>
53
                   [% ELSE %]
54
                   <option value="[% source.record_source_id | html_entity %]">[% source.name | html_entity %]</option>
55
                   [% END %]
56
                [% END %]
57
            </select>
58
            <div class="btn-group">
59
                <input type="submit" name="save" class="btn btn-primary" value="Set record source" />
60
                <a class="btn btn-secondary" href="/cgi-bin/koha/admin/record_sources">Configure record sources</a>
61
            </div>
62
        </form>
63
    </div>
64
</div>
65
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/t/cypress/integration/Catalogue/Detail_spec.ts (-4 / +3 lines)
Lines 17-25 describe("Set record_source button is present", () => { Link Here
17
        cy.get("select").select("No specified source");
17
        cy.get("select").select("No specified source");
18
        cy.get("input[type=submit]").click();
18
        cy.get("input[type=submit]").click();
19
19
20
        cy.intercept("GET", '/api/v1/record_sources*').as('listSources')
20
        cy.intercept("GET", "/api/v1/record_sources*").as("listSources");
21
        cy.visit("/cgi-bin/koha/admin/record_sources");
21
        cy.visit("/cgi-bin/koha/admin/record_sources");
22
        cy.wait('@listSources')
22
        cy.wait("@listSources");
23
        cy.get("tr:last-child a.delete").click();
23
        cy.get("tr:last-child a.delete").click();
24
        cy.contains("Poop");
24
        cy.contains("Poop");
25
        cy.get("button.approve").click();
25
        cy.get("button.approve").click();
Lines 34-37 describe("Set record_source button is present", () => { Link Here
34
        cy.visit("/cgi-bin/koha/catalogue/detail.pl?biblionumber=51");
34
        cy.visit("/cgi-bin/koha/catalogue/detail.pl?biblionumber=51");
35
        cy.get("#catalogue_detail_record_source").contains("Poop");
35
        cy.get("#catalogue_detail_record_source").contains("Poop");
36
    });
36
    });
37
});
37
});
38
- 

Return to bug 36372