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

(-)a/C4/Letters.pm (-1 / +8 lines)
Lines 738-743 sub _parseletter_sth { Link Here
738
    ($table eq 'accountlines' )    ? "SELECT * FROM $table WHERE   accountlines_id = ?"                               :
738
    ($table eq 'accountlines' )    ? "SELECT * FROM $table WHERE   accountlines_id = ?"                               :
739
    ($table eq 'biblio'       )    ? "SELECT * FROM $table WHERE   biblionumber = ?"                                  :
739
    ($table eq 'biblio'       )    ? "SELECT * FROM $table WHERE   biblionumber = ?"                                  :
740
    ($table eq 'biblioitems'  )    ? "SELECT * FROM $table WHERE   biblionumber = ?"                                  :
740
    ($table eq 'biblioitems'  )    ? "SELECT * FROM $table WHERE   biblionumber = ?"                                  :
741
    ($table eq 'tickets'      )    ? "SELECT * FROM $table WHERE   id = ?"                                            :
741
    ($table eq 'credits'      )    ? "SELECT * FROM accountlines WHERE   accountlines_id = ?"                         :
742
    ($table eq 'credits'      )    ? "SELECT * FROM accountlines WHERE   accountlines_id = ?"                         :
742
    ($table eq 'debits'       )    ? "SELECT * FROM accountlines WHERE   accountlines_id = ?"                         :
743
    ($table eq 'debits'       )    ? "SELECT * FROM accountlines WHERE   accountlines_id = ?"                         :
743
    ($table eq 'items'        )    ? "SELECT * FROM $table WHERE     itemnumber = ?"                                  :
744
    ($table eq 'items'        )    ? "SELECT * FROM $table WHERE     itemnumber = ?"                                  :
Lines 1615-1621 sub _process_tt { Link Here
1615
    my $tt_params = { %{ _get_tt_params( $tables ) }, %{ _get_tt_params( $loops, 'is_a_loop' ) }, %$substitute, %$objects };
1616
    my $tt_params = { %{ _get_tt_params( $tables ) }, %{ _get_tt_params( $loops, 'is_a_loop' ) }, %$substitute, %$objects };
1616
1617
1617
    $content = add_tt_filters( $content );
1618
    $content = add_tt_filters( $content );
1618
    $content = qq|[% USE KohaDates %][% USE Remove_MARC_punctuation %]$content|;
1619
    $content = qq|[% USE KohaDates %][% USE Remove_MARC_punctuation %][% PROCESS 'html_helpers.inc' %]$content|;
1619
1620
1620
    my $output;
1621
    my $output;
1621
    my $schema = Koha::Database->new->schema;
1622
    my $schema = Koha::Database->new->schema;
Lines 1729-1734 sub _get_tt_params { Link Here
1729
            plural   => 'suggestions',
1730
            plural   => 'suggestions',
1730
            pk       => 'suggestionid',
1731
            pk       => 'suggestionid',
1731
        },
1732
        },
1733
        tickets => {
1734
            module   => 'Koha::Tickets',
1735
            singular => 'ticket',
1736
            plural   => 'tickets',
1737
            pk       => 'id',
1738
        },
1732
        issues => {
1739
        issues => {
1733
            module   => 'Koha::Checkouts',
1740
            module   => 'Koha::Checkouts',
1734
            singular => 'checkout',
1741
            singular => 'checkout',
(-)a/Koha/Ticket.pm (+42 lines)
Lines 19-24 use Modern::Perl; Link Here
19
19
20
use base qw(Koha::Object);
20
use base qw(Koha::Object);
21
21
22
use C4::Letters;
23
22
use Koha::Ticket::Update;
24
use Koha::Ticket::Update;
23
use Koha::Ticket::Updates;
25
use Koha::Ticket::Updates;
24
26
Lines 98-103 sub add_update { Link Here
98
    return Koha::Ticket::Updates->_new_from_dbic($rs);
100
    return Koha::Ticket::Updates->_new_from_dbic($rs);
99
}
101
}
100
102
103
=head2 Core methods
104
105
=head3 store
106
107
Overloaded I<store> method to trigger notices as required
108
109
=cut
110
111
sub store {
112
    my ($self) = @_;
113
114
    my $is_new = !$self->in_storage;
115
    $self = $self->SUPER::store;
116
117
    if ($is_new) {
118
119
        # Send patron acknowledgement
120
        my $acknowledgement_letter = C4::Letters::GetPreparedLetter(
121
            module      => 'catalog',
122
            letter_code => 'TICKET_ACKNOWLEDGEMENT',
123
            branchcode  => $self->reporter->branchcode,
124
            tables      => { tickets => $self->id }
125
        );
126
127
        if ($acknowledgement_letter) {
128
            my $acknowledgement_message_id = C4::Letters::EnqueueLetter(
129
                {
130
                    letter                 => $acknowledgement_letter,
131
                    message_transport_type => 'email',
132
                    to_address => $self->reporter->notice_email_address
133
                }
134
            );
135
            C4::Letters::SendQueuedMessages(
136
                { message_id => $acknowledgement_message_id } );
137
        }
138
    }
139
140
    return $self;
141
}
142
101
=head2 Internal methods
143
=head2 Internal methods
102
144
103
=cut
145
=cut
(-)a/installer/data/mysql/atomicupdate/bug_31028.pl (+8 lines)
Lines 85-89 return { Link Here
85
            );
85
            );
86
            say $out "`CatalogConcernTemplate` block added to html_customization";
86
            say $out "`CatalogConcernTemplate` block added to html_customization";
87
        }
87
        }
88
89
        $dbh->do(
90
            q{
91
                INSERT IGNORE INTO letter(module,code,branchcode,name,is_html,title,content,message_transport_type)
92
                VALUES ( 'catalog', 'TICKET_ACKNOWLEDGEMENT', '', 'Concern acknowledgement', '1', 'Catalog concern acknowledgement', "Dear [% INCLUDE 'patron-title.inc' patron => ticket.reporter %],\r\n\r\nThankyou for your report concerning [% INCLUDE 'biblio-title.inc' biblio=ticket.biblio link = 0 %].\r\n\r\nYou reported: \r\n[% ticket.body %]\r\n\r\nThankyou", 'email' );
93
            }
94
        );
95
        say $out "Added new notice 'TICKET_ACKNOWLEDGEMENT'";
88
    }
96
    }
89
}
97
}
(-)a/installer/data/mysql/en/mandatory/sample_notices.yml (-1 / +18 lines)
Lines 43-48 tables: Link Here
43
            - ""
43
            - ""
44
            - "Your library."
44
            - "Your library."
45
45
46
        - module: catalog
47
          code: TICKET_ACKNOWLEDGEMENT
48
          branchcode: ""
49
          name: "Concern acknowledgement"
50
          is_html: 1
51
          title: "Catalog concern acknowledgment"
52
          message_transport_type: email
53
          lang: default
54
          content:
55
            - "Dear [% INCLUDE 'patron-title.inc' patron => ticket.reporter %],"
56
            - ""
57
            - "Thankyou for your report concerning [% INCLUDE 'biblio-title.inc' biblio=ticket.biblio link = 0 %]."
58
            - ""
59
            - "You reported: "
60
            - "[% ticket.body %]"
61
            - ""
62
            - "Thankyou"
63
46
        - module: circulation
64
        - module: circulation
47
          code: ACCOUNT_CREDIT
65
          code: ACCOUNT_CREDIT
48
          branchcode: ""
66
          branchcode: ""
49
- 

Return to bug 31028