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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/add-modify.tt (-26 / +12 lines)
Lines 1-43 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Patron lists &rsaquo; New list</title>
2
<title>Koha &rsaquo; Patron lists &rsaquo; [% IF ( list.name ) %] Edit patron list [% ELSE %] New patron list [% END %]</title>
3
[% INCLUDE 'doc-head-close.inc' %]
3
[% INCLUDE 'doc-head-close.inc' %]
4
4
5
<script type="text/javascript">
6
//<![CDATA[
7
5
8
function CheckForm() {
9
  if ( !$("#list-name").val() ) {
10
    alert( _("Name is a required field!")  );
11
    return false;
12
  }
13
14
  return true;
15
}
16
17
//]]>
18
</script>
19
6
20
</head>
7
</head>
21
8
22
<body>
9
<body>
23
[% INCLUDE 'header.inc' %]
10
[% INCLUDE 'header.inc' %]
24
[% INCLUDE 'cat-search.inc' %]
11
[% INCLUDE 'cat-search.inc' %]
25
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="lists.pl">Patron lists</a> &rsaquo; Add / modify list</div>
12
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="lists.pl">Patron lists</a> &rsaquo; [% IF ( list.name ) %] Edit patron list [% ELSE %] New patron list [% END %]</div>
26
13
27
14
28
<div class="yui-t7">
15
<div class="yui-t7">
29
    <div class="yui-main">
16
    <div class="yui-main">
30
        <h1>New patron list</h1>
31
17
32
        <form method="post" onsubmit="return CheckForm()">
18
        <form method="post" action="/cgi-bin/koha/patron_lists/add-modify.pl">
33
            <fieldset class="rows">
19
            <fieldset class="rows">
34
20
                <legend>[% IF ( list.name ) %] Edit patron list [% ELSE %] New patron list [% END %]</legend>
35
                <legend>Create a new patron list</legend>
36
37
                <ol>
21
                <ol>
38
                    <li>
22
                    <li>
39
                        <label class="required" for="name">Name:</label>
23
                        <label class="required" for="list-name">Name:</label>
40
                        <input id="list-name" name="name" type="text" value="[% list.name %]" />
24
                        <input id="list-name" required="required" class="required" name="name" type="text" value="[% list.name %]" /> <span class="required">Required</span>
41
                    </li>
25
                    </li>
42
26
43
                    <li>
27
                    <li>
Lines 47-56 function CheckForm() { Link Here
47
31
48
            </fieldset>
32
            </fieldset>
49
33
50
            <input type="hidden" name="patron_list_id" value="[% list.patron_list_id %]" />
34
            <fieldset class="action">
51
            <input type="submit" class="btn" value="Save" />
35
                <input type="hidden" name="patron_list_id" value="[% list.patron_list_id %]" />
52
            <a href="lists.pl" class="cancel">Cancel</a>
36
                <input type="submit" value="Save" />
37
                <a href="lists.pl" class="cancel">Cancel</a>
38
            </fieldset>
53
        </form>
39
        </form>
54
    </div>
40
    </div>
55
</div>
41
56
[% INCLUDE 'intranet-bottom.inc' %]
42
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/list.tt (-66 / +102 lines)
Lines 1-25 Link Here
1
[% USE KohaDates %]
1
[% USE KohaDates %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Patron lists &rsaquo; New list</title>
3
<title>Koha &rsaquo; Patron lists &rsaquo; [% list.name %]</title>
4
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
5
5
6
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
6
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
7
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
7
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
8
[% INCLUDE 'datatables-strings.inc' %]
8
[% INCLUDE 'datatables-strings.inc' %]
9
<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
9
<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
10
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
10
11
11
<script type="text/javascript">
12
<script type="text/javascript">
12
//<![CDATA[
13
//<![CDATA[
13
$(document).ready(function() {
14
$(document).ready(function() {
14
    $('#patrons_to_add_fieldset').hide();
15
    $('#patrons_to_add_fieldset').hide();
15
16
16
    $('#patron-list-table').dataTable($.extend(true, {}, dataTablesDefaults));
17
    $('#patron-list-table').dataTable($.extend(true, {}, dataTablesDefaults, {
17
18
        "aaSorting": [[ 1, "asc" ]],
19
        "aoColumnDefs": [
20
            { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
21
        ],
22
        "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]]
23
    }));
18
    $( "#find_patron" ).autocomplete({
24
    $( "#find_patron" ).autocomplete({
19
        source: "/cgi-bin/koha/circ/ysearch.pl",
25
        source: "/cgi-bin/koha/circ/ysearch.pl",
20
        minLength: 3,
26
        minLength: 3,
21
        select: function( event, ui ) {
27
        select: function( event, ui ) {
22
            AddPatron( ui.item.firstname + " " + ui.item.surname, ui.item.cardnumber );
28
            AddPatron( ui.item.surname + ", " + ui.item.firstname, ui.item.cardnumber );
23
            return false;
29
            return false;
24
        }
30
        }
25
    })
31
    })
Lines 29-51 $(document).ready(function() { Link Here
29
        .append( "<a>" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") <small>" + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" )
35
        .append( "<a>" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") <small>" + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" )
30
        .appendTo( ul );
36
        .appendTo( ul );
31
    };
37
    };
38
    $("span.clearall").html("<a id=\"CheckNone\" href=\"#\">"+_("Clear all")+"<\/a>");
39
    $("span.checkall").html("<a id=\"CheckAll\" href=\"#\">"+_("Select all")+"<\/a>");
40
    $("#CheckAll").click(function(){
41
        $(".checkboxed").checkCheckboxes();
42
        return false;
43
    });
44
    $("#CheckNone").click(function(){
45
        $(".checkboxed").unCheckCheckboxes();
46
        return false;
47
    });
48
    $("#patrons_to_add_fieldset").on("click", ".remove_patron", function(event) {
49
        console.log(event.target.nodeName);
50
        $(event.target).parent().remove();
51
        if ( ! $('#patrons_to_add').html() ) {
52
            $('#patrons_to_add_fieldset').hide(  );
53
        }
54
    });
32
});
55
});
33
56
34
function AddPatron( name, cardnumber ) {
57
function AddPatron( name, cardnumber ) {
35
    div = "<div id='borrower_" + cardnumber + "'>" + name + " ( <a href='javascript:void()' onclick='RemovePatron(" + cardnumber + ");'> Remove </a> ) <input type='hidden' name='patrons_to_add' value='" + cardnumber + "' /></div>";
58
    div = "<p>" + name + " ( <a href=\"#\" class=\"remove_patron\"> " + _("Remove") + " </a> ) <input type='hidden' name='patrons_to_add' value='" + cardnumber + "' /></p>";
36
    $('#patrons_to_add').append( div );
59
    $('#patrons_to_add').append( div );
37
60
38
    $('#find_patron').val('').focus();
61
    $('#find_patron').val('').focus();
39
62
40
    $('#patrons_to_add_fieldset').show( 800 );
63
    $('#patrons_to_add_fieldset').show(  );
41
}
42
43
function RemovePatron( cardnumber ) {
44
    $( '#borrower_' + cardnumber ).remove();
45
46
    if ( ! $('#patrons_to_add').html() ) {
47
        $('#patrons_to_add_fieldset').hide( 800 );
48
    }
49
}
64
}
50
//]]>
65
//]]>
51
</script>
66
</script>
Lines 55-67 function RemovePatron( cardnumber ) { Link Here
55
<body>
70
<body>
56
[% INCLUDE 'header.inc' %]
71
[% INCLUDE 'header.inc' %]
57
[% INCLUDE 'cat-search.inc' %]
72
[% INCLUDE 'cat-search.inc' %]
58
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="lists.pl">Patron lists</a> &rsaquo; Add patrons</div>
73
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="lists.pl">Patron lists</a> &rsaquo; [% list.name %]</div>
59
74
60
<div class="yui-t7">
75
<div class="yui-t7">
61
    <div class="yui-main">
76
    <div class="yui-main">
62
        <h1>[% list.name %]</h1>
77
        <h1>[% list.name %]</h1>
63
78
64
        <form action="list.pl" method="post">
79
        <div id="toolbar" class="btn-toolbar">
80
            <div class="btn-group">
81
                <a class="btn btn-small" href="/cgi-bin/koha/patron_lists/add-modify.pl?patron_list_id=[% list.id %]"><i class="icon-pencil"></i> Edit list</a>
82
            </div>
83
            <div class="btn-group">
84
                <a href="/cgi-bin/koha/tools/modborrowers.pl?patron_list_id=[% list.id %]&amp;op=show" class="btn btn-small">Batch modify</a>
85
            </div>
86
        </div>
87
88
        <form action="list.pl" method="post" class="checkboxed">
89
            <input type="hidden" name="patron_list_id" value="[% list.patron_list_id %]" />
65
            <fieldset>
90
            <fieldset>
66
                <legend>Add patrons</legend>
91
                <legend>Add patrons</legend>
67
92
Lines 72-132 function RemovePatron( cardnumber ) { Link Here
72
                <fieldset id="patrons_to_add_fieldset">
97
                <fieldset id="patrons_to_add_fieldset">
73
                    <legend>Patrons to be added</legend>
98
                    <legend>Patrons to be added</legend>
74
                    <div id="patrons_to_add"></div>
99
                    <div id="patrons_to_add"></div>
100
                    <fieldset class="action">
101
                        <input type="submit" value="Add patrons" />
102
                        <a href="lists.pl" class="cancel">Cancel</a>
103
                    </fieldset>
75
                </fieldset>
104
                </fieldset>
76
77
            </fieldset>
105
            </fieldset>
78
106
79
            <p>
107
            [% UNLESS ( list.patron_list_patrons ) %]
80
                <input type="submit" class="btn" value="Update" />
108
                <div class="dialog message">
81
                <a href="lists.pl" class="cancel">Cancel</a>
109
                    <p>There are no patrons on this list.</p>
82
            </p>
110
                </div>
83
111
            [% ELSE %]
84
            <table id="patron-list-table">
112
                <div id="searchheader">
85
                <thead>
113
                    <div id="selection_ops">
86
                    <tr>
114
                        <span class="checkall"></span> |
87
                        <th><i title="Remove patron from list" class="icon-trash"></i></th>
115
                        <span class="clearall"></span>
88
                        <th>Card</th>
116
                        <div class="btn-group">
89
                        <th>Firstname</th>
117
                            <button type="submit" class="btn btn-mini list-remove"><i class="icon-remove-sign"></i> Remove selected</button>
90
                        <th>Surname</th>
118
                        </div>
91
                        <th>Address</th>
119
                    </div>
92
                        <th>Category</th>
120
                </div>
93
                        <th>Library</th>
121
94
                        <th>Expires on</th>
122
                <table id="patron-list-table">
95
                        <th>Circ notes</th>
123
                    <thead>
96
                    </tr>
97
                </thead>
98
99
                <tbody>
100
                    [% FOREACH p IN list.patron_list_patrons %]
101
                        <tr>
124
                        <tr>
102
                            <td><input type="checkbox" name="patrons_to_remove" value="[% p.patron_list_patron_id %]" /></td>
125
                            <th>&nbsp;</th>
103
                            <td>
126
                            <th>Card</th>
104
                                <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% p.borrowernumber.borrowernumber %]">
127
                            <th>Last name</th>
105
                                    [% p.borrowernumber.cardnumber %]
128
                            <th>First name</th>
106
                                </a>
129
                            <th>Address</th>
107
                            </td>
130
                            <th>Category</th>
108
                            <td>[% p.borrowernumber.firstname %]</td>
131
                            <th>Library</th>
109
                            <td>[% p.borrowernumber.surname %]</td>
132
                            <th>Expires on</th>
110
                            <td>
133
                            <th>Circ notes</th>
111
                                [% p.borrowernumber.address %]
112
                                [% p.borrowernumber.address2 %]
113
                                [% p.borrowernumber.city %]
114
                                [% p.borrowernumber.state %]
115
                                [% p.borrowernumber.country %]
116
                            </td>
117
                            <td>[% p.borrowernumber.categorycode.description %] ([% p.borrowernumber.categorycode.categorycode %])</td>
118
                            <td>[% p.borrowernumber.branchcode.branchname %]</td>
119
                            <td>[% p.borrowernumber.dateexpiry | $KohaDates %]</td>
120
                            <td>[% p.borrowernumber.borrowernotes %]</td>
121
                        </tr>
134
                        </tr>
122
                    [% END %]
135
                    </thead>
123
                </tbody>
136
124
            </table>
137
                    <tbody>
125
138
                        [% FOREACH p IN list.patron_list_patrons %]
126
            <input type="hidden" name="patron_list_id" value="[% list.patron_list_id %]" />
139
                            <tr>
127
            <input type="submit" class="btn" value="Update" />
140
                                <td><input type="checkbox" name="patrons_to_remove" value="[% p.patron_list_patron_id %]" /></td>
128
            <a href="lists.pl" class="cancel">Cancel</a>
141
                                <td>
142
                                    <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% p.borrowernumber.borrowernumber %]">
143
                                        [% p.borrowernumber.cardnumber %]
144
                                    </a>
145
                                </td>
146
                                <td>[% p.borrowernumber.surname %]</td>
147
                                <td>[% p.borrowernumber.firstname %]</td>
148
                                <td>
149
                                    [% p.borrowernumber.address %]
150
                                    [% p.borrowernumber.address2 %]
151
                                    [% p.borrowernumber.city %]
152
                                    [% p.borrowernumber.state %]
153
                                    [% p.borrowernumber.zipcode %]
154
                                    [% p.borrowernumber.country %]
155
                                </td>
156
                                <td>[% p.borrowernumber.categorycode.description %] ([% p.borrowernumber.categorycode.categorycode %])</td>
157
                                <td>[% p.borrowernumber.branchcode.branchname %]</td>
158
                                <td>[% p.borrowernumber.dateexpiry | $KohaDates %]</td>
159
                                <td>[% p.borrowernumber.borrowernotes %]</td>
160
                            </tr>
161
                        [% END %]
162
                    </tbody>
163
                </table>
164
            [% END %]
129
        </form>
165
        </form>
130
    </div>
166
    </div>
131
</div>
167
132
[% INCLUDE 'intranet-bottom.inc' %]
168
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/lists.tt (-38 / +51 lines)
Lines 10-16 Link Here
10
<script type="text/javascript">
10
<script type="text/javascript">
11
//<![CDATA[
11
//<![CDATA[
12
    $(document).ready(function() {
12
    $(document).ready(function() {
13
        $('#patron-lists-table').dataTable($.extend(true, {}, dataTablesDefaults));
13
            $('#patron-lists-table').dataTable($.extend(true, {}, dataTablesDefaults, {
14
            "aoColumnDefs": [
15
                { "aTargets": [ -1, -2, -3 ], "bSortable": false, "bSearchable": false },
16
            ],
17
18
            "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]]
19
        }));
14
    });
20
    });
15
21
16
    function ConfirmDelete( list ) {
22
    function ConfirmDelete( list ) {
Lines 29-74 Link Here
29
<div class="yui-t7">
35
<div class="yui-t7">
30
    <div class="yui-main">
36
    <div class="yui-main">
31
        <h1>Your patron lists</h1>
37
        <h1>Your patron lists</h1>
32
38
        <div id="toolbar" class="btn-toolbar">
33
        <div class="btn-group">
39
            <div class="btn-group">
34
            <a class="btn btn-small" href="add-modify.pl"><i class="icon-plus"></i> New patron list</a>
40
                <a class="btn btn-small" href="add-modify.pl"><i class="icon-plus"></i> New patron list</a>
41
            </div>
35
        </div>
42
        </div>
36
43
37
        <table id="patron-lists-table">
44
        [% UNLESS ( lists ) %]
38
            <thead>
45
            <div class="dialog message">
39
                <tr>
46
                <p>There are no patron lists.</p>
40
                    <th>Name</th>
47
            </div>
41
                    <th>Patrons in list</th>
48
        [% ELSE %]
42
                    <th>&nbsp;</th>
49
            <table id="patron-lists-table">
43
                    <th>&nbsp;</th>
50
                <thead>
44
                    <th>&nbsp;</th>
45
                </tr>
46
            </thead>
47
48
            <tbody>
49
                [% FOREACH l IN lists %]
50
                    <tr>
51
                    <tr>
51
                        <td>[% l.name %]</td>
52
                        <th>Name</th>
52
                        <td>[% l.patron_list_patrons.size || 0 %]</td>
53
                        <th>Patrons in list</th>
53
                        <td>
54
                        <th>&nbsp;</th>
54
                            <a class="btn" href="list.pl?patron_list_id=[% l.patron_list_id %]">
55
                        <th>&nbsp;</th>
55
                                <i class="icon-plus-sign"></i> Add patrons <i class="icon-user"></i>
56
                        <th>&nbsp;</th>
56
                            </a>
57
                        </td>
58
                        <td>
59
                            <a class="btn" href="add-modify.pl?patron_list_id=[% l.patron_list_id %]">
60
                                <i class="icon-edit"></i> Edit
61
                            </a>
62
                        </td>
63
                        <td>
64
                            <a class="btn" href="delete.pl?patron_list_id=[% l.patron_list_id %]" onclick='return ConfirmDelete("[% l.name | html %]")'>
65
                                <i class="icon-trash"></i> Delete
66
                            </a>
67
                        </td>
68
                    </tr>
57
                    </tr>
69
                [% END %]
58
                </thead>
70
            </tbody>
59
71
        </table>
60
                <tbody>
61
                    [% FOREACH l IN lists %]
62
                        <tr>
63
                            <td><a href="list.pl?patron_list_id=[% l.patron_list_id %]">[% l.name %]</a></td>
64
                            <td>[% l.patron_list_patrons.size || 0 %]</td>
65
                            <td>
66
                                <a class="btn btn-mini" href="list.pl?patron_list_id=[% l.patron_list_id %]">
67
                                    <i class="icon-plus-sign"></i> Add patrons
68
                                </a>
69
                            </td>
70
                            <td>
71
                                <a class="btn btn-mini" href="add-modify.pl?patron_list_id=[% l.patron_list_id %]">
72
                                    <i class="icon-edit"></i> Edit
73
                                </a>
74
                            </td>
75
                            <td>
76
                                <a class="btn btn-mini" href="delete.pl?patron_list_id=[% l.patron_list_id %]" onclick='return ConfirmDelete("[% l.name | html %]")'>
77
                                    <i class="icon-trash"></i> Delete
78
                                </a>
79
                            </td>
80
                        </tr>
81
                    [% END %]
82
                </tbody>
83
            </table>
84
        [% END %]
72
    </div>
85
    </div>
73
</div>
86
74
[% INCLUDE 'intranet-bottom.inc' %]
87
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/patron_lists/add-modify.pl (-1 / +2 lines)
Lines 32-38 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
32
        template_name   => "patron_lists/add-modify.tt",
32
        template_name   => "patron_lists/add-modify.tt",
33
        query           => $cgi,
33
        query           => $cgi,
34
        type            => "intranet",
34
        type            => "intranet",
35
        authnotrequired => 1,
35
        authnotrequired => 0,
36
        flagsrequired => {borrowers => 1},
36
    }
37
    }
37
);
38
);
38
39
(-)a/patron_lists/delete.pl (-1 / +2 lines)
Lines 32-38 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
32
        template_name   => "patron_lists/lists.tt",
32
        template_name   => "patron_lists/lists.tt",
33
        query           => $cgi,
33
        query           => $cgi,
34
        type            => "intranet",
34
        type            => "intranet",
35
        authnotrequired => 1,
35
        authnotrequired => 0,
36
        flagsrequired => {borrowers => 1},
36
    }
37
    }
37
);
38
);
38
39
(-)a/patron_lists/list.pl (-1 / +2 lines)
Lines 32-38 my ( $template, $logged_in_user, $cookie ) = get_template_and_user( Link Here
32
        template_name   => "patron_lists/list.tt",
32
        template_name   => "patron_lists/list.tt",
33
        query           => $cgi,
33
        query           => $cgi,
34
        type            => "intranet",
34
        type            => "intranet",
35
        authnotrequired => 1,
35
        authnotrequired => 0,
36
        flagsrequired => {borrowers => 1},
36
    }
37
    }
37
);
38
);
38
39
(-)a/patron_lists/lists.pl (-2 / +2 lines)
Lines 32-38 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
32
        template_name   => "patron_lists/lists.tt",
32
        template_name   => "patron_lists/lists.tt",
33
        query           => $cgi,
33
        query           => $cgi,
34
        type            => "intranet",
34
        type            => "intranet",
35
        authnotrequired => 1,
35
        authnotrequired => 0,
36
        flagsrequired => {borrowers => 1},
36
    }
37
    }
37
);
38
);
38
39
39
- 

Return to bug 10565