2 if ( CheckVersion($DBversion) ) {
4 # ACCOUNT_CREDIT UPDATES
5 # backup existing notice to action_logs
6 my $credit_arr = $dbh->selectall_arrayref(
7 "SELECT lang FROM letter WHERE code = 'ACCOUNT_CREDIT'", { Slice => {} });
8 my $c_sth = $dbh->prepare(q{
9 INSERT INTO action_logs ( timestamp, module, action, object, info, interface )
10 SELECT NOW(), 'NOTICES', 'UPGRADE', id, content, 'cli'
12 WHERE lang = ? AND code = 'ACCOUNT_CREDIT'
15 for my $c ( @{$credit_arr} ) {
16 $c_sth->execute( $c->{lang} );
19 # replace notice with default
22 [% PROCESS 'accounts.inc' %]
24 [% IF ( LibraryName ) %]
26 <th colspan="4" class="centerednames">
27 <h3>[% LibraryName | html %]</h3>
32 <th colspan="4" class="centerednames">
33 <h2><u>Fee receipt</u></h2>
37 <th colspan="4" class="centerednames">
38 <h2>[% Branches.GetName( credit.patron.branchcode ) | html %]</h2>
43 Received with thanks from [% credit.patron.firstname | html %] [% credit.patron.surname | html %] <br />
44 Card number: [% credit.patron.cardnumber | html %]<br />
49 <th>Description of charges</th>
54 <tr class="highlight">
55 <td>[% credit.date | $KohaDates %]</td>
57 [% PROCESS account_type_description account=credit %]
58 [%- IF credit.description %], [% credit.description | html %][% END %]
60 <td>[% credit.note | html %]</td>
61 <td class="credit">[% credit.amount | $Price %]</td>
66 <td colspan="3">Total outstanding dues as on date: </td>
67 [% IF ( credit.patron.account.balance >= 0 ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% credit.patron.account.balance | $Price %]</td>
73 my $c_insert = $dbh->prepare("UPDATE letter SET content = ?, is_html = 1 WHERE code = 'ACCOUNT_CREDIT'");
74 $c_insert->execute($c_notice);
76 # ACCOUNT_DEBIT UPDATES
77 # backup existing notice to action_logs
78 my $debit_arr = $dbh->selectall_arrayref(
79 "SELECT lang FROM letter WHERE code = 'ACCOUNT_DEBIT'", { Slice => {} });
80 my $d_sth = $dbh->prepare(q{
81 INSERT INTO action_logs ( timestamp, module, action, object, info, interface )
82 SELECT NOW(), 'NOTICES', 'UPGRADE', id, content, 'cli'
84 WHERE lang = ? AND code = 'ACCOUNT_DEBIT'
87 for my $d ( @{$debit_arr} ) {
88 $d_sth->execute( $d->{lang} );
91 # replace notice with default
94 [% PROCESS 'accounts.inc' %]
96 [% IF ( LibraryName ) %]
98 <th colspan="5" class="centerednames">
99 <h3>[% LibraryName | html %]</h3>
105 <th colspan="5" class="centerednames">
106 <h2><u>INVOICE</u></h2>
110 <th colspan="5" class="centerednames">
111 <h2>[% Branches.GetName( debit.patron.branchcode ) | html %]</h2>
116 Bill to: [% debit.patron.firstname | html %] [% debit.patron.surname | html %] <br />
117 Card number: [% debit.patron.cardnumber | html %]<br />
122 <th>Description of charges</th>
124 <th style="text-align:right;">Amount</th>
125 <th style="text-align:right;">Amount outstanding</th>
128 <tr class="highlight">
129 <td>[% debit.date | $KohaDates%]</td>
131 [% PROCESS account_type_description account=debit %]
132 [%- IF debit.description %], [% debit.description | html %][% END %]
134 <td>[% debit.note | html %]</td>
135 <td class="debit">[% debit.amount | $Price %]</td>
136 <td class="debit">[% debit.amountoutstanding | $Price %]</td>
139 [% IF ( tendered ) %]
141 <td colspan="3">Amount tendered: </td>
142 <td>[% tendered | $Price %]</td>
145 <td colspan="3">Change given: </td>
146 <td>[% change | $Price %]</td>
152 <td colspan="4">Total outstanding dues as on date: </td>
153 [% IF ( debit.patron.account.balance <= 0 ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% debit.patron.account.balance | $Price %]</td>
158 my $d_insert = $dbh->prepare("UPDATE letter SET content = ?, is_html = 1 WHERE code = 'ACCOUNT_DEBIT'");
159 $d_insert->execute($d_notice);
161 NewVersion( $DBversion, 26734, "Update notices to use defaults" );
162 warn "Warning - ACCOUNT_DEBIT and ACCOUNT_CREDIT slip templates have been replaced. Backups have been made to the action logs for your reference.";