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

(-)a/Koha/Account/CreditType.pm (-1 / +1 lines)
Lines 22-28 use Modern::Perl; Link Here
22
use Koha::Database;
22
use Koha::Database;
23
use Koha::Exceptions;
23
use Koha::Exceptions;
24
24
25
use base qw(Koha::Object Koha::Object::Limit::Library);
25
use base qw(Koha::Object::Mixin::AdditionalFields Koha::Object Koha::Object::Limit::Library);
26
26
27
=head1 NAME
27
=head1 NAME
28
28
(-)a/Koha/Account/CreditTypes.pm (-1 / +1 lines)
Lines 22-28 use Modern::Perl; Link Here
22
use Koha::Database;
22
use Koha::Database;
23
use Koha::Account::CreditType;
23
use Koha::Account::CreditType;
24
24
25
use base qw(Koha::Objects Koha::Objects::Limit::Library);
25
use base qw(Koha::Objects::Mixin::AdditionalFields Koha::Objects Koha::Objects::Limit::Library);
26
26
27
=head1 NAME
27
=head1 NAME
28
28
(-)a/admin/credit_types.pl (-2 / +13 lines)
Lines 27-32 use C4::Output qw( output_html_with_http_headers ); Link Here
27
27
28
use Koha::Account::CreditType;
28
use Koha::Account::CreditType;
29
use Koha::Account::CreditTypes;
29
use Koha::Account::CreditTypes;
30
use Koha::AdditionalFields;
30
31
31
my $input = CGI->new;
32
my $input = CGI->new;
32
my $code  = $input->param('code');
33
my $code  = $input->param('code');
Lines 42-47 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
42
    }
43
    }
43
);
44
);
44
45
46
my @additional_fields = Koha::AdditionalFields->search( { tablename => 'account_credit_types' } )->as_list;
47
$template->param( additional_fields => \@additional_fields, );
48
45
my $credit_type;
49
my $credit_type;
46
if ($code) {
50
if ($code) {
47
    $credit_type = Koha::Account::CreditTypes->find($code);
51
    $credit_type = Koha::Account::CreditTypes->find($code);
Lines 66-74 if ( $op eq 'add_form' ) { Link Here
66
            };
70
            };
67
    }
71
    }
68
72
73
    my @additional_field_values = $credit_type ? $credit_type->get_additional_field_values_for_template : ();
74
69
    $template->param(
75
    $template->param(
70
        credit_type   => $credit_type,
76
        credit_type             => $credit_type,
71
        branches_loop => \@branches_loop
77
        branches_loop           => \@branches_loop,
78
        additional_field_values => @additional_field_values,
72
    );
79
    );
73
} elsif ( $op eq 'cud-add_validate' ) {
80
} elsif ( $op eq 'cud-add_validate' ) {
74
    my $description           = $input->param('description');
81
    my $description           = $input->param('description');
Lines 90-95 if ( $op eq 'add_form' ) { Link Here
90
        unless ( $credit_type->is_system ) {
97
        unless ( $credit_type->is_system ) {
91
            $credit_type->replace_library_limits( \@branches );
98
            $credit_type->replace_library_limits( \@branches );
92
        }
99
        }
100
101
        my @additional_fields = $credit_type->prepare_cgi_additional_field_values( $input, 'account_credit_types' );
102
        $credit_type->set_additional_fields( \@additional_fields );
103
93
        push @messages, { type => 'message', code => 'success_on_saving' };
104
        push @messages, { type => 'message', code => 'success_on_saving' };
94
    } catch {
105
    } catch {
95
        push @messages, { type => 'error', code => 'error_on_saving' };
106
        push @messages, { type => 'error', code => 'error_on_saving' };
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/additional-fields.tt (+1 lines)
Lines 155-160 Link Here
155
                            [% WRAPPER table_option value="accountlines:debit" %]Account lines (debit)[% END %]
155
                            [% WRAPPER table_option value="accountlines:debit" %]Account lines (debit)[% END %]
156
                        [% END %]
156
                        [% END %]
157
                        [% IF ( CAN_user_parameters_manage_accounts ) %]
157
                        [% IF ( CAN_user_parameters_manage_accounts ) %]
158
                            [% WRAPPER table_option value="account_credit_types" %]Account credit types[% END %]
158
                            [% WRAPPER table_option value="account_debit_types" %]Account debit types[% END %]
159
                            [% WRAPPER table_option value="account_debit_types" %]Account debit types[% END %]
159
                        [% END %]
160
                        [% END %]
160
                    </ul>
161
                    </ul>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/credit_types.tt (-2 / +18 lines)
Lines 143-149 Link Here
143
                    </li>
143
                    </li>
144
                </ol>
144
                </ol>
145
            </fieldset>
145
            </fieldset>
146
146
            [% IF additional_fields.size %]
147
                [% INCLUDE 'additional-fields-entry.inc' available=additional_fields values=additional_field_values wrap_fieldset=1 %]
148
            [% END %]
147
            <fieldset class="action">
149
            <fieldset class="action">
148
                <button id="save_credit_type" class="btn btn-primary">Save</button>
150
                <button id="save_credit_type" class="btn btn-primary">Save</button>
149
                <a class="cancel" href="/cgi-bin/koha/admin/credit_types.pl">Cancel</a>
151
                <a class="cancel" href="/cgi-bin/koha/admin/credit_types.pl">Cancel</a>
Lines 165-170 Link Here
165
                        <th>System</th>
167
                        <th>System</th>
166
                        <th>Code</th>
168
                        <th>Code</th>
167
                        <th>Description</th>
169
                        <th>Description</th>
170
                        [% IF additional_fields.size %]
171
                            <th>Additional fields</th>
172
                        [% END %]
168
                        <th>Available for</th>
173
                        <th>Available for</th>
169
                        <th>Credit number enabled</th>
174
                        <th>Credit number enabled</th>
170
                        <th>Library limitations</th>
175
                        <th>Library limitations</th>
Lines 177-182 Link Here
177
                                <td>[% credit_type.is_system | html %]</td>
182
                                <td>[% credit_type.is_system | html %]</td>
178
                                <td>[% credit_type.code | html %]</td>
183
                                <td>[% credit_type.code | html %]</td>
179
                                <td>[%- PROCESS credit_type_description credit_type = credit_type -%]</td>
184
                                <td>[%- PROCESS credit_type_description credit_type = credit_type -%]</td>
185
                                [% IF additional_fields.size %]
186
                                    <td>
187
                                        [% IF credit_type.additional_field_values.count > 0 %]
188
                                            [% FOREACH additional_field IN credit_type.additional_field_values %]
189
                                                <div><span class="label">[% additional_field.field.name | html %]</span>: [% additional_field.value | html %]</div>
190
                                            [% END %]
191
                                        [% ELSE %]
192
                                            <span>No additional fields</span>
193
                                        [% END %]
194
                                    </td>
195
                                [% END %]
180
                                <td>[% IF credit_type.can_be_added_manually %]Manual credit[% END %]</td>
196
                                <td>[% IF credit_type.can_be_added_manually %]Manual credit[% END %]</td>
181
                                <td>[% IF credit_type.credit_number_enabled %]Yes[% ELSE %]No[% END %]</td>
197
                                <td>[% IF credit_type.credit_number_enabled %]Yes[% ELSE %]No[% END %]</td>
182
                                <td>
198
                                <td>
Lines 236-241 Link Here
236
252
237
[% MACRO jsinclude BLOCK %]
253
[% MACRO jsinclude BLOCK %]
238
    [% Asset.js("js/admin-menu.js") | $raw %]
254
    [% Asset.js("js/admin-menu.js") | $raw %]
255
    [% Asset.js("js/additional-fields-entry.js") | $raw %]
239
    [% INCLUDE 'datatables.inc' %]
256
    [% INCLUDE 'datatables.inc' %]
240
    <script>
257
    <script>
241
        $(document).ready(function () {
258
        $(document).ready(function () {
242
- 

Return to bug 39177