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

(-)a/Koha/Library.pm (-23 / +23 lines)
Lines 348-376 on the API. Link Here
348
348
349
sub to_api_mapping {
349
sub to_api_mapping {
350
    return {
350
    return {
351
        branchcode       => 'library_id',
351
        branchcode             => 'library_id',
352
        branchname       => 'name',
352
        branchname             => 'name',
353
        branchaddress1   => 'address1',
353
        branchaddress1         => 'address1',
354
        branchaddress2   => 'address2',
354
        branchaddress2         => 'address2',
355
        branchaddress3   => 'address3',
355
        branchaddress3         => 'address3',
356
        branchzip        => 'postal_code',
356
        branchzip              => 'postal_code',
357
        branchcity       => 'city',
357
        branchcity             => 'city',
358
        branchstate      => 'state',
358
        branchstate            => 'state',
359
        branchcountry    => 'country',
359
        branchcountry          => 'country',
360
        branchphone      => 'phone',
360
        branchphone            => 'phone',
361
        branchfax        => 'fax',
361
        branchfax              => 'fax',
362
        branchemail      => 'email',
362
        branchemail            => 'email',
363
        branchillemail   => 'ill_email',
363
        branchillemail         => 'ill_email',
364
        branchreplyto    => 'reply_to_email',
364
        branchreplyto          => 'reply_to_email',
365
        branchreturnpath => 'return_path_email',
365
        branchreturnpath       => 'return_path_email',
366
        branchurl        => 'url',
366
        branchurl              => 'url',
367
        issuing          => undef,
367
        issuing                => undef,
368
        branchip         => 'ip',
368
        branchip               => 'ip',
369
        branchnotes      => 'notes',
369
        branchnotes            => 'notes',
370
        marcorgcode      => 'marc_org_code',
370
        marcorgcode            => 'marc_org_code',
371
        opacusercss      => undef,
371
        opacusercss            => undef,
372
        opacuserjs       => undef,
372
        opacuserjs             => undef,
373
        library_color    => undef
373
        ui_staff_customization => undef
374
    };
374
    };
375
}
375
}
376
376
(-)a/Koha/Schema/Result/Branch.pm (-3 / +3 lines)
Lines 206-214 branch specific javascript for the OPAC Link Here
206
206
207
branch specific css for the OPAC
207
branch specific css for the OPAC
208
208
209
=head2 library_color
209
=head2 ui_staff_customization
210
210
211
  data_type: 'varchar'
211
  data_type: 'longtext'
212
  is_nullable: 1
212
  is_nullable: 1
213
  size: 16
213
  size: 16
214
214
Lines 267-273 __PACKAGE__->add_columns( Link Here
267
  { data_type => "longtext", is_nullable => 1 },
267
  { data_type => "longtext", is_nullable => 1 },
268
  "opacusercss",
268
  "opacusercss",
269
  { data_type => "longtext", is_nullable => 1 },
269
  { data_type => "longtext", is_nullable => 1 },
270
  "library_color",
270
  "ui_staff_customization",
271
  { data_type => "varchar", is_nullable => 1, size => 16 },
271
  { data_type => "varchar", is_nullable => 1, size => 16 },
272
);
272
);
273
273
(-)a/admin/branches.pl (-1 / +1 lines)
Lines 98-104 if ( $op eq 'add_form' ) { Link Here
98
        public
98
        public
99
        opacuserjs
99
        opacuserjs
100
        opacusercss
100
        opacusercss
101
        library_color
101
        ui_staff_customization
102
    );
102
    );
103
    my $is_a_modif = $input->param('is_a_modif');
103
    my $is_a_modif = $input->param('is_a_modif');
104
104
(-)a/api/v1/swagger/definitions/library.yaml (-1 / +1 lines)
Lines 97-103 properties: Link Here
97
      - "null"
97
      - "null"
98
    description: geolocation of your library
98
    description: geolocation of your library
99
    maxLength: 255
99
    maxLength: 255
100
  library_color:
100
  ui_staff_customization:
101
    type:
101
    type:
102
      - string
102
      - string
103
      - "null"
103
      - "null"
(-)a/installer/data/mysql/atomicupdate/bug_37054_add_branchcolor.pl (-4 / +4 lines)
Lines 3-22 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.library_color",
6
    description => "Add branches.ui_staff_customization",
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', 'library_color' ) ) {
11
        if ( !column_exists( 'branches', 'ui_staff_customization' ) ) {
12
            $dbh->do(
12
            $dbh->do(
13
                q{
13
                q{
14
                ALTER TABLE branches
14
                ALTER TABLE branches
15
                ADD COLUMN `library_color` varchar(16) DEFAULT 0 COMMENT 'defines the branch color'
15
                ADD COLUMN `ui_staff_customization` LONGTEXT DEFAULT 0 COMMENT 'defines the branch color'
16
                AFTER `opacusercss`
16
                AFTER `opacusercss`
17
            }
17
            }
18
            );
18
            );
19
        }
19
        }
20
        say $out "Added column 'branch.library_color'";
20
        say $out "Added column 'branch.ui_staff_customization'";
21
    },
21
    },
22
};
22
};
(-)a/installer/data/mysql/kohastructure.sql (-1 / +1 lines)
Lines 1678-1684 CREATE TABLE `branches` ( Link Here
1678
  `public` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'whether this library should show in the opac',
1678
  `public` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'whether this library should show in the opac',
1679
  `opacuserjs` longtext DEFAULT NULL COMMENT 'branch specific javascript for the OPAC',
1679
  `opacuserjs` longtext DEFAULT NULL COMMENT 'branch specific javascript for the OPAC',
1680
  `opacusercss` longtext DEFAULT NULL COMMENT 'branch specific css for the OPAC',
1680
  `opacusercss` longtext DEFAULT NULL COMMENT 'branch specific css for the OPAC',
1681
  `library_color` varchar(16) DEFAULT NULL COMMENT 'library specific color',
1681
  `ui_staff_customization` longtext DEFAULT NULL COMMENT 'branch specific UI customizations',
1682
  PRIMARY KEY (`branchcode`)
1682
  PRIMARY KEY (`branchcode`)
1683
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1683
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1684
/*!40101 SET character_set_client = @saved_cs_client */;
1684
/*!40101 SET character_set_client = @saved_cs_client */;
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-open.inc (-3 / +4 lines)
Lines 3-8 Link Here
3
3
4
[% USE Koha %]
4
[% USE Koha %]
5
[% USE raw %]
5
[% USE raw %]
6
[% USE Branches %]
6
[% USE Dumper( Indent=1, SortKeys=1 ) %]
7
[% USE Dumper( Indent=1, SortKeys=1 ) %]
7
8
8
[% IF Koha.Preference('DumpSearchQueryTemplate') %]
9
[% IF Koha.Preference('DumpSearchQueryTemplate') %]
Lines 33-43 Link Here
33
34
34
[% IF ( bidi ) %]<html lang="[% lang | html %]" dir="[% bidi | html %]">[% ELSE %]<html lang="[% lang | html %]">[% END %]
35
[% IF ( bidi ) %]<html lang="[% lang | html %]" dir="[% bidi | html %]">[% ELSE %]<html lang="[% lang | html %]">[% END %]
35
<head>
36
<head>
36
[% SET library_color = Branches.GetLoggedInBranch.library_color %]
37
[% SET ui_staff_customization = Branches.GetLoggedInBranch.ui_staff_customization %]
37
[% IF library_color %]
38
[% IF ui_staff_customization %]
38
    <style>
39
    <style>
39
        :root {
40
        :root {
40
            --library-color: [% library_color %]
41
            --library-color: [% ui_staff_customization | html %]
41
        }
42
        }
42
    </style>
43
    </style>
43
[% END %]
44
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt (-7 / +6 lines)
Lines 512-519 Link Here
512
                        <label for="colorpicker">Primary branch color: </label>
512
                        <label for="colorpicker">Primary branch color: </label>
513
                    </div>
513
                    </div>
514
                    <div class="fg-input">
514
                    <div class="fg-input">
515
                        <input type="color" name="colorpicker" id="colorpicker" value="[% library.library_color | html %]" />
515
                        <input type="color" name="colorpicker" id="colorpicker" value="[% library.ui_staff_customization | html %]" />
516
                        <input type="text" name="library_color" id="library_color" readonly="readonly" size="10" maxlength="16" value="[% library.library_color | html %]" />
516
                        <input type="text" name="ui_staff_customization" id="ui_staff_customization" readonly="readonly" size="10" maxlength="16" value="[% library.ui_staff_customization | html %]" />
517
                        <a href="#" class="clear_color"><i class="fa fa-fw fa-trash-can"></i> Clear</a>
517
                        <a href="#" class="clear_color"><i class="fa fa-fw fa-trash-can"></i> Clear</a>
518
                    </div>
518
                    </div>
519
                </div>
519
                </div>
Lines 759-765 Link Here
759
                        </li>
759
                        </li>
760
                        <li>
760
                        <li>
761
                            <span class="label">Library color</span>
761
                            <span class="label">Library color</span>
762
                            [% library.library_color | html %]
762
                            [% library.ui_staff_customization | html %]
763
                        </li>
763
                        </li>
764
                    </ol>
764
                    </ol>
765
                </div>
765
                </div>
Lines 1033-1045 Link Here
1033
            $( "#" + target ).hide();
1033
            $( "#" + target ).hide();
1034
        });
1034
        });
1035
        $("#colorpicker").on("change", function(){
1035
        $("#colorpicker").on("change", function(){
1036
            let library_color = this.value;
1036
            let ui_staff_customization = this.value;
1037
            $("#library_color").val( library_color );
1037
            $("#ui_staff_customization").val( ui_staff_customization );
1038
        });
1038
        });
1039
1039
1040
        $(".clear_color").on("click", function(e){
1040
        $(".clear_color").on("click", function(e){
1041
            e.preventDefault();
1041
            e.preventDefault();
1042
            $("#library_color, #colorpicker").val( "" );
1042
            $("#ui_staff_customization, #colorpicker").val( "" );
1043
        });
1043
        });
1044
    </script>
1044
    </script>
1045
[% END %]
1045
[% END %]
1046
- 

Return to bug 37054