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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt (-35 / +39 lines)
Lines 482-529 Link Here
482
    [% Asset.js("js/tools-menu.js") | $raw %]
482
    [% Asset.js("js/tools-menu.js") | $raw %]
483
    [% Asset.js("js/members-patron-selections.js") | $raw %]
483
    [% Asset.js("js/members-patron-selections.js") | $raw %]
484
    <script>
484
    <script>
485
        var table_settings = [% TablesSettings.GetTableSettings( 'tools', 'batch_patron_modification', 'borrowerst', 'json' ) | $raw %];
486
        [% FOREACH attrh IN attributes_header %]
487
            table_settings["columns"].push({
488
                columname: "[% attrh.attribute | html %]",
489
                cannot_be_modified: 0,
490
                cannot_be_toggled: 0,
491
                is_hidden: 0
492
            });
493
        [% END %]
494
495
        const has_patrons = [% borrowers ? 1 : 0 | html %]
496
        const op = "[% op | html %]";
497
        addPermissions({
498
            CanUpdatePasswordExpiration: [% CanUpdatePasswordExpiration ? 1 : 0 | html %],
499
            CanUpdateProtectPatron: [% CanUpdateProtectPatron ? 1 : 0 | html %],
500
        });
485
        var patron_attributes_lib = new Array();
501
        var patron_attributes_lib = new Array();
486
        var patron_attributes_values = new Array();
502
        var patron_attributes_values = new Array();
503
        var values = new Array();
504
        var lib = new Array();
505
        [% FOREACH pav IN patron_attributes_values %]
506
            values = new Array();
507
            lib = new Array();
508
            [% FOREACH option IN pav.options %]
509
                values.push("[% option.lib | html %]");
510
                lib.push("[% option.authorised_value | html %]");
511
            [% END %]
512
            patron_attributes_lib["[% pav.attribute_code | html %]"] = values;
513
            patron_attributes_values["[% pav.attribute_code | html %]"] = lib;
514
        [% END %]
515
    </script>
487
516
517
    <script>
488
        $(document).ready(function() {
518
        $(document).ready(function() {
489
            [% IF borrowers %]
519
            if (has_patrons){
490
491
                var table_settings = [% TablesSettings.GetTableSettings( 'tools', 'batch_patron_modification', 'borrowerst', 'json' ) | $raw %];
492
493
                [% FOREACH attrh IN attributes_header %]
494
                    table_settings["columns"].push({
495
                        columname: "[% attrh.attribute | html %]",
496
                        cannot_be_modified: 0,
497
                        cannot_be_toggled: 0,
498
                        is_hidden: 0
499
                    });
500
                [% END %]
501
502
                let selections_column = table_settings.columns.find(c => c.columnname == 'batch_patron_edit_selections');
520
                let selections_column = table_settings.columns.find(c => c.columnname == 'batch_patron_edit_selections');
503
                selections_column.cannot_be_modified = 1;
521
                selections_column.cannot_be_modified = 1;
504
                selections_column.cannot_be_toggled = 1;
522
                selections_column.cannot_be_toggled = 1;
505
                selections_column.force_visibility = 1;
523
                selections_column.force_visibility = 1;
506
                [% IF op == 'show' %]
524
                if (op == 'show'){
507
                    selections_column.is_hidden = 0;
525
                    selections_column.is_hidden = 0;
508
                [% ELSE %]
526
                } else {
509
                    selections_column.is_hidden = 1;
527
                    selections_column.is_hidden = 1;
510
                [% END %]
528
                }
511
529
512
                [% UNLESS CanUpdatePasswordExpiration %]
530
                if (!permissions.CanUpdatePasswordExpiration){
513
                    let password_expiration_date_column = table_settings.columns.find(c => c.columnname == 'batch_patron_edit_password_expiration_date');
531
                    let password_expiration_date_column = table_settings.columns.find(c => c.columnname == 'batch_patron_edit_password_expiration_date');
514
                    password_expiration_date_column.is_hidden = 1;
532
                    password_expiration_date_column.is_hidden = 1;
515
                    password_expiration_date_column.cannot_be_modified = 1;
533
                    password_expiration_date_column.cannot_be_modified = 1;
516
                    password_expiration_date_column.cannot_be_toggled = 1;
534
                    password_expiration_date_column.cannot_be_toggled = 1;
517
                    password_expiration_date_column.force_visibility = 1;
535
                    password_expiration_date_column.force_visibility = 1;
518
                [% END %]
536
                }
519
537
520
                [% UNLESS CanUpdateProtectPatron %]
538
                if (!permissions.CanUpdateProtectPatron){
521
                    let protected_column = table_settings.columns.find(c => c.columnname == 'batch_patron_edit_protected');
539
                    let protected_column = table_settings.columns.find(c => c.columnname == 'batch_patron_edit_protected');
522
                    protected_column.is_hidden = 1;
540
                    protected_column.is_hidden = 1;
523
                    protected_column.cannot_be_modified = 1;
541
                    protected_column.cannot_be_modified = 1;
524
                    protected_column.cannot_be_toggled = 1;
542
                    protected_column.cannot_be_toggled = 1;
525
                    protected_column.force_visibility = 1;
543
                    protected_column.force_visibility = 1;
526
                [% END %]
544
                }
527
545
528
                let patron_table = $("#borrowerst").kohaTable(
546
                let patron_table = $("#borrowerst").kohaTable(
529
                    {
547
                    {
Lines 546-565 Link Here
546
                    });
564
                    });
547
                    return false;
565
                    return false;
548
                });
566
                });
549
            [% END %]
567
            }
550
551
            var values = new Array();
552
            var lib = new Array();
553
            [% FOREACH pav IN patron_attributes_values %]
554
                values = new Array();
555
                lib = new Array();
556
                [% FOREACH option IN pav.options %]
557
                    values.push("[% option.lib | html %]");
558
                    lib.push("[% option.authorised_value | html %]");
559
                [% END %]
560
                patron_attributes_lib["[% pav.attribute_code | html %]"] = values;
561
                patron_attributes_values["[% pav.attribute_code | html %]"] = lib;
562
            [% END %]
563
568
564
            $('select[name="patron_attributes"]').change(function() {
569
            $('select[name="patron_attributes"]').change(function() {
565
                updateAttrValues(this);
570
                updateAttrValues(this);
566
- 

Return to bug 41580