Bug 4461: (follow-up) Redirect to 404 if OPACProblemReport not enabled
authorAleisha Amohia <aleishaamohia@hotmail.com>
Tue, 11 Feb 2020 19:48:30 +0000 (19:48 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 6 Apr 2020 10:16:31 +0000 (11:16 +0100)
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reportproblem.tt
opac/opac-reportproblem.pl

index 51c037f..102f63c 100644 (file)
                 [% END %]
                     <h1>Report a problem</h1>
 
-                    [% IF Koha.Preference('OPACReportProblem') %]
-
-                        [% IF ( successfuladd ) %]
-                            <div class="alert alert-info">Your problem report has been sent to the [% IF ( recipient == 'admin' ) %]Koha Administrator[% ELSE %][% recipient %][% END %].</div>
-                        [% END %]
-                        [% IF ( ( nolibemail and noadminemail ) or norecipients ) %]
-                            <div class="alert">Unable to send problem reports.</div>
-                        [% ELSE %]
-                            <div id="reportproblem" class="maincontent toptabs">
-                                <form name="reportlibform" action="/cgi-bin/koha/opac-reportproblem.pl" method="post">
-                                    <input type="hidden" name="op" value="addreport">
-                                    <fieldset class="rows">
-                                        <ol>
-                                            <li>
-                                                <label for="recipient">Send problem report to: </label>
-                                                [% IF !nolibemail and noadminemail %]
+                    [% IF ( successfuladd ) %]
+                        <div class="alert alert-info">Your problem report has been sent to the [% IF ( recipient == 'admin' ) %]Koha Administrator[% ELSE %][% recipient %][% END %].</div>
+                    [% END %]
+                    [% IF ( ( nolibemail and noadminemail ) or norecipients ) %]
+                        <div class="alert">Unable to send problem reports.</div>
+                    [% ELSE %]
+                        <div id="reportproblem" class="maincontent toptabs">
+                            <form name="reportlibform" action="/cgi-bin/koha/opac-reportproblem.pl" method="post">
+                                <input type="hidden" name="op" value="addreport">
+                                <fieldset class="rows">
+                                    <ol>
+                                        <li>
+                                            <label for="recipient">Send problem report to: </label>
+                                            [% IF !nolibemail and noadminemail %]
+                                                <option value="library">A librarian</option>
+                                            [% ELSIF !noadminemail and nolibemail %]
+                                                <option value="admin">Koha Administrator</option>
+                                            [% ELSE %]
+                                                <select name="recipient" id="recipient">
                                                     <option value="library">A librarian</option>
-                                                [% ELSIF !noadminemail and nolibemail %]
                                                     <option value="admin">Koha Administrator</option>
-                                                [% ELSE %]
-                                                    <select name="recipient" id="recipient">
-                                                        <option value="library">A librarian</option>
-                                                        <option value="admin">Koha Administrator</option>
-                                                    </select>
-                                                [% END %]
-                                            </li>
-                                            <li>
-                                                <label for="place">Problem found on page: </label>
-                                                <input type="hidden" name="place" id="place" value="[% probpage %]">
-                                                [% probpage | html %]
-                                            </li>
-                                            <li>
-                                                <label for="user">Username: </label>
-                                                <input type="hidden" name="user" id="user" value="[% username %]" class="span3">
-                                                [% username | html %]
-                                            <li>
-                                                <label for="subject">Subject: </label>
-                                                <input type="text" name="subject" id="subject" value="[% subject %]" class="span3">
-                                            </li>
-                                            <li>
-                                                <label for="message">Message: </label>
-                                                <textarea name="message" id="message" rows="7" cols="60"></textarea>
-                                            </li>
-                                        </ol>
-                                    </fieldset>
-                                    <fieldset class="action">
-                                        <input type="submit" value="Submit" class="btn">
-                                    </fieldset>
-                                </form>
-                            </div>
-                        [% END %]
-
-                    [% ELSE %] <!-- OPACReportProblem preference -->
-                        <div class="alert">Your library has not activated this feature.</div>
+                                                </select>
+                                            [% END %]
+                                        </li>
+                                        <li>
+                                            <label for="place">Problem found on page: </label>
+                                            <input type="hidden" name="place" id="place" value="[% probpage %]">
+                                            [% probpage | html %]
+                                        </li>
+                                        <li>
+                                            <label for="user">Username: </label>
+                                            <input type="hidden" name="user" id="user" value="[% username %]" class="span3">
+                                            [% username | html %]
+                                        <li>
+                                            <label for="subject">Subject: </label>
+                                            <input type="text" name="subject" id="subject" value="[% subject %]" class="span3">
+                                        </li>
+                                        <li>
+                                            <label for="message">Message: </label>
+                                            <textarea name="message" id="message" rows="7" cols="60"></textarea>
+                                        </li>
+                                    </ol>
+                                </fieldset>
+                                <fieldset class="action">
+                                    <input type="submit" value="Submit" class="btn">
+                                </fieldset>
+                            </form>
+                        </div>
                     [% END %]
 
                 </div> <!-- / .span10/12 -->
index d09afe2..7660e6c 100644 (file)
@@ -39,6 +39,10 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
     }
 );
 
+if ( !C4::Context->preference('OPACReportProblem') ){
+    print $input->redirect("/cgi-bin/koha/errors/404.pl");
+}
+
 my $problempage = $ENV{HTTP_REFERER};
 my $member = Koha::Patrons->find($borrowernumber);
 my $username = $member->userid;