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

(-)a/cataloguing/record_source.pl (-12 / +13 lines)
Lines 22-28 use Modern::Perl; Link Here
22
22
23
use CGI;
23
use CGI;
24
use C4::Output qw( output_html_with_http_headers );
24
use C4::Output qw( output_html_with_http_headers );
25
use C4::Auth qw( get_template_and_user haspermission );
25
use C4::Auth   qw( get_template_and_user haspermission );
26
use C4::Biblio qw( ModBiblio );
26
use C4::Biblio qw( ModBiblio );
27
use C4::Context;
27
use C4::Context;
28
use Koha::DateUtils qw( dt_from_string );
28
use Koha::DateUtils qw( dt_from_string );
Lines 35-48 use URI::Escape qw( uri_escape_utf8 ); Link Here
35
# ========================
35
# ========================
36
#          MAIN
36
#          MAIN
37
#=========================
37
#=========================
38
my $input = CGI->new;
38
my $input            = CGI->new;
39
my $biblionumber  = $input->param('biblionumber');
39
my $biblionumber     = $input->param('biblionumber');
40
my $record_source_id = $input->param('record_source_id') // '';
40
my $record_source_id = $input->param('record_source_id') // '';
41
my $save = $input->param('save') // '';
41
my $save             = $input->param('save')             // '';
42
my $biblio = Koha::Biblios->find($biblionumber);
42
43
43
if ($save) {
44
if ($save) {
44
    my $biblio = Koha::Biblios->find($biblionumber);
45
    $biblio->metadata->set( { record_source_id => $record_source_id } )->store;
45
    $biblio->metadata->set({record_source_id => $record_source_id})->store;
46
    my $indexer = Koha::SearchEngine::Indexer->new( { index => $Koha::SearchEngine::BIBLIOS_INDEX } );
46
    my $indexer = Koha::SearchEngine::Indexer->new( { index => $Koha::SearchEngine::BIBLIOS_INDEX } );
47
    $indexer->index_records( $biblionumber, "specialUpdate", "biblioserver" );
47
    $indexer->index_records( $biblionumber, "specialUpdate", "biblioserver" );
48
    print $input->redirect("/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber");
48
    print $input->redirect("/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber");
Lines 50-65 if ($save) { Link Here
50
50
51
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
51
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
52
    {
52
    {
53
        template_name   => "cataloguing/record_source.tt",
53
        template_name => "cataloguing/record_source.tt",
54
        query           => $input,
54
        query         => $input,
55
        type            => "intranet",
55
        type          => "intranet",
56
        flagsrequired   => { editcatalogue => 'set_record_sources' },
56
        flagsrequired => { editcatalogue => 'set_record_sources' },
57
    });
57
    }
58
);
58
59
59
my $record_sources = Koha::RecordSources->search();
60
my $record_sources = Koha::RecordSources->search();
60
61
61
$template->param(
62
$template->param(
62
    biblionumber => $biblionumber,
63
    biblio   => $biblio,
63
    record_sources => $record_sources,
64
    record_sources => $record_sources,
64
);
65
);
65
66
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/record_source.tt (-3 / +7 lines)
Lines 44-59 Link Here
44
        <h1>Set the record source [% IF ( biblio.title ) %] for [% INCLUDE 'biblio-title.inc' %][% END %]</h1>
44
        <h1>Set the record source [% IF ( biblio.title ) %] for [% INCLUDE 'biblio-title.inc' %][% END %]</h1>
45
45
46
        <form method="get" action="/cgi-bin/koha/cataloguing/record_source.pl">
46
        <form method="get" action="/cgi-bin/koha/cataloguing/record_source.pl">
47
            <input type="hidden" name="biblionumber" value="[% biblio.biblionumber %]" />
47
            <input type="hidden" name="biblionumber" value="[% biblio.biblionumber | html_entity %]" />
48
            <select id="record_source_id" name="record_source_id">
48
            <select id="record_source_id" name="record_source_id">
49
                <option value=''>No specified source</option>
49
                <option value=''>No specified source</option>
50
                [% FOREACH source IN record_sources %]
50
                [% FOREACH source IN record_sources %]
51
                    <option value=[% source.record_source_id %] [% IF ( source.record_source_id == current_source.record_source_id ) %] selected="selected" [% END %]>[% source.name %]</option>
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 %]
52
                [% END %]
56
                [% END %]
53
            </select>
57
            </select>
54
            <div class="btn-group">
58
            <div class="btn-group">
55
                <input type="submit" name="save" class="btn btn-primary" value="Set record source" />
59
                <input type="submit" name="save" class="btn btn-primary" value="Set record source" />
56
                <button class="btn" href="/cgi-bin/koha/admin/record_sources" target="_blank">Configure record sources</button>
60
                <a class="btn btn-secondary" href="/cgi-bin/koha/admin/record_sources">Configure record sources</a>
57
            </div>
61
            </div>
58
        </form>
62
        </form>
59
    </div>
63
    </div>
(-)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