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

(-)a/Koha/Catalog/Concern.pm (-10 / +36 lines)
Lines 139-164 sub store { Link Here
139
    my $is_new = !$self->in_storage;
139
    my $is_new = !$self->in_storage;
140
    $self = $self->SUPER::store;
140
    $self = $self->SUPER::store;
141
141
142
    if ($is_new && C4::Context->preference('CatalogerEmails') ) {
142
    if ($is_new) {
143
143
144
        # notify the library if a notice exists
144
        # Send patron acknowledgement
145
        my $letter = C4::Letters::GetPreparedLetter(
145
        my $acknowledgement_letter = C4::Letters::GetPreparedLetter(
146
            module      => 'catalog',
146
            module      => 'catalog',
147
            letter_code => 'CONCERN_NOTIFY',
147
            letter_code => 'CONCERN_ACKNOWLEDGEMENT',
148
            branchcode  => $self->reporter->branchcode,
148
            branchcode  => $self->reporter->branchcode,
149
            tables      => { catalog_concerns => $self->id }
149
            tables      => { catalog_concerns => $self->id }
150
        );
150
        );
151
151
152
        if ($letter) {
152
        if ($acknowledgement_letter) {
153
            my $message_id = C4::Letters::EnqueueLetter(
153
            my $acknowledgement_message_id = C4::Letters::EnqueueLetter(
154
                {
154
                {
155
                    letter                 => $letter,
155
                    letter                 => $acknowledgement_letter,
156
                    message_transport_type => 'email',
156
                    message_transport_type => 'email',
157
                    to_address             => C4::Context->preference('CatalogerEmails'),
157
                    to_address => $self->reporter->notice_email_address
158
                    reply_address          => $self->reporter->notice_email_address,
159
                }
158
                }
160
            );
159
            );
161
            C4::Letters::SendQueuedMessages( { message_id => $message_id } );
160
            C4::Letters::SendQueuedMessages(
161
                { message_id => $acknowledgement_message_id } );
162
        }
163
164
        # Notify cataloger by email
165
        if ( C4::Context->preference('CatalogerEmails') ) {
166
167
            # notify the library if a notice exists
168
            my $notify_letter = C4::Letters::GetPreparedLetter(
169
                module      => 'catalog',
170
                letter_code => 'CONCERN_NOTIFY',
171
                branchcode  => $self->reporter->branchcode,
172
                tables      => { catalog_concerns => $self->id }
173
            );
174
175
            if ($notify_letter) {
176
                my $message_id = C4::Letters::EnqueueLetter(
177
                    {
178
                        letter                 => $notify_letter,
179
                        message_transport_type => 'email',
180
                        to_address             =>
181
                          C4::Context->preference('CatalogerEmails'),
182
                        reply_address => $self->reporter->notice_email_address,
183
                    }
184
                );
185
                C4::Letters::SendQueuedMessages(
186
                    { message_id => $message_id } );
187
            }
162
        }
188
        }
163
    }
189
    }
164
190
(-)a/installer/data/mysql/atomicupdate/bug_31028.pl (+6 lines)
Lines 62-67 return { Link Here
62
            }
62
            }
63
        );
63
        );
64
64
65
        $dbh->do(
66
            q{
67
                INSERT IGNORE INTO letter(module,code,branchcode,name,is_html,title,content,message_transport_type)
68
                VALUES ( 'catalog', 'CONCERN_ACKNOWLEDGEMENT', '', 'Concern acknowledgement', '1', 'Catalog concern acknowledgement', "Dear [% INCLUDE 'patron-title.inc' patron => catalog_concern.reporter %],\r\n\r\nThankyou for your report concerning [% INCLUDE 'biblio-title.inc' biblio=catalog_concern.biblio link = 0 %].\r\n\r\nYou reported: \r\n[% catalog_concern.message %]\r\n\r\nThankyou", 'email' );
69
            }
70
        );
65
71
66
        if ( ( $dbh->selectrow_array('SELECT COUNT(*) FROM additional_contents WHERE location=?', undef, 'CatalogConcernHelp') )[0] == 0 ) { # Check to make idempotent
72
        if ( ( $dbh->selectrow_array('SELECT COUNT(*) FROM additional_contents WHERE location=?', undef, 'CatalogConcernHelp') )[0] == 0 ) { # Check to make idempotent
67
            $dbh->do(
73
            $dbh->do(
(-)a/installer/data/mysql/en/mandatory/sample_notices.yml (-1 / +18 lines)
Lines 59-64 tables: Link Here
59
            - ""
59
            - ""
60
            - "You can mark this concern as resolved from the concern management <a href='[% Koha.Preference('IntranetBaseURL') %]/cgi-bin/koha/cataloguing/concerns.pl'>page</a>."
60
            - "You can mark this concern as resolved from the concern management <a href='[% Koha.Preference('IntranetBaseURL') %]/cgi-bin/koha/cataloguing/concerns.pl'>page</a>."
61
61
62
        - module: catalog
63
          code: CONCERN_ACKNOWLEDGEMENT
64
          branchcode: ""
65
          name: "Concern acknowledgement"
66
          is_html: 1
67
          title: "Catalog concern acknowledgment"
68
          message_transport_type: email
69
          lang: default
70
          content:
71
            - "Dear [% INCLUDE 'patron-title.inc' patron => catalog_concern.reporter %],"
72
            - ""
73
            - "Thankyou for your report concerning [% INCLUDE 'biblio-title.inc' biblio=catalog_concern.biblio link = 0 %]."
74
            - ""
75
            - "You reported: "
76
            - "[% catalog_concern.message %]"
77
            - ""
78
            - "Thankyou"
79
62
        - module: catalog
80
        - module: catalog
63
          code: CONCERN_RESOLVE
81
          code: CONCERN_RESOLVE
64
          branchcode: ""
82
          branchcode: ""
65
- 

Return to bug 31028