Bug 15758: Koha::Libraries - Remove GetBranches
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / modborrowers.tt
index 618d056..bbf64f6 100644 (file)
@@ -1,28 +1,45 @@
+[% USE Koha %]
 [% USE KohaDates %]
+[% USE Branches %]
 [% INCLUDE 'doc-head-open.inc'%]
-<title>Koha &rsaquo; Tools &rsaquo; [% IF ( del ) %]Batch item deletion[% ELSE %]Batch item modification[% END %] </title>
+<title>Koha &rsaquo; Tools &rsaquo; Batch patron modification</title>
 [% INCLUDE 'doc-head-close.inc' %]
 [% INCLUDE 'calendar.inc' %]
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
-<script type="text/JavaScript" language="JavaScript">
+<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
+[% INCLUDE 'datatables.inc' %]
+<script type="text/javascript">
 //<![CDATA[
         var patron_attributes_lib = new Array();
         var patron_attributes_values = new Array();
         $(document).ready(function() {
-            $("#borrowerst").tablesorter();
-
-            $("#selectallbutton").click(function() {
-                $("#borrowerst").find("input:checkbox").each(function() {
-                    $(this).attr("checked", true);
+            [% IF borrowers %]
+                $("#borrowerst").dataTable($.extend(true, {}, dataTablesDefaults, {
+                    "sDom": 't',
+                    [% IF ( op == 'show_results' ) %]
+                        "aoColumnDefs": [
+                            { 'sType': "title-string", 'aTargets' : [ 'title-string'] }
+                        ],
+                    [% ELSE %]
+                        "aoColumnDefs": [
+                            { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
+                            { 'sType': "title-string", 'aTargets' : [ 'title-string'] }
+                        ],
+                    [% END %]
+                    "bPaginate": false
+                }));
+                $("#selectallbutton").click(function() {
+                    $("#borrowerst").find("input:checkbox").each(function() {
+                        $(this).prop("checked", true);
+                    });
+                    return false;
                 });
-                return false;
-            });
-            $("#clearallbutton").click(function() {
-                $("#borrowerst").find("input:checkbox").each(function() {
-                    $(this).attr("checked", false);
+                $("#clearallbutton").click(function() {
+                    $("#borrowerst").find("input:checkbox").each(function() {
+                        $(this).prop("checked", false);
+                    });
+                    return false;
                 });
-                return false;
-            });
+            [% END %]
 
             var values = new Array();
             var lib = new Array();
@@ -53,7 +70,7 @@
             var information_category_node = $(select_attr).parent().parent().find('span.information_category');
             information_category_node.html("");
             if ( category.length > 0 ) {
-                information_category_node.html('This attribute will be only applied to the borrower\'s category "' + category + '"');
+                information_category_node.html(_("This attribute will be only applied to the patron's category %s").format(category));
             }
             if ( type == 'select' ) {
                 var options = '<option value = ""></option>';
@@ -70,7 +87,7 @@
             var li_node = $("li.attributes:last");
             var li_clone = $(li_node).clone();
             if ( $(li_clone).find("a.delete").length == 0 ) {
-                $(li_clone).append('[<a href="#" title="Delete" class="delete" onclick="del_attributes(this);return false;">X</a>]');
+                $(li_clone).append('<a href="#" title="Delete" class="delete" onclick="del_attributes(this);return false;"><i class="fa fa-fw fa-trash"></i> Delete</a>');
             }
             $(li_clone).find('select[name="patron_attributes"]').change(function() {
                 updateAttrValues(this);
 //]]>
 </script>
 </head>
-<body>
+<body id="tools_modborrowers" class="tools">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'cat-search.inc' %]
 
 <div id="breadcrumbs">
     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
     <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo;
-    <a href="/cgi-bin/koha/tools/modborrowers.pl">Patrons modification</a>
+    <a href="/cgi-bin/koha/tools/modborrowers.pl">Batch patron modification</a>
 </div>
 
 <div id="doc3" class="yui-t2">
         <div id="yui-main">
             <div class="yui-b">
                 [% IF ( op == 'show_form' ) %]
-                <h1>Batch patrons modification</h1>
+                <h1>Batch patron modification</h1>
                 <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/modborrowers.pl">
                     <fieldset class="rows">
-                    <legend>Use a file</legend>
-                    <label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" />
+                        <legend>Use a file</legend>
+                        <ol>
+                            <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
+                        </ol>
+                    </fieldset>
+
+                    [% IF patron_lists %]
+                    <fieldset class="rows">
+                        <legend>Or use a patron list</legend>
+                        <ol>
+                            <li>
+                                <label for="patron_list_id">Patron list: </label>
+                                <select id="patron_list_id" name="patron_list_id">
+                                    <option value=""></option>
+                                    [% FOREACH pl IN patron_lists %]
+                                        <option value="[% pl.patron_list_id %]">[% pl.name %]</option>
+                                    [% END %]
+                                </select>
+                            </li>
+                        </ol>
                     </fieldset>
+                    [% END %]
+
                     <fieldset class="rows">
                         <legend>Or list cardnumbers one by one</legend>
                         <ol>
                             <li>
-                              <label for="cardnumberlist">Carnumber list (one cardnumber per line): </label>
+                              <label for="cardnumberlist">Carnumber list (one cardnumber per line): </label>
                               <textarea rows="10" cols="30" id="cardnumberlist" name="cardnumberlist">[% cardnumberlist %]</textarea>
                             </li>
                         </ol>
                 </form>
                 [% END %]
 
+                [% IF ( op == 'show') && (!borrowers) && (!notfoundcardnumbers) # Alert if no patrons given%]
+                    [% op = 'noshow' # Change op to prevent display in code below %]
+                    <h1>Batch patrons modification</h1>
+                    <div class="dialog alert">
+                        <p>No patron card numbers given.</p>
+                        <form action="/cgi-bin/koha/tools/modborrowers.pl" method="get">
+                         <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> OK</button>
+                        </form>
+                    </div>
+                [% END #Alert if no patrons %]
+
                 [% IF ( op == 'show' or op == 'show_results' ) %]
                     [% IF ( op == 'show' ) %]
                         <h1>Batch patrons modification</h1>
 
                     [% IF ( op == 'show_results' ) %]
                         [% IF ( errors ) %]
-                            Errors occured :
+                            <div class="dialog alert">
+                            <h4>Errors occurred:</h4>
                             <ul class="warnings">
                             [% FOREACH error IN errors %]
                                 [% IF ( error.error == 'can_not_update' ) %]
-                                    <li>Can not update borrower with borrowernumber [% error.borrowernumber %]</li>
+                                    <li>Can not update patron.
+                                    [% IF ( error.cardnumber ) %] Cardnumber:  [% error.cardnumber %] [% END %]
+                                    (Borrowernumber: [% error.borrowernumber %])
+                                    </li>
                                 [% ELSE %]
                                     <li>[% error.error %]</li>
                                 [% END %]
                             [% END %]
                             </ul>
+                            </div>
                         [% END %]
-                        <br/>
                     [% END %]
 
                     [% IF ( op == 'show' ) %]
                     <form name="f" action="modborrowers.pl" method="post">
                         <input type="hidden" name="op" value="do" />
                         [% IF ( borrowers ) %]
-                            <div id="toolbar"><a id="selectallbutton" href="#">Select All</a> | <a id="clearallbutton" href="#">Clear All</a></div>
+                            <div id="toolbar"><a id="selectallbutton" href="#"><i class="fa fa-check"></i> Select all</a> | <a id="clearallbutton" href="#"><i class="fa fa-remove"></i> Clear all</a></div>
                         [% END %]
                     [% END %]
+                        [% IF borrowers %]
                             <div id="cataloguing_additem_itemlist">
                                 <div style="overflow:auto">
                                     <table id="borrowerst">
                                                 [% IF ( op == 'show' ) %]
                                                     <th>&nbsp;</th>
                                                 [% END %]
+                                                <th>Card number</th>
                                                 <th>Surname</th>
-                                                <th>Firstname</th>
-                                                <th>Branchname</th>
-                                                <th>Categorycode</th>
-                                                <th>Cardnumber</th>
-                                                <th>dateenrolled</th>
-                                                <th>dateexpiry</th>
-                                                <th>debarred</th>
+                                                <th>First name</th>
+                                                <th>Library</th>
+                                                <th>Category</th>
+                                                <th>City</th>
+                                                <th>State</th>
+                                                <th>ZIP/Postal code</th>
+                                                <th>Country</th>
+                                                <th class="title-string">Registration date</th>
+                                                <th class="title-string">Expiry date</th>
+                                                <th>Circulation note</th>
+                                                <th>Opac Note</th>
                                                 [% FOREACH attrh IN attributes_header %]
                                                     <th>[% attrh.attribute %]</th>
                                                 [% END %]
                                                     [% IF ( op == 'show' ) %]
                                                         <td><input type="checkbox" name="borrowernumber" value="[% borrower.borrowernumber %]" checked="checked" /></td>
                                                     [% END %]
+                                                    <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrower.borrowernumber %]">[% borrower.cardnumber %]</a></td>
                                                     <td>[% borrower.surname %]</td>
                                                     <td>[% borrower.firstname %]</td>
-                                                    <td>[% borrower.branchname %]</td>
+                                                    <td>[% Branches.GetName( borrower.branchcode ) %]</td>
                                                     <td>[% borrower.categorycode %]</td>
-                                                    <td>[% borrower.cardnumber %]</td>
-                                                    <td>[% borrower.dateenrolled | $KohaDates %]</td>
-                                                    <td>[% borrower.dateexpiry | $KohaDates %]</td>
-                                                    <td>[% borrower.debarred | $KohaDates %]</td>
+                                                    <td>[% borrower.city %]</td>
+                                                    <td>[% borrower.state %]</td>
+                                                    <td>[% borrower.zipcode %]</td>
+                                                    <td>[% borrower.country %]</td>
+                                                    <td><span title="[% borrower.dateenrolled %]">[% borrower.dateenrolled | $KohaDates %]</span></td>
+                                                    <td><span title="[% borrower.dateexpiry %]">[% borrower.dateexpiry | $KohaDates %]</span></td>
+                                                    <td>[% borrower.borrowernotes %]</td>
+                                                    <td>[% borrower.opacnote %]</td>
                                                     [% FOREACH pa IN borrower.patron_attributes %]
                                                         [% IF ( pa.code ) %]
                                                             <td>[% pa.code %]=[% pa.value %]</td>
 
                             [% IF ( op == 'show' ) %]
                             <div id="cataloguing_additem_newitem">
-                                <h2>Edit Patrons</h2>
-                                <div class="hint">Checking the box right next the label will disable the entry and delete the values of that field on all selected patrons</div>
+                                <h2>Edit patrons</h2>
+                                <div class="hint">Checking the box right next to the label will disable the entry and delete the values of that field on all selected patrons</div>
                                 <fieldset class="rows" id="fields_list">
                                     <ol>
                                         [% FOREACH field IN fields %]
                                         <li>
-                                            <label style="width:20em;">[% field.lib %]</label>
+                                            [% IF ( field.mandatory ) %]
+                                            <label for="[% field.name %]" class="required">
+                                            [% ELSE %]
+                                            <label for="[% field.name %]">
+                                            [% END %]
+                                            [% SWITCH ( field.name ) %]
+                                                [% CASE 'surname' %]
+                                                Surname:
+                                                [% CASE 'firstname' %]
+                                                First name:
+                                                [% CASE 'branchcode' %]
+                                                Library:
+                                                [% CASE 'categorycode' %]
+                                                Category
+                                                [% CASE 'city' %]
+                                                City
+                                                [% CASE 'state' %]
+                                                State
+                                                [% CASE 'zipcode' %]
+                                                ZIP/Postal code
+                                                [% CASE 'country' %]
+                                                Country
+                                                [% CASE 'sort1' %]
+                                                Sort 1:
+                                                [% CASE 'sort2' %]
+                                                Sort 2:
+                                                [% CASE 'dateenrolled' %]
+                                                Registration date:
+                                                [% CASE 'dateexpiry' %]
+                                                Expiry date:
+                                                [% CASE 'borrowernotes' %]
+                                                Circulation note:
+                                                [% CASE 'opacnote' %]
+                                                OPAC note:
+                                            [% END %]
+                                            </label>
                                             [% IF field.mandatory %]
-                                                <input type="checkbox" title="This field is mandatory" name="disable_input" value="[% field.name %]" readonly="readonly" onclick="return false;" />
+                                                <input type="checkbox" title="This field is mandatory" name="disable_input" value="[% field.name %]" onclick="return false;" />
                                             [% ELSE %]
                                                 <input type="checkbox" title="Check to delete this field" name="disable_input" value="[% field.name %]" />
                                             [% END %]
                                                 [% END %]
                                             [% END %]
                                             [% IF ( field.type == 'date' ) %]
-                                                <input type="text" name="[% field.name %]" id="[% field.name %]" value="" size="10" maxlength="10" readonly="readonly" class="datepicker" />
-                                                <a href="#" onclick="clearDate('[% field.name %]');return false;">X</a>
-                                                [% END %]
+                                                <input type="text" name="[% field.name %]" id="[% field.name %]" value="" size="10" maxlength="10" class="datepicker" />
+                                                <a href="#" onclick="clearDate('[% field.name %]');return false;"><i class="fa fa-fw fa-trash"></i> Clear</a>
+                                            [% END %]
+                                            [% IF field.mandatory %]
+                                                <span class="required">Required fields cannot be cleared</span>
+                                            [% END %]
                                         </li>
                                         [% END %]
                                         [% IF ( patron_attributes_codes ) %]
                                             <li class="attributes">
-                                                <label style="width:20em;">Attribute
+                                                <label style="width:auto;">Attribute:
                                                     <select name="patron_attributes">
                                                         [% FOREACH pac IN patron_attributes_codes %]
                                                             <option value="[% pac.attribute_code %]" data-type="[% pac.type %]" data-category="[% pac.category_lib %]">[% pac.attribute_lib %]</option>
                                                 </label>
                                                 <input type="checkbox" title="check to delete this field" name="disable_input" value="attr0_value" />
                                                 <span class="patron_attributes_value"></span>
-                                                <a href="#" title="Add an attribute" onclick="add_attributes(); return false;">+</a>
-                                                <span class="information_category"></span>
+                                                <a href="#" title="Add an attribute" onclick="add_attributes(); return false;"><i class="fa fa-fw fa-plus"></i> New</a>
+                                                <span class="information_category hint" style="width:25%;float:right;"></span>
                                             </li>
                                         [% END %]
                                     </ol>
                             </div>
                         </form>
                         [% END %]
+                    [% END %]
                 [% END %]
                 [% IF ( op == 'show_results' ) %]
-                    <br/>
-                    <a href="/cgi-bin/koha/tools/modborrowers.pl" title="new Batch patrons modification">new Batch patrons modification</a>
+                <p>
+                    <a href="/cgi-bin/koha/tools/modborrowers.pl" title="New batch patrons modification">New batch patron modification</a>
+                </p>
                 [% END %]
             </div>
             </div>
                 [% INCLUDE 'tools-menu.inc' %]
             </div>
         </div>
-    </div>
-</div>
-</body>
-</html>
+[% INCLUDE 'intranet-bottom.inc' %]