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

(-)a/Koha/Account/Line.pm (+21 lines)
Lines 28-33 use Koha::Database; Link Here
28
use Koha::DateUtils qw( dt_from_string );
28
use Koha::DateUtils qw( dt_from_string );
29
use Koha::Exceptions::Account;
29
use Koha::Exceptions::Account;
30
use Koha::Patron::Debarments;
30
use Koha::Patron::Debarments;
31
use C4::Letters;
31
32
32
use base qw(Koha::Object Koha::Object::Mixin::AdditionalFields);
33
use base qw(Koha::Object Koha::Object::Mixin::AdditionalFields);
33
34
Lines 1097-1102 sub store { Link Here
1097
        }
1098
        }
1098
    }
1099
    }
1099
1100
1101
    #if there is a matching debit description letter, pull that content and render it for the accountline.description
1102
    if ( $self->is_debit && !$self->in_storage && !$self->description ) {
1103
        my $debit_type = $self->debit_type;
1104
        if ($debit_type) {
1105
            my $letter = C4::Letters::GetPreparedLetter(
1106
                module      => 'debit_description',
1107
                letter_code => $debit_type->code,
1108
                tables      => {
1109
                    borrowers   => $self->borrowernumber,
1110
                    branches    => $self->branchcode,
1111
                    accountline => $self,
1112
                },
1113
            );
1114
1115
            if ( $letter && $letter->{content} ) {
1116
                $self->description( $letter->{content} );
1117
            }
1118
        }
1119
    }
1120
1100
    return $self->SUPER::store();
1121
    return $self->SUPER::store();
1101
}
1122
}
1102
1123
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt (-1 / +8 lines)
Lines 208-213 Link Here
208
                    <li><a class="dropdown-item" href="/cgi-bin/koha/tools/letter.pl?op=add_form&amp;module=pos">Point of sale</a></li>
208
                    <li><a class="dropdown-item" href="/cgi-bin/koha/tools/letter.pl?op=add_form&amp;module=pos">Point of sale</a></li>
209
                    <li><a class="dropdown-item" href="/cgi-bin/koha/tools/letter.pl?op=add_form&amp;module=report">Reports</a></li>
209
                    <li><a class="dropdown-item" href="/cgi-bin/koha/tools/letter.pl?op=add_form&amp;module=report">Reports</a></li>
210
                    <li><a class="dropdown-item" href="/cgi-bin/koha/tools/letter.pl?op=add_form&amp;module=bookings">Bookings</a></li>
210
                    <li><a class="dropdown-item" href="/cgi-bin/koha/tools/letter.pl?op=add_form&amp;module=bookings">Bookings</a></li>
211
                    <li><a class="dropdown-item" href="/cgi-bin/koha/tools/letter.pl?op=add_form&amp;module=debit_description">Debit description (custom)</a></li>
211
                </ul>
212
                </ul>
212
            </div>
213
            </div>
213
        </div>
214
        </div>
Lines 290-295 Link Here
290
                                        <span>Reports</span>
291
                                        <span>Reports</span>
291
                                    [% CASE 'bookings' %]
292
                                    [% CASE 'bookings' %]
292
                                        <span>Bookings</span>
293
                                        <span>Bookings</span>
294
                                    [% CASE 'debit_description' %]
295
                                        <span>Debit description (custom)</span>
293
                                    [% CASE %]
296
                                    [% CASE %]
294
                                        <span>[% lette.module | html %]</span>
297
                                        <span>[% lette.module | html %]</span>
295
                                    [% END %]
298
                                    [% END %]
Lines 501-506 Link Here
501
                            [% ELSE %]
504
                            [% ELSE %]
502
                                <option value="bookings">Bookings</option>
505
                                <option value="bookings">Bookings</option>
503
                            [% END %]
506
                            [% END %]
507
                            [% IF ( module == "debit_descriptions" ) %]
508
                                <option value="bookings" selected="selected">Debit description (custom)</option>
509
                            [% ELSE %]
510
                                <option value="bookings">Bookings</option>
511
                            [% END %]
504
                        </select>
512
                        </select>
505
                    </li>
513
                    </li>
506
                    <li>
514
                    <li>
507
- 

Return to bug 40255