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

(-)a/Koha/Library.pm (-1 / +1 lines)
Lines 371-377 sub to_api_mapping { Link Here
371
        marcorgcode      => 'marc_org_code',
371
        marcorgcode      => 'marc_org_code',
372
        opacusercss      => undef,
372
        opacusercss      => undef,
373
        opacuserjs       => undef,
373
        opacuserjs       => undef,
374
        branchcolor      => undef
374
        library_color    => undef
375
    };
375
    };
376
}
376
}
377
377
(-)a/Koha/Template/Plugin/Branches.pm (-3 / +3 lines)
Lines 191-205 sub GetBranchSpecificCSS { Link Here
191
    return $opacusercss;
191
    return $opacusercss;
192
}
192
}
193
193
194
sub GetBranchColor {
194
sub get_library_color {
195
    my ( $self, $branchcode ) = @_;
195
    my ( $self, $branchcode ) = @_;
196
196
197
    return q{} unless defined $branchcode;
197
    return q{} unless defined $branchcode;
198
198
199
    my $library     = Koha::Libraries->find($branchcode);
199
    my $library     = Koha::Libraries->find($branchcode);
200
    my $branchcolor = $library ? $library->branchcolor : q{};
200
    my $library_color = $library ? $library->library_color : q{};
201
201
202
    return $branchcolor;
202
    return $library_color;
203
}
203
}
204
204
205
1;
205
1;
(-)a/admin/branches.pl (-1 / +1 lines)
Lines 84-90 if ( $op eq 'add_form' ) { Link Here
84
      public
84
      public
85
      opacuserjs
85
      opacuserjs
86
      opacusercss
86
      opacusercss
87
      branchcolor
87
      library_color
88
    );
88
    );
89
    my $is_a_modif = $input->param('is_a_modif');
89
    my $is_a_modif = $input->param('is_a_modif');
90
90
(-)a/installer/data/mysql/atomicupdate/bug_37054_add_branchcolor.pl (-4 / +4 lines)
Lines 3-23 use Koha::Installer::Output qw(say_warning say_failure say_success say_info); Link Here
3
3
4
return {
4
return {
5
    bug_number  => "37054",
5
    bug_number  => "37054",
6
    description => "Add branches.branchcolor",
6
    description => "Add branches.library_color",
7
    up          => sub {
7
    up          => sub {
8
        my ($args) = @_;
8
        my ($args) = @_;
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
10
10
11
        if ( !column_exists( 'branches', 'branchcolor' ) ) {
11
        if ( !column_exists( 'branches', 'library_color' ) ) {
12
            $dbh->do(
12
            $dbh->do(
13
                q{
13
                q{
14
                ALTER TABLE branches
14
                ALTER TABLE branches
15
                ADD COLUMN `branchcolor` varchar(16) DEFAULT 0 COMMENT 'defines the branch color'
15
                ADD COLUMN `library_color` varchar(16) DEFAULT 0 COMMENT 'defines the library color'
16
                AFTER `opacusercss`
16
                AFTER `opacusercss`
17
            }
17
            }
18
            );
18
            );
19
        }
19
        }
20
        say $out "Added column 'branch.branchcolor'";
20
        say $out "Added column 'branch.library_color'";
21
21
22
    },
22
    },
23
};
23
};
(-)a/installer/data/mysql/kohastructure.sql (-1 / +1 lines)
Lines 1677-1683 CREATE TABLE `branches` ( Link Here
1677
  `public` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'whether this library should show in the opac',
1677
  `public` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'whether this library should show in the opac',
1678
  `opacuserjs` longtext DEFAULT NULL COMMENT 'branch specific javascript for the OPAC',
1678
  `opacuserjs` longtext DEFAULT NULL COMMENT 'branch specific javascript for the OPAC',
1679
  `opacusercss` longtext DEFAULT NULL COMMENT 'branch specific css for the OPAC',
1679
  `opacusercss` longtext DEFAULT NULL COMMENT 'branch specific css for the OPAC',
1680
  `branchcolor` varchar(16) DEFAULT NULL COMMENT 'branch specific color',
1680
  `library_color` varchar(16) DEFAULT NULL COMMENT 'library specific color',
1681
  PRIMARY KEY (`branchcode`)
1681
  PRIMARY KEY (`branchcode`)
1682
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1682
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1683
/*!40101 SET character_set_client = @saved_cs_client */;
1683
/*!40101 SET character_set_client = @saved_cs_client */;
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc (-6 / +6 lines)
Lines 51-73 var Koha = {}; Link Here
51
[% IF ( login ) %]
51
[% IF ( login ) %]
52
    [% Asset.css("css/login.css") | $raw %]
52
    [% Asset.css("css/login.css") | $raw %]
53
[% END %]
53
[% END %]
54
[% SET branchcolor = Branches.GetBranchColor( Branches.GetLoggedInBranchcode() ) %]
54
[% SET library_color = Branches.get_library_color( Branches.GetLoggedInBranchcode() ) %]
55
[% IF branchcolor %]
55
[% IF library_color %]
56
    <style>
56
    <style>
57
        #header_search,
57
        #header_search,
58
        #header_search ul,
58
        #header_search ul,
59
        #header_search .form-title,
59
        #header_search .form-title,
60
        #header_search .nav-tabs > li > a {
60
        #header_search .nav-tabs > li > a {
61
            background-color: [% branchcolor | html %];
61
            background-color: [% library_color | html %];
62
            border-color: [% branchcolor | html %];
62
            border-color: [% library_color | html %];
63
        }
63
        }
64
64
65
        #header_search button[type="submit"] {
65
        #header_search button[type="submit"] {
66
            background: [% branchcolor | html %];
66
            background: [% library_color | html %];
67
            filter: brightness(120%);
67
            filter: brightness(120%);
68
        }
68
        }
69
        #header_search button[type="submit"]:hover {
69
        #header_search button[type="submit"]:hover {
70
            background: [% branchcolor | html %];
70
            background: [% library_color | html %];
71
            filter: brightness(140%);
71
            filter: brightness(140%);
72
        }
72
        }
73
    </style>
73
    </style>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt (-8 / +7 lines)
Lines 368-375 Link Here
368
                </li>
368
                </li>
369
                <li>
369
                <li>
370
                    <label for="colorpicker">Search bar color: </label>
370
                    <label for="colorpicker">Search bar color: </label>
371
                    <input type="color" name="colorpicker" id="colorpicker" value="[% library.branchcolor | html %]" />
371
                    <input type="color" name="colorpicker" id="colorpicker" value="[% library.library_color | html %]" />
372
                    <input type="text" name="branchcolor" id="branchcolor" readonly="readonly" size="10" maxlength="16" value="[% library.branchcolor | html %]" />
372
                    <input type="text" name="library_color" id="library_color" readonly="readonly" size="10" maxlength="16" value="[% library.library_color | html %]" />
373
                    <a href="#" class="clear_color"><i class="fa fa-fw fa-trash-can"></i> Clear</a>
373
                    <a href="#" class="clear_color"><i class="fa fa-fw fa-trash-can"></i> Clear</a>
374
                </li>
374
                </li>
375
            </ol>
375
            </ol>
Lines 605-612 Link Here
605
                        [% END %]
605
                        [% END %]
606
                    </li>
606
                    </li>
607
                    <li>
607
                    <li>
608
                        <span class="label">Branch color</span>
608
                        <span class="label">Library color</span>
609
                        [% library.branchcolor | html %]
609
                        [% library.library_color | html %]
610
                    </li>
610
                    </li>
611
                </ol>
611
                </ol>
612
            </div> <!-- /.rows -->
612
            </div> <!-- /.rows -->
Lines 879-891 Link Here
879
        });
879
        });
880
880
881
        $("#colorpicker").on("change", function(){
881
        $("#colorpicker").on("change", function(){
882
            let branchcolor = this.value;
882
            let library_color = this.value;
883
            $("#branchcolor").val( branchcolor );
883
            $("#library_color").val( library_color );
884
        });
884
        });
885
885
886
        $(".clear_color").on("click", function(e){
886
        $(".clear_color").on("click", function(e){
887
            e.preventDefault();
887
            e.preventDefault();
888
            $("#branchcolor, #colorpicker").val( "" );
888
            $("#library_color, #colorpicker").val( "" );
889
        });
889
        });
890
    </script>
890
    </script>
891
[% END %]
891
[% END %]
892
- 

Return to bug 37054