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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reportproblem.tt (-50 / +50 lines)
Lines 25-81 Link Here
25
                [% ELSE %]
25
                [% ELSE %]
26
                    <div class="span12">
26
                    <div class="span12">
27
                [% END %]
27
                [% END %]
28
                    <h1>Report a problem</h1>
28
                <h1>Report a problem</h1>
29
29
30
                    [% IF ( successfuladd ) %]
30
                [% IF ( successfuladd ) %]
31
                        <div class="alert alert-info">Your problem report has been sent to the [% IF ( recipient == 'admin' ) %]Koha Administrator[% ELSE %][% recipient | html %][% END %].</div>
31
                    <div class="alert alert-info">
32
                    [% END %]
32
                        [% IF recipient == 'admin' %]
33
                    [% IF ( ( nolibemail and noadminemail ) or norecipients ) %]
33
                            Your problem report has been sent to the Koha administrator.
34
                        <div class="alert">Unable to send problem reports.</div>
34
                        [% ELSE %]
35
                    [% ELSE %]
35
                            Your problem report has been sent to the library.
36
                        <div id="reportproblem" class="maincontent toptabs">
36
                        [% END %]
37
                            <form name="reportlibform" action="/cgi-bin/koha/opac-reportproblem.pl" method="post">
37
                    </div>
38
                                <input type="hidden" name="op" value="addreport">
38
                [% END %]
39
                                <fieldset class="rows">
39
                <div id="reportproblem" class="maincontent toptabs">
40
                                    <ol>
40
                    <form name="reportlibform" action="/cgi-bin/koha/opac-reportproblem.pl" method="post">
41
                                        <li>
41
                        <input type="hidden" name="op" value="addreport">
42
                                            <label for="recipient">Send problem report to: </label>
42
                        <fieldset class="rows">
43
                                            [% IF !nolibemail and noadminemail %]
43
                            <ol>
44
                                                <option value="library">A librarian</option>
44
                                <li>
45
                                            [% ELSIF !noadminemail and nolibemail %]
45
                                    <label for="recipient">Send problem report to: </label>
46
                                                <option value="admin">Koha Administrator</option>
46
                                    [% IF library.branchemail %]
47
                                            [% ELSE %]
47
                                        <select name="recipient" id="recipient">
48
                                                <select name="recipient" id="recipient">
48
                                            <option value="library">A librarian</option>
49
                                                    <option value="library">A librarian</option>
49
                                            <option value="admin">Koha administrator</option>
50
                                                    <option value="admin">Koha Administrator</option>
50
                                        </select>
51
                                                </select>
51
                                    [% ELSE %]
52
                                            [% END %]
52
                                        <span>Koha administrator</span>
53
                                        </li>
53
                                    [% END %]
54
                                        <li>
54
                                </li>
55
                                            <label for="place">Problem found on page: </label>
55
                                <li>
56
                                            <input type="hidden" name="place" id="place" value="[% probpage | html %]">
56
                                    <label for="place">Problem found on page: </label>
57
                                            [% probpage | html %]
57
                                    <input type="hidden" name="place" id="place" value="[% probpage | html %]">
58
                                        </li>
58
                                    [% probpage | html %]
59
                                        <li>
59
                                </li>
60
                                            <label for="user">Username: </label>
60
                                <li>
61
                                            <input type="hidden" name="user" id="user" value="[% username | html %]" class="span3">
61
                                    <label for="user">Username: </label>
62
                                            [% username | html %]
62
                                    <input type="hidden" name="user" id="user" value="[% username | html %]" class="span3">
63
                                        <li>
63
                                    [% username | html %]
64
                                            <label for="subject">Subject: </label>
64
                                <li>
65
                                            <input type="text" name="subject" id="subject" value="[% subject | html %]" class="span3">
65
                                    <label for="subject">Subject: </label>
66
                                        </li>
66
                                    <input type="text" name="subject" id="subject" value="[% subject | html %]" class="span3">
67
                                        <li>
67
                                </li>
68
                                            <label for="message">Message: </label>
68
                                <li>
69
                                            <textarea name="message" id="message" rows="7" cols="60"></textarea>
69
                                    <label for="message">Message: </label>
70
                                        </li>
70
                                    <textarea name="message" id="message" rows="7" cols="60"></textarea>
71
                                    </ol>
71
                                </li>
72
                                </fieldset>
72
                            </ol>
73
                                <fieldset class="action">
73
                        </fieldset>
74
                                    <input type="submit" value="Submit" class="btn">
74
                        <fieldset class="action">
75
                                </fieldset>
75
                            <input type="submit" value="Submit" class="btn">
76
                            </form>
76
                        </fieldset>
77
                        </div>
77
                    </form>
78
                    [% END %]
78
                </div> <!-- / #reportproblem -->
79
79
80
                </div> <!-- / .span10/12 -->
80
                </div> <!-- / .span10/12 -->
81
            </div> <!-- / .row-fluid -->
81
            </div> <!-- / .row-fluid -->
(-)a/opac/opac-reportproblem.pl (-28 / +4 lines)
Lines 52-91 my $member = Koha::Patrons->find($borrowernumber); Link Here
52
my $username = $member->userid;
52
my $username = $member->userid;
53
my $branchcode = $member->branchcode;
53
my $branchcode = $member->branchcode;
54
my $library = Koha::Libraries->find($branchcode);
54
my $library = Koha::Libraries->find($branchcode);
55
my $recipients = 2;
56
57
if (
58
    ( !defined($library->branchreplyto) || $library->branchreplyto eq '' ) &&
59
    ( C4::Context->preference('ReplytoDefault') eq '' ) &&
60
    ( !defined($library->branchemail) || $library->branchemail eq '' )
61
    ) {
62
    $template->param( nolibemail => 1 );
63
    $recipients--;
64
}
65
66
my $koha_admin = C4::Context->preference('KohaAdminEmailAddress');
67
if ( $koha_admin eq '' ) {
68
    $template->param( noadminemail => 1 );
69
    $recipients--;
70
}
71
55
72
$template->param(
56
$template->param(
73
    username => $username,
57
    username => $username,
74
    probpage => $problempage,
58
    probpage => $problempage,
59
    library => $library,
75
);
60
);
76
61
77
my $op = $input->param('op') || '';
62
my $op = $input->param('op') || '';
78
if ( $op eq 'addreport' ) {
63
if ( $op eq 'addreport' ) {
79
64
80
    if ( $recipients == 0 ){
81
        print $input->redirect("/cgi-bin/koha/opac-reportproblem?norecipients=1.pl");
82
        exit;
83
    }
84
85
    my $subject = $input->param('subject');
65
    my $subject = $input->param('subject');
86
    my $message = $input->param('message');
66
    my $message = $input->param('message');
87
    my $place = $input->param('place');
67
    my $place = $input->param('place');
88
    my $recipient = $input->param('recipient') || 'library';
68
    my $recipient = $input->param('recipient') || 'admin';
89
    my $problem = Koha::ProblemReport->new(
69
    my $problem = Koha::ProblemReport->new(
90
        {
70
        {
91
            title          => $subject,
71
            title          => $subject,
Lines 121-138 if ( $op eq 'addreport' ) { Link Here
121
            letter                 => $letter,
101
            letter                 => $letter,
122
            borrowernumber         => $borrowernumber,
102
            borrowernumber         => $borrowernumber,
123
            message_transport_type => $transport,
103
            message_transport_type => $transport,
124
            to_address             => $koha_admin,
104
            to_address             => C4::Context->preference('KohaAdminEmailAddress'),
125
            from_address           => $from_address,
105
            from_address           => $from_address,
126
        });
106
        });
127
    } else {
107
    } else {
128
        my  $to_address = $library->branchreplyto ||
129
            C4::Context->preference('ReplytoDefault') ||
130
            $library->branchemail;
131
        C4::Letters::EnqueueLetter({
108
        C4::Letters::EnqueueLetter({
132
            letter                 => $letter,
109
            letter                 => $letter,
133
            borrowernumber         => $borrowernumber,
110
            borrowernumber         => $borrowernumber,
134
            message_transport_type => $transport,
111
            message_transport_type => $transport,
135
            to_address             => $to_address,
112
            to_address             => $library->branchemail,
136
            from_address           => $from_address,
113
            from_address           => $from_address,
137
        });
114
        });
138
    }
115
    }
139
- 

Return to bug 4461