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

(-)a/Koha/Template/Plugin/Desks.pm (+6 lines)
Lines 87-90 sub ListForLibrary { Link Here
87
    );
87
    );
88
}
88
}
89
89
90
sub all {
91
92
    my ( $self ) = @_;
93
    return Koha::Desks->search( )->unblessed;
94
}
95
90
1;
96
1;
(-)a/circ/set-library.pl (-1 / +21 lines)
Lines 26-31 use C4::Auth qw/:DEFAULT get_session/; Link Here
26
use C4::Koha;
26
use C4::Koha;
27
use Koha::BiblioFrameworks;
27
use Koha::BiblioFrameworks;
28
use Koha::Libraries;
28
use Koha::Libraries;
29
use Koha::Desks;
29
30
30
my $query = CGI->new();
31
my $query = CGI->new();
31
32
Lines 42-48 my $sessionID = $query->cookie("CGISESSID"); Link Here
42
my $session = get_session($sessionID);
43
my $session = get_session($sessionID);
43
44
44
my $branch   = $query->param('branch' );
45
my $branch   = $query->param('branch' );
46
my $desk_id = $query->param('desk_id');
45
my $userenv_branch  = C4::Context->userenv->{'branch'}        || '';
47
my $userenv_branch  = C4::Context->userenv->{'branch'}        || '';
48
my $userenv_desk = C4::Context->userenv->{'desk_id'} || '';
46
my @updated;
49
my @updated;
47
50
48
# $session lddines here are doing the updating
51
# $session lddines here are doing the updating
Lines 56-66 if ( $branch and my $library = Koha::Libraries->find($branch) ) { Link Here
56
        $session->flush();
59
        $session->flush();
57
        push @updated, {
60
        push @updated, {
58
            updated_branch => 1,
61
            updated_branch => 1,
59
                old_branch => $userenv_branch,
62
            old_branch => $userenv_branch,
60
        };
63
        };
61
    } # else branch the same, no update
64
    } # else branch the same, no update
65
    if ( !$userenv_desk or $userenv_desk ne $desk_id ) {
66
        my $desk = Koha::Desks->find( { desk_id => $desk_id } );
67
        my $old_desk_name = '';
68
        if ($userenv_desk) {
69
            $old_desk_name = Koha::Desks->find( { desk_id => $userenv_desk })->desk_name;
70
        }
71
        $template->param( LoginDeskname => $desk->desk_name );
72
        $template->param( LoginDeskid => $desk->desk_id );
73
        $session->param( desk_name => $desk->desk_name );
74
        $session->param( desk_id => $desk->desk_id );
75
        push @updated, {
76
            updated_desk => 1,
77
            old_desk => $old_desk_name,
78
        };
79
    }
62
} else {
80
} else {
63
    $branch = $userenv_branch;  # fallback value
81
    $branch = $userenv_branch;  # fallback value
82
    $desk_id = $userenv_desk;
64
}
83
}
65
84
66
$template->param(updated => \@updated) if (scalar @updated);
85
$template->param(updated => \@updated) if (scalar @updated);
Lines 87-92 if (scalar @updated and not scalar @recycle_loop) { Link Here
87
$template->param(
106
$template->param(
88
    referer     => $referer,
107
    referer     => $referer,
89
    branch      => $branch,
108
    branch      => $branch,
109
    desk_id     => $desk_id,
90
    recycle_loop=> \@recycle_loop,
110
    recycle_loop=> \@recycle_loop,
91
);
111
);
92
112
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc (+10 lines)
Lines 8-13 Link Here
8
    [% END %]
8
    [% END %]
9
[% END %]
9
[% END %]
10
10
11
[% BLOCK options_for_desks %]
12
        [% FOREACH d IN desks %]
13
            [% IF d.branchcode == branch %]
14
                <option class="[% d.branchcode | html %]" value="[% d.desk_id | html %]" >[% d.desk_name | html %]</option>
15
            [% ELSE %]
16
                <option class="[% d.branchcode | html %]" value="[% d.desk_id | html %]" disabled hidden>[% d.desk_name | html %]</option>
17
            [% END%]
18
        [% END %]
19
    [% END %]
20
11
[% BLOCK options_for_authorised_value_categories %]
21
[% BLOCK options_for_authorised_value_categories %]
12
    [% FOREACH avc IN authorised_value_categories %]
22
    [% FOREACH avc IN authorised_value_categories %]
13
        [% IF avc.selected %]
23
        [% IF avc.selected %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc (+1 lines)
Lines 73-77 Link Here
73
        [% jsinclude | $raw # Parse the page template's JavaScript block if necessary %]
73
        [% jsinclude | $raw # Parse the page template's JavaScript block if necessary %]
74
    [% END %]
74
    [% END %]
75
[% KohaPlugins.get_plugins_intranet_js | $raw %]
75
[% KohaPlugins.get_plugins_intranet_js | $raw %]
76
76
</body>
77
</body>
77
</html>
78
</html>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc (+4 lines)
Lines 26-31 Link Here
26
<!-- koha core js -->
26
<!-- koha core js -->
27
[% Asset.js("js/staff-global.js") | $raw %]
27
[% Asset.js("js/staff-global.js") | $raw %]
28
[% Asset.js("js/commons.js") | $raw %]
28
[% Asset.js("js/commons.js") | $raw %]
29
[% IF setdesk %]
30
[% Asset.js("js/desk_selection.js") | $raw %]
31
[% END %]
29
32
30
[% INCLUDE 'validator-strings.inc' %]
33
[% INCLUDE 'validator-strings.inc' %]
31
[% IF ( IntranetUserJS ) %]
34
[% IF ( IntranetUserJS ) %]
Lines 146-148 Link Here
146
    </script>
149
    </script>
147
[% END %]
150
[% END %]
148
<!-- / js_includes.inc -->
151
<!-- / js_includes.inc -->
152
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt (+16 lines)
Lines 1-8 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE Koha %]
2
[% USE Koha %]
3
[% USE Branches %]
3
[% USE Branches %]
4
[% USE Desks %]
4
[% USE Categories %]
5
[% USE Categories %]
5
[% SET footerjs = 1 %]
6
[% SET footerjs = 1 %]
7
[% IF Desks.all %]
8
    [% SET setdesk = 1 %]
9
[% END %]
6
[% INCLUDE 'doc-head-open.inc' %]
10
[% INCLUDE 'doc-head-open.inc' %]
7
<title>Koha &rsaquo; 
11
<title>Koha &rsaquo; 
8
    [% IF ( nopermission ) %]Access denied[% END %]
12
    [% IF ( nopermission ) %]Access denied[% END %]
Lines 81-86 Link Here
81
            [% END %]
85
            [% END %]
82
        </select>
86
        </select>
83
    </p>
87
    </p>
88
    [% IF Desks.all %]
89
        <p>
90
            <label for="desk">Desk:</label>
91
            <select name="desk_id" id="desk_id" class="input" tabindex="3">
92
                <option value="">My desk</option>
93
                    [% FOREACH d IN Desks.all %]
94
                    <option class="[% d.branchcode | html %]" value="[% d.desk_id | html %]" disabled >[% d.desk_name | html %]</option>
95
                    [% END %]
96
            </select>
97
        </p>
98
</fieldset>
99
[% END %]
84
[% END %]
100
[% END %]
85
101
86
<!-- <p><label><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="3" />Remember me</label></p> -->
102
<!-- <p><label><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="3" />Remember me</label></p> -->
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/set-library.tt (-2 / +18 lines)
Lines 1-5 Link Here
1
[% USE Branches %]
1
[% USE Branches %]
2
[% USE Desks %]
2
[% USE Koha %]
3
[% USE Koha %]
4
[% IF Desks.all %]
5
    [% SET setdesk = 1 %]
6
[% END %]
3
[% INCLUDE 'doc-head-open.inc' %]
7
[% INCLUDE 'doc-head-open.inc' %]
4
<title>Koha &rsaquo; Circulation &rsaquo; Set library</title>
8
<title>Koha &rsaquo; Circulation &rsaquo; Set library</title>
5
[% INCLUDE 'doc-head-close.inc' %]
9
[% INCLUDE 'doc-head-close.inc' %]
Lines 36-42 Link Here
36
Updated:<ul>
40
Updated:<ul>
37
    [% FOREACH update IN updated %]
41
    [% FOREACH update IN updated %]
38
    [% IF ( update.updated_branch ) %]
42
    [% IF ( update.updated_branch ) %]
39
        <li>Library: [% update.old_branch or "?" | html %] &rArr; [% update.LoginBranchcode or "?" | html %]</li>
43
        <li>Library: [% update.old_branch or "?" | html %] &rArr; [% LoginBranchcode or "?" | html %]</li>
44
    [% ELSIF (update.updated_desk) %]
45
        <li>Desk: [% update.old_desk or "?" | html %] &rArr; [% LoginDeskname or "?" | html %]</li>
40
    [% ELSE %]
46
    [% ELSE %]
41
        <li>ERROR - unknown</li>
47
        <li>ERROR - unknown</li>
42
    [% END %]
48
    [% END %]
Lines 63-73 Updated:<ul> Link Here
63
        <li><label for="branch">Choose library:</label>
69
        <li><label for="branch">Choose library:</label>
64
        <select name="branch" id="branch">
70
        <select name="branch" id="branch">
65
            [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
71
            [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
66
                        [% PROCESS options_for_yallah yallah => Branches.all( selected => branch ) %]
67
        </select></li>
72
        </select></li>
68
    [% END %]
73
    [% END %]
69
    </ol>
74
    </ol>
70
</fieldset>
75
</fieldset>
76
[% IF Desks.all %]
77
<fieldset class="rows">
78
    <legend>Set Desk</legend>
79
    <ol>
80
        <li><label for="desk">Choose Desk:</label>
81
        <select name="desk_id" id="desk_id">
82
            [% PROCESS options_for_desks desks => Desks.all( selected => desk_id ) %]
83
        </select></li>
84
    </ol>
85
</fieldset>
86
[% END %]
71
<fieldset class="action">
87
<fieldset class="action">
72
    <input type="submit" value="Submit" />
88
    <input type="submit" value="Submit" />
73
    <a class="cancel" id="cancel_set_library" href="[% referer or '/cgi-bin/koha/circ/circulation.pl' %]">Cancel</a>
89
    <a class="cancel" id="cancel_set_library" href="[% referer or '/cgi-bin/koha/circ/circulation.pl' %]">Cancel</a>
(-)a/koha-tmpl/intranet-tmpl/prog/js/desk_selection.js (-1 / +17 lines)
Line 0 Link Here
0
- 
1
<script>
2
$(document).ready(function() {
3
  $("#branch").on("change", function() {
4
    var selectedBranch = $("#branch"). children("option:selected"). val();
5
    $("#desk_id").children().each(function() {
6
      if ($(this).hasClass(selectedBranch)) {
7
          $(this).prop("disabled", false);
8
          $(this).hide(true);
9
          $(this).prop("selected", true)
10
      } else {
11
          $(this).prop("disabled", true);
12
          $(this).hide(false);
13
      }
14
    });
15
  });
16
}) ;
17
</script>

Return to bug 24201