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

(-)a/C4/Review.pm (+39 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
=head SendReviewAlert
198
199
=cut
200
201
sub SendReviewAlert {
202
    my $review = shift;
203
    my $borrowernumber = shift;
204
205
    my $moderatorEmail = C4::Context->preference('CommentModeratorsEmail');
206
    if (not($moderatorEmail)) {
207
        return undef;
208
    }
209
210
    my $letter =  C4::Letters::GetPreparedLetter (
211
        module => 'members',
212
        letter_code => 'COMMENT_CREATED',
213
        tables => {
214
            'borrowers'   => $borrowernumber,
215
        }
216
    ) or return;
217
218
    C4::Letters::EnqueueLetter({
219
        letter                 => $letter,
220
        borrowernumber         => $borrowernumber,
221
        message_transport_type => 'email',
222
        to_address             => $moderatorEmail,
223
    });
224
225
    return 1;
226
}
227
189
1;
228
1;
190
__END__
229
__END__
191
230
(-)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 358-363 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
358
('ReturnLog','1',NULL,'If ON, enables the circulation (returns) log','YesNo'),
358
('ReturnLog','1',NULL,'If ON, enables the circulation (returns) log','YesNo'),
359
('ReturnToShelvingCart','0','','If set, when any item is \'checked in\', it\'s location code will be changed to CART.','YesNo'),
359
('ReturnToShelvingCart','0','','If set, when any item is \'checked in\', it\'s location code will be changed to CART.','YesNo'),
360
('reviewson','1','','If ON, enables patron reviews of bibliographic records in the OPAC','YesNo'),
360
('reviewson','1','','If ON, enables patron reviews of bibliographic records in the OPAC','YesNo'),
361
('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'),
361
('RoutingListAddReserves','1','','If ON the patrons on routing lists are automatically added to holds on the issue.','YesNo'),
362
('RoutingListAddReserves','1','','If ON the patrons on routing lists are automatically added to holds on the issue.','YesNo'),
362
('RoutingListNote','To change this note edit <a href=\"/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=RoutingListNote#jumped\">RoutingListNote</a> system preference.','70|10','Define a note to be shown on all routing lists','Textarea'),
363
('RoutingListNote','To change this note edit <a href=\"/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=RoutingListNote#jumped\">RoutingListNote</a> system preference.','70|10','Define a note to be shown on all routing lists','Textarea'),
363
('RoutingSerials','1',NULL,'If ON, serials routing is enabled','YesNo'),
364
('RoutingSerials','1',NULL,'If ON, serials routing is enabled','YesNo'),
(-)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 410-415 OPAC: Link Here
410
                  no: Hide
410
                  no: Hide
411
            - reviewer's photo beside comments in OPAC.
411
            - reviewer's photo beside comments in OPAC.
412
        -
412
        -
413
            - 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.
414
            - pref: CommentModeratorsEmail
415
              class: textarea
416
        -
413
            - pref: RequestOnOpac
417
            - pref: RequestOnOpac
414
              choices:
418
              choices:
415
                  yes: Allow
419
                  yes: Allow
416
- 

Return to bug 1985