Bug 12159: Fix getting extended patron attributes for circ-menu
[srvgit] / koha-tmpl / intranet-tmpl / prog / en / modules / reports / borrowers_stats.tt
index 4d3bba2..17a0ee2 100644 (file)
@@ -1,62 +1,63 @@
+[% USE Branches %]
+[% USE Koha %]
+[% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Reports [% IF ( do_it ) %]&rsaquo; Patrons statistics &rsaquo; Results[% ELSE %]&rsaquo; Patrons statistics[% END %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
-[% INCLUDE 'calendar.inc' %]
-<style type="text/css">
+<style>
        .sql {display:none;}
        .debug {display:none;}
 </style>
 </head>
-<body>
+
+<body id="rep_borrowers_stats" class="rep">
 [% 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/reports/reports-home.pl">Reports</a> &rsaquo; <a href="/cgi-bin/koha/reports/borrowers_stats.pl">Patrons statistics</a>[% IF ( do_it ) %] &rsaquo; Results[% END %]</div>
 
-<div id="doc3" class="yui-t2">
-   
-   <div id="bd">
-       <div id="yui-main">
-       <div class="yui-b">
+<div class="main container-fluid">
+    <div class="row">
+        <div class="col-sm-10 col-sm-push-2">
+            <main>
 
 [% IF ( do_it ) %]
        [% FOREACH mainloo IN mainloop %]
                <h1>Patrons statistics</h1>
-               [% IF ( mainloo.loopfilter ) %]
-                       <p>Filtered on</p>
+        [% IF ( mainloo.loopfilter.size>0 ) %]
+            <p>Filtered on:</p>
                        [% FOREACH loopfilte IN mainloo.loopfilter %]
                                <p>
-                                       [% loopfilte.crit %] = [% loopfilte.filter %]
+                                       [% loopfilte.crit | html %] = [% loopfilte.filter | html %]
                                </p>
                        [% END %]
                [% END %]
                <table>
                        <tr>
-                               <th>[% mainloo.line %] / [% mainloo.column %]</th>
+                               <th>[% mainloo.line | html %] / [% mainloo.column | html %]</th>
                                [% FOREACH loopco IN mainloo.loopcol %]
-                                       <th>[% IF ( loopco.coltitle_display ) %][% loopco.coltitle_display %][% ELSE %][% loopco.coltitle %][% END %]
+                                       <th>[% IF ( loopco.coltitle_display ) %][% loopco.coltitle_display | html %][% ELSE %][% loopco.coltitle | html %][% END %]
                                        </th>
                                [% END %]
                                <th>TOTAL</th>
                        </tr>
                                [% FOREACH loopro IN mainloo.looprow %]
-                    [% UNLESS ( loop.odd ) %]<tr class="highlight">
-                    [% ELSE %]<tr>[% END %]
-                                               <td>[% IF ( loopro.rowtitle_display ) %][% loopro.rowtitle_display %][% ELSE %][% loopro.rowtitle %][% END %]
+                    <tr>
+                                               <td>[% IF ( loopro.rowtitle_display ) %][% loopro.rowtitle_display | html %][% ELSE %][% loopro.rowtitle | html %][% END %]
                                                </td>
                                                [% FOREACH loopcel IN loopro.loopcell %]
-                                               <td>[% IF ( loopcel.value ) %][% loopcel.value %][% ELSE %]&nbsp;[% END %]
+                                               <td>[% IF ( loopcel.value ) %][% loopcel.value | html %][% ELSE %]&nbsp;[% END %]
                                                </td>
                                                [% END %]
-                                               <td>[% loopro.totalrow %]</td>
+                                               <td>[% loopro.totalrow | html %]</td>
                                        </tr>
                                [% END %]
                                <tr>
                                        <th>TOTAL</th>
                                        [% FOREACH loopfoote IN mainloo.loopfooter %]
-                                               <th>[% loopfoote.totalcol %]</th>
+                                               <th>[% loopfoote.totalcol | html %]</th>
                                        [% END %]
-                                       <th>[% mainloo.total %]</th>
+                                       <th>[% mainloo.total | html %]</th>
                                </tr>
                </table>
        [% END %]
                        </tr>
                </thead>
                <tbody>
-                       <tr class="highlight">
+            <tr>
                        <td>Patron category</td>
                        <td><input type="radio" name="Line" value="categorycode" /></td>
-                       <td><input type="radio" name="Column" value="categorycode" /></td>
-                       <td><select name="Filter"  size="1" id="catcode">
-                               <option value=""></option>
-                               [% FOREACH CAT_LOO IN CAT_LOOP %]
-                               <option value="[% CAT_LOO.categorycode %]">[% CAT_LOO.description %]</option>
-                               [% END %]
-                               </select>
-                       </td>
+            <td><input type="radio" checked="checked" name="Column" value="categorycode" /></td>
+            <td>
+                <select name="Filter"  size="1" id="catcode">
+                    <option value=""></option>
+                    [% FOREACH patron_category IN patron_categories %]
+                        <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
+                    [% END %]
+                </select>
+            </td>
                        </tr>
                        <tr>
                        <td>Patron status</td>
                        <td colspan="2"></td>
-                       <td ><select name="status"><option value=""> </option><option value="debarred">debarred</option><option value="gonenoadress">gone no address</option><option value="lost">lost</option></select></td>
+                       <td ><select name="status"><option value=""> </option><option value="debarred">restricted</option><option value="gonenoadress">gone no address</option><option value="lost">lost</option></select></td>
                        </tr>
-                       <tr class="highlight">
+            <tr>
                        <td>Patron activity</td>
                        <td colspan="2"><select name="period" id="period">
                        <option value="1">1</option>
                        </tr>
 
                        <tr>
-                       <td rowspan="2">Zip Code</td>
+            <td rowspan="2">ZIP/Postal code</td>
                        <td><input type="radio" name="Line" value="zipcode" /></td>
                        <td><input type="radio" name="Column" value="zipcode" /></td>
                        <td><select name="Filter"  size="1" id="zipcode">
                                <option value=""> </option>
                                [% FOREACH ZIP_LOO IN ZIP_LOOP %]
-                               <option value="[% ZIP_LOO.zipcode %]">[% ZIP_LOO.zipcode %]</option>
+                               <option value="[% ZIP_LOO.zipcode | html %]">[% ZIP_LOO.zipcode | html %]</option>
                                [% END %]
                                </select>
                        </td>
                        <td>&nbsp;</td>
                        </tr>
 
-                       <tr class="highlight">
+            <tr>
                        <td>Library</td>
-                       <td><input type="radio" name="Line"   value="branchcode" /></td>
+            <td><input type="radio" checked="checked" name="Line"   value="branchcode" /></td>
                        <td><input type="radio" name="Column" value="branchcode" /></td>
                        <td>
-                               <select name="Filter"  size="1" id="branch">
-                               <option value=""></option>
-                               [% FOREACH BRANCH_LOO IN BRANCH_LOOP %]
-                                       <option value="[% BRANCH_LOO.branchcode %]">[% BRANCH_LOO.branchcode %] - [% BRANCH_LOO.branchname %]</option>
-                               [% END %]
-                               </select>
+                <select name="Filter"  size="1" id="branch">
+                <option value=""></option>
+                [% FOREACH l IN Branches.all( unfiltered => 1 ) %]
+                    <option value="[% l.branchcode | html %]">[% l.branchcode | html %] - [% l.branchname || 'UNKNOWN' | html %]</option>
+                [% END %]
+                </select>
                        </td>
                        </tr>
                    <tr>
-            <td>Date of Birth</td>
+            <td>Date of birth</td>
             <td colspan="2"></td>
-                <td><label for="from">From</label> <input type="text" readonly="readonly" size="10" id="from" name="Filter" />
-                    <img src="[% themelang %]/lib/calendar/cal.gif" alt="Show Calendar" border="0" id="openCalendarFrom" style="cursor: pointer;" />
-                   <script type="text/javascript">
-                                  //<![CDATA[
-                                   function validate1(date) {
-                        var day = date.getDate();
-                        var month = date.getMonth() + 1;
-                        var year = date.getFullYear();
-                        var weekDay = date.getDay();
-                        var dayMonth = month + '-' + day;
-                        var dateString = year + '-' + month + '-' + day;
-                        var dateTo = document.getElementById('to').value.split("-");
-                        var limitDate = new Date(dateTo[0], (dateTo[1] - 1), dateTo[2]);
-                        if (date > limitDate) {
-                                return true;
-                        } else {
-                                return false;
-                        }
-                    }
-                    Calendar.setup({
-                            inputField : "from",
-                            ifFormat : "[% DHTMLcalendar_dateformat %]",
-                            button : "openCalendarFrom",
-                            disableFunc : validate1,
-                            dateStatusFunc : validate1
-                    });
-                                       //]]>
-                    </script>
-                    <label for="to">To</label> <input readonly="readonly" size="10" id="to" name="Filter" value="" type="text" />
-                        <img src="[% themelang %]/lib/calendar/cal.gif" alt="Show Calendar" id="openCalendarTo" style="cursor: pointer;" border="0" />
-                          <script type="text/javascript">
-                                                 //<![CDATA[ 
-                                                  function validate2(date) {
-                                var day = date.getDate();
-                                var month = date.getMonth() + 1;
-                                var year = date.getFullYear();
-                                var weekDay = date.getDay();
-                                var dayMonth = month + '-' + day;
-                                var dateString = year + '-' + month + '-' + day;
-                                var dateFrom = document.getElementById('from').value.split("-");
-                                var limitDate = new Date(dateFrom[0], (dateFrom[1] - 1), dateFrom[2]);
-                                if (limitDate > date) {
-                                        return true;
-                                } else {
-                                        return false;
-                                }
-                            }
-
-                            Calendar.setup({
-                                    inputField : "to",
-                                    ifFormat : "[% DHTMLcalendar_dateformat %]",
-                                    button : "openCalendarTo",
-                                    disableFunc : validate2,
-                                    dateStatusFunc : validate2
-                            });
-                                                       //]]>
-                        </script><span class="hint">[% INCLUDE 'date-format.inc' %]</span>
+                <td><label for="from">From</label> <input type="text" size="10" id="from" name="Filter" class="datepickerfrom" />
+                    <label for="to">To</label> <input size="10" id="to" name="Filter" value="" type="text" class="datepickerto" />
+                    <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
                     </td>
                 </tr>
             <tr>
                 </td>
             </tr>
                        [% IF ( SORT1_LOOP ) %]
-                               <tr class="highlight">
+                <tr>
                                <td>Sort1</td>
                                <td><input type="radio" name="Line" value="sort1" /></td>
                                <td><input type="radio" name="Column" value="sort1" /></td>
                                        <select id="sort1" size="1" name="Filter">
                                        <option value=""/>
                                        [% FOREACH SORT1_LOO IN SORT1_LOOP %]
-                                               <option value="[% SORT1_LOO.authorized_value %]">[% SORT1_LOO.lib %]</option>
+                                               <option value="[% SORT1_LOO.authorized_value | html %]">[% SORT1_LOO.lib | html %]</option>
                                        [% END %]
                                        </select>
                                </td>
                                </tr>
+            [% ELSE %]
+                <input type="hidden" name="Filter" />
                        [% END %]
                        [% IF ( SORT2_LOOP ) %]
-                [% UNLESS ( SORT1_LOOP ) %]<tr class="highlight">
-                [% ELSE %]<tr>[% END %]
+                <tr>
                                <td>Sort2</td>
                                <td><input type="radio" name="Line" value="sort2" /></td>
                                <td><input type="radio" name="Column" value="sort2" /></td>
                                        <select id="sort2" size="1" name="Filter">
                                        <option value=""/>
                                        [% FOREACH SORT2_LOO IN SORT2_LOOP %]
-                                               <option value="[% SORT2_LOO.value %]">[% SORT2_LOO.value %]</option>
+                                               <option value="[% SORT2_LOO.value | html %]">[% SORT2_LOO.value | html %]</option>
                                        [% END %]
                                        </select>
                                </td>
                                </tr>
+            [% ELSE %]
+                <input type="hidden" name="Filter" />
                        [% END %]
-               </tbody>
-       </table><br /></fieldset>
+            [% IF Koha.Preference('ExtendedPatronAttributes') %]
+                <tr>
+                    <th colspan="4">Patron attributes</th>
+                </tr>
+            [% FOREACH pa_loo IN patron_attributes %]
+                [% IF (pa_loo.class) %]
+                    <tr>
+                        <th>[% pa_loo.class | html %] ([% pa_loo.lib | html %])</th>
+                        <th colspan="3"></th>
+                    </tr>
+                [% END %]
+            [% FOREACH patron_attribute IN pa_loo.items %]
+                <tr data-category_code="[% patron_attribute.category_code | html %]">
+                    <td>
+                        [% patron_attribute.code | html %]
+                        ([% patron_attribute.description | html %])
+                    </td>
+                    <td>
+                        <input type="radio" name="Line"
+                            value="patron_attr.[% patron_attribute.code | html %]" />
+                    </td>
+                    <td>
+                        <input type="radio" name="Column"
+                            value="patron_attr.[% patron_attribute.code | html %]" />
+                    </td>
+                    <td>
+                        [% IF ( patron_attribute.use_dropdown ) %]
+                            <select name="Filter_patron_attr.[% patron_attribute.code | html %]"  >
+                                <option value="" />
+                                [% FOREACH auth_val_loo IN patron_attribute.auth_val_loop %]
+                                    <option value="[% auth_val_loo.authorised_value | html %]" >
+                                        [% auth_val_loo.lib | html %]
+                                    </option>
+                                [% END %]
+                            </select>
+                        [% ELSE %]
+                            <input type="text" maxlength="64"
+                                   name="Filter_patron_attr.[% patron_attribute.code | html %]" />
+                        [% END %]
+                    </td>
+                </tr>
+            [% END %]
+            [% END %]
+            [% END %]
+        </tbody>
+    </table>
+    </fieldset>
+
        
        <fieldset class="rows">
        <legend>Output</legend>
-<ol><li><label for="outputscreen">To screen into the browser: </label><input type="radio" checked="checked" name="output" id="outputscreen" value="screen" /> </li>
-<li><label for="outputfile">To a file:</label>                 <input type="radio" name="output" value="file" id="outputfile" /> <label class="inline" for="basename">Named: </label><input type="text" name="basename" id="basename" value="Export" /> <label class="inline" for="MIME">Into an application  
-               </label>[% CGIextChoice %]
-               [% CGIsepChoice %]</li></ol>
+    <ol>
+        <li>
+            <label for="outputscreen">To screen into the browser: </label><input type="radio" checked="checked" name="output" id="outputscreen" value="screen" />
+        </li>
+        <li>
+            <label for="outputfile">To a file:</label> <input type="radio" name="output" value="file" id="outputfile" />
+            <label class="inline" for="basename">Named: </label><input type="text" name="basename" id="basename" value="Export" />
+            <label class="inline" for="MIME">Into an application:</label>
+            <select name="MIME" id="MIME" size="1">
+            [% FOREACH value IN CGIextChoice %]
+                <option value="[% value | html %]">[% value | html %]</option>
+            [% END %]
+            </select>
+            <select name="sep" id="sep" size="1">
+            [% FOREACH value IN CGIsepChoice.values.sort() %]
+              [% IF ( value == CGIsepChoice.default ) %]
+                <option value="[% value | html %]" selected="selected">[% value | html %]</option>
+              [% ELSE %]
+                <option value="[% value | html %]">[% value | html %]</option>
+              [% END %]
+            [% END %]
+            </select>
+        </li>
+    </ol>
        </fieldset>
 
        <fieldset class="action">
        <input type="submit" value="Submit" />
-       <input type="hidden" name="report_name" value="[% report_name %]" />
+       <input type="hidden" name="report_name" value="[% report_name | html %]" />
        <input type="hidden" name="do_it" value="1" />
        </fieldset>
        </form>
 [% END %]
 
-</div>
-</div>
-<div class="yui-b">
-[% INCLUDE 'reports-menu.inc' %]
-</div>
-</div>
+            </main>
+        </div> <!-- /.col-sm-10.col-sm-push-2 -->
+
+        <div class="col-sm-2 col-sm-pull-10">
+            <aside>
+                [% INCLUDE 'reports-menu.inc' %]
+            </aside>
+        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
+     </div> <!-- /.row -->
+
+[% MACRO jsinclude BLOCK %]
+    [% INCLUDE 'calendar.inc' %]
+[% END %]
+
 [% INCLUDE 'intranet-bottom.inc' %]