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 1734-1739 sub _get_tt_params { Link Here
1734
            plural   => 'suggestions',
1735
            plural   => 'suggestions',
1735
            pk       => 'suggestionid',
1736
            pk       => 'suggestionid',
1736
        },
1737
        },
1738
        tickets => {
1739
            module   => 'Koha::Tickets',
1740
            singular => 'ticket',
1741
            plural   => 'tickets',
1742
            pk       => 'id',
1743
        },
1737
        issues => {
1744
        issues => {
1738
            module   => 'Koha::Checkouts',
1745
            module   => 'Koha::Checkouts',
1739
            singular => 'checkout',
1746
            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 97-102 sub add_update { Link Here
97
    return Koha::Ticket::Update->_new_from_dbic($rs);
99
    return Koha::Ticket::Update->_new_from_dbic($rs);
98
}
100
}
99
101
102
=head2 Core methods
103
104
=head3 store
105
106
Overloaded I<store> method to trigger notices as required
107
108
=cut
109
110
sub store {
111
    my ($self) = @_;
112
113
    my $is_new = !$self->in_storage;
114
    $self = $self->SUPER::store;
115
116
    if ($is_new) {
117
118
        # Send patron acknowledgement
119
        my $acknowledgement_letter = C4::Letters::GetPreparedLetter(
120
            module      => 'catalog',
121
            letter_code => 'TICKET_ACKNOWLEDGEMENT',
122
            branchcode  => $self->reporter->branchcode,
123
            tables      => { tickets => $self->id }
124
        );
125
126
        if ($acknowledgement_letter) {
127
            my $acknowledgement_message_id = C4::Letters::EnqueueLetter(
128
                {
129
                    letter                 => $acknowledgement_letter,
130
                    message_transport_type => 'email',
131
                    borrowernumber         => $self->reporter_id,
132
                }
133
            );
134
            C4::Letters::SendQueuedMessages(
135
                { message_id => $acknowledgement_message_id } );
136
        }
137
    }
138
139
    return $self;
140
}
141
100
=head2 Internal methods
142
=head2 Internal methods
101
143
102
=cut
144
=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