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

(-)a/C4/Review.pm (+40 lines)
Lines 81-86 sub savereview { Link Here
81
  (?,?,?,0,now())";
81
  (?,?,?,0,now())";
82
    my $sth = $dbh->prepare($query);
82
    my $sth = $dbh->prepare($query);
83
    $sth->execute( $borrowernumber, $biblionumber, $review);
83
    $sth->execute( $borrowernumber, $biblionumber, $review);
84
85
    unless ($sth->err()) {
86
        SendReviewAlert( $review, $borrowernumber );
87
    }
84
}
88
}
85
89
86
sub updatereview {
90
sub updatereview {
Lines 89-94 sub updatereview { Link Here
89
    my $query = "UPDATE reviews SET review=?,datereviewed=now(),approved=0  WHERE borrowernumber=? and biblionumber=?";
93
    my $query = "UPDATE reviews SET review=?,datereviewed=now(),approved=0  WHERE borrowernumber=? and biblionumber=?";
90
    my $sth = $dbh->prepare($query);
94
    my $sth = $dbh->prepare($query);
91
    $sth->execute( $review, $borrowernumber, $biblionumber );
95
    $sth->execute( $review, $borrowernumber, $biblionumber );
96
97
    unless ($sth->err()) {
98
        SendReviewAlert( $review, $borrowernumber );
99
    }
92
}
100
}
93
101
94
sub numberofreviews {
102
sub numberofreviews {
Lines 186-191 sub deletereview { Link Here
186
    $sth->execute($reviewid);
194
    $sth->execute($reviewid);
187
}
195
}
188
196
197
=head2 SendReviewAlert
198
199
  SendReviewAlert( $review, $borrowernumber );
200
201
=cut
202
203
sub SendReviewAlert {
204
    my $review = shift;
205
    my $borrowernumber = shift;
206
207
    my $moderatorEmail = C4::Context->preference('CommentModeratorsEmail');
208
209
    return unless $moderatorEmail;
210
211
    my $letter =  C4::Letters::GetPreparedLetter (
212
        module => 'members',
213
        letter_code => 'COMMENT_CREATED',
214
        tables => {
215
            'borrowers'   => $borrowernumber,
216
        }
217
    ) or return;
218
219
    C4::Letters::EnqueueLetter({
220
        letter                 => $letter,
221
        borrowernumber         => $borrowernumber,
222
        message_transport_type => 'email',
223
        to_address             => $moderatorEmail,
224
    });
225
226
    return 1;
227
}
228
189
1;
229
1;
190
__END__
230
__END__
191
231
(-)a/installer/data/mysql/en/mandatory/sample_notices.sql (+11 lines)
Lines 118-123 http://<<OPACBaseURL>>/cgi-bin/koha/opac-registration-verify.pl?token=<<borrower Link Here
118
If you did not initiate this request, you may safely ignore this one-time message. The request will expire shortly.'
118
If you did not initiate this request, you may safely ignore this one-time message. The request will expire shortly.'
119
);
119
);
120
120
121
INSERT INTO  letter (module, code, branchcode, name, is_html, title, content, message_transport_type)
122
VALUES ( 'members', 'COMMENT_CREATED', '', 'Comment created notification', '0', 'Comment from <<borrowers.cardnumber>> is waiting for moderation', 'Dear moderator,
123
124
We want to inform you that borrower <<borrowers.cardnumber>> has just created a new comment.
125
126
Check it out!
127
128
Your library.',
129
'email'
130
);
131
121
INSERT INTO  letter (module, code, branchcode, name, is_html, title, content)
132
INSERT INTO  letter (module, code, branchcode, name, is_html, title, content)
122
VALUES ('members', 'SHARE_INVITE', '', 'Invitation for sharing a list', '0', 'Share list <<listname>>', 'Dear patron,
133
VALUES ('members', 'SHARE_INVITE', '', 'Invitation for sharing a list', '0', 'Share list <<listname>>', 'Dear patron,
123
134
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 88-93 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
88
('CircAutoPrintQuickSlip','qslip',NULL,'Choose what should happen when an empty barcode field is submitted in circulation: Display a print quick slip window, Display a print slip window or Clear the screen.','Choice'),
88
('CircAutoPrintQuickSlip','qslip',NULL,'Choose what should happen when an empty barcode field is submitted in circulation: Display a print quick slip window, Display a print slip window or Clear the screen.','Choice'),
89
('CircControl','ItemHomeLibrary','PickupLibrary|PatronLibrary|ItemHomeLibrary','Specify the agency that controls the circulation and fines policy','Choice'),
89
('CircControl','ItemHomeLibrary','PickupLibrary|PatronLibrary|ItemHomeLibrary','Specify the agency that controls the circulation and fines policy','Choice'),
90
('COinSinOPACResults','1','','If ON, use COinS in OPAC search results page.  NOTE: this can slow down search response time significantly','YesNo'),
90
('COinSinOPACResults','1','','If ON, use COinS in OPAC search results page.  NOTE: this can slow down search response time significantly','YesNo'),
91
('CommentModeratorsEmail','','','The email address where to send a notification (template code COMMENT_CREATED) when a Borrower adds/modifies a review/comment for a Biblio. Set to empty to disable sending email notifications.','Textarea'),
91
('ConfirmFutureHolds','0','','Number of days for confirming future holds','Integer'),
92
('ConfirmFutureHolds','0','','Number of days for confirming future holds','Integer'),
92
('CurrencyFormat','US','US|FR','Determines the display format of currencies. eg: \'36000\' is displayed as \'360 000,00\'  in \'FR\' or \'360,000.00\'  in \'US\'.','Choice'),
93
('CurrencyFormat','US','US|FR','Determines the display format of currencies. eg: \'36000\' is displayed as \'360 000,00\'  in \'FR\' or \'360,000.00\'  in \'US\'.','Choice'),
93
('dateformat','us','metric|us|iso','Define global date format (us mm/dd/yyyy, metric dd/mm/yyy, ISO yyyy-mm-dd)','Choice'),
94
('dateformat','us','metric|us|iso','Define global date format (us mm/dd/yyyy, metric dd/mm/yyy, ISO yyyy-mm-dd)','Choice'),
(-)a/installer/data/mysql/updatedatabase.pl (+24 lines)
Lines 8314-8319 if ( CheckVersion($DBversion) ) { Link Here
8314
    SetVersion($DBversion);
8314
    SetVersion($DBversion);
8315
}
8315
}
8316
8316
8317
$DBversion = "3.17.00.XXX";
8318
if ( CheckVersion($DBversion) ) {
8319
    $dbh->do(q|
8320
INSERT INTO  letter (module, code, branchcode, name, is_html, title, content, message_transport_type)
8321
VALUES ( 'members', 'COMMENT_CREATED', '', 'Comment created notification', '0', 'Comment from <<borrowers.cardnumber>> is waiting for moderation', 'Dear moderator,
8322
8323
We want to inform you that borrower <<borrowers.cardnumber>> has just created a new comment.
8324
8325
Check it out!
8326
8327
Your library.',
8328
'email'
8329
);
8330
    |);
8331
    $dbh->do(q|
8332
        INSERT INTO systempreferences
8333
            (variable,value,explanation,options,type)
8334
        VALUES
8335
        ('CommentModeratorsEmail','','','The email address where to send a notification (template code COMMENT_CREATED) when a Borrower adds/modifies a review/comment for a Biblio. Set to empty to disable sending email notifications.','Textarea')
8336
    |);
8337
    print "Upgrade to $DBversion done (Bug 1985 - Email notification of new OPAC comments)\n";
8338
    SetVersion($DBversion);
8339
}
8340
8317
$DBversion = "3.15.00.041";
8341
$DBversion = "3.15.00.041";
8318
if ( CheckVersion($DBversion) ) {
8342
if ( CheckVersion($DBversion) ) {
8319
    my $name = $dbh->selectcol_arrayref(q|
8343
    my $name = $dbh->selectcol_arrayref(q|
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (-1 / +4 lines)
Lines 415-420 OPAC: Link Here
415
                  no: Hide
415
                  no: Hide
416
            - reviewer's photo beside comments in OPAC.
416
            - reviewer's photo beside comments in OPAC.
417
        -
417
        -
418
            - The email address where to send a notification (template code COMMENT_CREATED) when a Borrower adds/modifies a review/comment for a Biblio. Set to empty to disable sending email notifications.
419
            - pref: CommentModeratorsEmail
420
              class: textarea
421
        -
418
            - pref: RequestOnOpac
422
            - pref: RequestOnOpac
419
              choices:
423
              choices:
420
                  yes: Allow
424
                  yes: Allow
421
- 

Return to bug 1985