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

(-)a/installer/data/mysql/atomicupdate/bug_40445_reconciliation_note_authorized_value.pl (+31 lines)
Line 0 Link Here
1
use Modern::Perl;
2
use Koha::Installer::Output qw(say_warning say_success say_info);
3
4
return {
5
    bug_number  => "40445",
6
    description => "Add system preference for cashup reconciliation note authorized values",
7
    up          => sub {
8
        my ($args) = @_;
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
10
11
        # Add CashupReconciliationNoteAuthorisedValue preference
12
        $dbh->do(
13
            q{
14
            INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type)
15
            VALUES (
16
                'CashupReconciliationNoteAuthorisedValue',
17
                '',
18
                '',
19
                'Authorized value category to use for cashup reconciliation notes (leave empty for free text)',
20
                'Free'
21
            )
22
        }
23
        );
24
25
        say_success( $out, "Added CashupReconciliationNoteAuthorisedValue system preference" );
26
        say_info(
27
            $out,
28
            "CashupReconciliationNoteAuthorisedValue: Optionally restrict reconciliation notes to authorized values"
29
        );
30
    },
31
};
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+1 lines)
Lines 150-155 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
150
('casLogout','0','','Does a logout from Koha should also log the user out of CAS?','YesNo'),
150
('casLogout','0','','Does a logout from Koha should also log the user out of CAS?','YesNo'),
151
('casServerUrl','https://localhost:8443/cas','','URL of the cas server','Free'),
151
('casServerUrl','https://localhost:8443/cas','','URL of the cas server','Free'),
152
('casServerVersion','2', '2|3','Version of the CAS server Koha will connect to.','Choice'),
152
('casServerVersion','2', '2|3','Version of the CAS server Koha will connect to.','Choice'),
153
('CashupReconciliationNoteAuthorisedValue', '', NULL, 'Authorized value category to use for cashup reconciliation notes (leave empty for free text)', 'Free'),
153
('CashupReconciliationNoteRequired', '0', NULL, 'Require a reconciliation note when completing cashup with discrepancies between expected and actual amounts', 'YesNo'),
154
('CashupReconciliationNoteRequired', '0', NULL, 'Require a reconciliation note when completing cashup with discrepancies between expected and actual amounts', 'YesNo'),
154
('CatalogConcerns', '0', NULL, 'Allow users to report catalog concerns', 'YesNo'),
155
('CatalogConcerns', '0', NULL, 'Allow users to report catalog concerns', 'YesNo'),
155
('CatalogerEmails', '', '', 'Notify these catalogers by email when a catalog concern is submitted', 'free'),
156
('CatalogerEmails', '', '', 'Notify these catalogers by email when a catalog concern is submitted', 'free'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/accounting.pref (+4 lines)
Lines 63-65 Accounting: Link Here
63
                1: "Require"
63
                1: "Require"
64
                0: "Don't require"
64
                0: "Don't require"
65
            - a reconciliation note when completing cashup with discrepancies between expected and actual amounts.
65
            - a reconciliation note when completing cashup with discrepancies between expected and actual amounts.
66
        -
67
            - "Use authorized value category "
68
            - pref: CashupReconciliationNoteAuthorisedValue
69
            - " for reconciliation notes during cashup. Leave empty to allow free text entry."
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt (-5 / +27 lines)
Lines 469-480 Link Here
469
                                <span id="reconciliation_text"></span>
469
                                <span id="reconciliation_text"></span>
470
                            </li>
470
                            </li>
471
                            <li id="reconciliation_note_field" style="display: none;">
471
                            <li id="reconciliation_note_field" style="display: none;">
472
                                <label for="reconciliation_note" id="reconciliation_note_label">Note (optional):</label>
472
                                <label for="reconciliation_note" id="reconciliation_note_label">Note:</label>
473
                                <textarea id="reconciliation_note" name="reconciliation_note" rows="3" cols="40" maxlength="1000" placeholder="Enter a note explaining the surplus or deficit..."></textarea>
473
                                [% IF reconciliation_note_avs %]
474
                                [% IF reconciliation_note_required %]
474
                                    <select id="reconciliation_note" name="reconciliation_note">
475
                                    <span class="required">Required</span>
475
                                        <option value="">-- Select a reason --</option>
476
                                        [% FOREACH av IN reconciliation_note_avs %]
477
                                            <option value="[% av.authorised_value | html %]">[% av.lib | html %]</option>
478
                                        [% END %]
479
                                    </select>
480
                                    [% IF reconciliation_note_required %]
481
                                        <span class="required">Required</span>
482
                                    [% END %]
483
                                [% ELSE %]
484
                                    <textarea id="reconciliation_note" name="reconciliation_note" rows="3" cols="40" maxlength="1000" placeholder="Enter a note explaining the surplus or deficit..."></textarea>
485
                                    [% IF reconciliation_note_required %]
486
                                        <span class="required">Required</span>
487
                                    [% END %]
488
                                    <div class="hint">Maximum 1000 characters</div>
476
                                [% END %]
489
                                [% END %]
477
                                <div class="hint">Maximum 1000 characters</div>
478
                            </li>
490
                            </li>
479
                        </ol>
491
                        </ol>
480
                    </fieldset>
492
                    </fieldset>
Lines 584-589 Link Here
584
    [% INCLUDE 'datatables.inc' %]
596
    [% INCLUDE 'datatables.inc' %]
585
    [% INCLUDE 'format_price.inc' %]
597
    [% INCLUDE 'format_price.inc' %]
586
    [% INCLUDE 'js-date-format.inc' %]
598
    [% INCLUDE 'js-date-format.inc' %]
599
    <script>
600
        // Map of authorized value codes to descriptions for reconciliation notes
601
        var reconciliation_note_avs = {
602
            [% IF reconciliation_note_avs %]
603
                [% FOREACH av IN reconciliation_note_avs %]
604
                    "[% av.authorised_value | html %]": "[% av.lib | html %]"[% UNLESS loop.last %],[% END %]
605
                [% END %]
606
            [% END %]
607
        };
608
    </script>
587
    [% Asset.js("js/cashup_modal.js") | $raw %]
609
    [% Asset.js("js/cashup_modal.js") | $raw %]
588
    [% Asset.js("js/modal_printer.js") | $raw %]
610
    [% Asset.js("js/modal_printer.js") | $raw %]
589
    [% INCLUDE 'calendar.inc' %]
611
    [% INCLUDE 'calendar.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/cashup_modal.js (-1 / +11 lines)
Lines 198-210 $(document).ready(function () { Link Here
198
198
199
                    // Add note if present
199
                    // Add note if present
200
                    if (reconciliationNote) {
200
                    if (reconciliationNote) {
201
                        // Check if note is an authorized value code and use description if available
202
                        var noteDisplay = reconciliationNote;
203
                        if (
204
                            typeof reconciliation_note_avs !== "undefined" &&
205
                            reconciliation_note_avs[reconciliationNote]
206
                        ) {
207
                            noteDisplay =
208
                                reconciliation_note_avs[reconciliationNote];
209
                        }
210
201
                        tfoot.append(
211
                        tfoot.append(
202
                            "<tr class='" +
212
                            "<tr class='" +
203
                                reconciliationClass +
213
                                reconciliationClass +
204
                                "'><td colspan='2'><em>" +
214
                                "'><td colspan='2'><em>" +
205
                                __("Note:") +
215
                                __("Note:") +
206
                                " " +
216
                                " " +
207
                                escape_str(reconciliationNote) +
217
                                escape_str(noteDisplay) +
208
                                "</em></td></tr>"
218
                                "</em></td></tr>"
209
                        );
219
                        );
210
                    }
220
                    }
(-)a/pos/register.pl (-1 / +12 lines)
Lines 67-76 if ( !$registers->count ) { Link Here
67
    my $accountlines       = $cash_register->outstanding_accountlines();
67
    my $accountlines       = $cash_register->outstanding_accountlines();
68
    my $cashup_in_progress = $cash_register->cashup_in_progress();
68
    my $cashup_in_progress = $cash_register->cashup_in_progress();
69
69
70
    # Get authorized values for reconciliation notes if configured
71
    my $note_av_category = C4::Context->preference('CashupReconciliationNoteAuthorisedValue');
72
    my $reconciliation_note_avs;
73
    if ($note_av_category) {
74
        require Koha::AuthorisedValues;
75
        $reconciliation_note_avs = Koha::AuthorisedValues->search(
76
            { category => $note_av_category },
77
            { order_by => { '-asc' => 'lib' } }
78
        );
79
    }
80
70
    $template->param(
81
    $template->param(
71
        register                     => $cash_register,
82
        register                     => $cash_register,
72
        accountlines                 => $accountlines,
83
        accountlines                 => $accountlines,
73
        cashup_in_progress           => $cashup_in_progress,
84
        cashup_in_progress           => $cashup_in_progress,
85
        reconciliation_note_avs      => $reconciliation_note_avs,
74
        reconciliation_note_required => C4::Context->preference('CashupReconciliationNoteRequired'),
86
        reconciliation_note_required => C4::Context->preference('CashupReconciliationNoteRequired'),
75
    );
87
    );
76
88
77
- 

Return to bug 40445