Bug 7919 : Display of values depending on the connexion library
[koha_fer] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / categorie.tt
index 62322fa..9398ca6 100644 (file)
@@ -1,9 +1,10 @@
 [% INCLUDE 'doc-head-open.inc' %]
-<title>Koha &rsaquo; Administration &rsaquo; Patron Categories &rsaquo; [% IF ( add_form ) %][% IF ( categorycode ) %]Modify category '[% categorycode |html %]'[% ELSE %]New category[% END %][% END %]
+<title>Koha &rsaquo; Administration &rsaquo; Patron categories &rsaquo; [% IF ( add_form ) %][% IF ( categorycode ) %]Modify category '[% categorycode |html %]'[% ELSE %]New category[% END %][% END %]
 [% IF ( add_validate ) %]Data recorded[% END %]
-[% IF ( delete_confirm ) %][% IF ( totalgtzero ) %]Cannot Delete: Category [% categorycode |html %] in Use[% ELSE %]Confirm Deletion of Category '[% categorycode |html %]'[% END %][% END %]
-[% IF ( delete_confirmed ) %]Category Deleted[% END %]</title>
+[% IF ( delete_confirm ) %][% IF ( totalgtzero ) %]Cannot delete: category [% categorycode |html %] in use[% ELSE %]Confirm deletion of category '[% categorycode |html %]'[% END %][% END %]
+[% IF ( delete_confirmed ) %]Category deleted[% END %]</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" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.pager.js"></script>
 <script type="text/javascript" id="js">$(document).ready(function() {
                widgets: ['zebra'],
                headers: { 11: { sorter: false}}
        }).tablesorterPager({container: $("#pagertable_categorie"),positionFixed: false,size: 20});
+    $( "#enrolmentperioddate" ).datepicker({ minDate: 1 }); // Require that "until date" be in the future
+
+    if ( $("#branches option:selected").length < 1 ) {
+        $("#branches option:first").attr("selected", "selected");
+    }
 }); </script>
-[% INCLUDE 'calendar.inc' %]
 <script type="text/javascript">
 //<![CDATA[
        //
            var ok=0;
                var _alertString=_("Form not submitted because of the following problem(s)");
                _alertString +="\n-------------------------------------------------------------------\n\n";
-               if (ff.categorycode.value.length==0) {
-                   ok=1;
-                       _alertString += _("- categorycode missing") + "\n";
-               }
+                ff.categorycode.value = ff.categorycode.value.trim();
+                if (ff.categorycode.value.length==0) {
+                   ok=1;
+                   _alertString += _("- categorycode missing") + "\n";
+                }
+                else{
+                   var patt=/^[a-zA-Z0-9\-_]+$/g;
+                   if ( !patt.test(ff.categorycode.value) ) {
+                      ok=1;
+                      _alertString += _("- category code can only contain the following characters: letters, numbers, - and _") + "\n";
+                   }
+                }
                if (!(ff.category_type.value)){
                    ok=1;
                    _alertString += _("- category type missing") + "\n";
 </script>
 <style type="text/css">#enrolmentmessage.hint { display : none; }</style>
 </head>
-<body>
+<body id="admin_categorie" class="admin">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'patrons-admin-search.inc' %]
 
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; [% IF ( add_form ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron Categories</a> &rsaquo; [% IF ( categorycode ) %]Modify category '[% categorycode |html %]'[% ELSE %]New category[% END %][% END %]
-[% IF ( add_validate ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron Categories</a> &rsaquo; Data recorded[% END %]
-[% IF ( delete_confirm ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron Categories</a> &rsaquo; [% IF ( totalgtzero ) %]Cannot Delete: Category [% categorycode |html %] in Use[% ELSE %]Confirm Deletion of Category '[% categorycode |html %]'[% END %][% END %]
-[% IF ( delete_confirmed ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron Categories</a> &rsaquo; Category Deleted[% END %]
-[% IF ( else ) %]Patron Categories[% END %]</div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; [% IF ( add_form ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron categories</a> &rsaquo; [% IF ( categorycode ) %]Modify category '[% categorycode |html %]'[% ELSE %]New category[% END %][% END %]
+[% IF ( add_validate ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron categories</a> &rsaquo; Data recorded[% END %]
+[% IF ( delete_confirm ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron categories</a> &rsaquo; [% IF ( totalgtzero ) %]Cannot delete: Category [% categorycode |html %] in use[% ELSE %]Confirm deletion of category '[% categorycode |html %]'[% END %][% END %]
+[% IF ( delete_confirmed ) %] <a href="/cgi-bin/koha/admin/categorie.pl">Patron categories</a> &rsaquo; Category deleted[% END %]
+[% IF ( else ) %]Patron categories[% END %]</div>
 
 <div id="doc3" class="yui-t2">
    
        <li><label for="enrolmentperiod" style="width:6em;">In months: </label>
                <input type="text" name="enrolmentperiod" id="enrolmentperiod" size="3" maxlength="3" value="[% IF ( enrolmentperiod ) %][% enrolmentperiod %][% END %]" /> months</li>
        <li><label for="enrolmentperioddate" style="width:6em;">Until date: </label>
-               <input type="text" name="enrolmentperioddate" id="enrolmentperioddate" value="[% enrolmentperioddate %]" /> <img src="[% themelang %]/lib/calendar/cal.gif" id="enrolmentperioddate_button" alt="Show Calendar" />
-               <script type="text/javascript">
-            //<![CDATA[
-               Calendar.setup({
-                    inputField : "enrolmentperioddate",
-                    ifFormat : "[% DHTMLcalendar_dateformat %]",
-                       button : "enrolmentperioddate_button"
-               });
-               //]]>
-        </script>
+        <input type="text" name="enrolmentperioddate" id="enrolmentperioddate" value="[% enrolmentperioddate %]" />
                <div id="enrolmentmessage" class="hint" style="margin-left:0;">Cannot have "months" and "until date" at the same time</div>
        </li>
        </ol>
                                        </select></li>
        <li><label for="reservefee">Hold fee: </label><input type="text" name="reservefee" id="reservefee" size="6" value="[% reservefee %]" /></li>
        <li><label for="category_type">Category type: </label> <select name="category_type" id="category_type">
-                                               [% IF ( type_n ) %]<option value="" selected="selected">Select a Category type</option>[% ELSE %]<option value="">Select a Category type</option>[% END %]
+                        [% IF ( type_n ) %]<option value="" selected="selected">Select a category type</option>[% ELSE %]<option value="">Select a category type</option>[% END %]
                                        [% IF ( type_A ) %]<option value="A" selected="selected">Adult</option>[% ELSE %]<option value="A">Adult</option>[% END %]
                                        [% IF ( type_C ) %]<option value="C" selected="selected">Child</option>[% ELSE %]<option value="C">Child</option>[% END %]
                                        [% IF ( type_S ) %]<option value="S" selected="selected">Staff</option>[% ELSE %]<option value="S">Staff</option>[% END %]
                                        [% IF ( type_P ) %]<option value="P" selected="selected">Professional</option>[% ELSE %]<option value="P">Professional</option>[% END %]
                                        [% IF ( type_X ) %]<option value="X" selected="selected">Statistical</option>[% ELSE %]<option value="X">Statistical</option>[% END %]
                                        </select>
-       </li></ol>
+    </li>
+    <li><label for="branches">Branches limitation: </label>
+        <select id="branches" name="branches" multiple size="10">
+            <option value="">All branches</option>
+            [% FOREACH branch IN branches_loop %]
+              [% IF ( branch.selected ) %]
+                <option selected="selected" value="[% branch.branchcode %]">[% branch.branchname %]</option>
+              [% ELSE %]
+                <option value="[% branch.branchcode %]">[% branch.branchname %]</option>
+              [% END %]
+            [% END %]
+        </select>
+        <span>Select All if this category type must to be displayed all the time. Otherwise select librairies you want to associate with this value.
+        </span>
+    </li>
+    </ol>
 </fieldset>
 
     [% IF ( EnhancedMessagingPreferences ) %]
        <fieldset><legend>      
        [% IF ( totalgtzero ) %]
        Category [% categorycode |html %] is in use.  Deletion not possible![% ELSE %]
-Confirm Deletion of Category [% categorycode |html %][% END %]</legend>
+Confirm deletion of category [% categorycode |html %][% END %]</legend>
 
 [% IF ( totalgtzero ) %]<div class="dialog alert"><strong>This category is used [% total %] times</strong>. Deletion not possible</div>[% END %]
        <table>
@@ -233,12 +252,12 @@ Confirm Deletion of Category [% categorycode |html %][% END %]</legend>
 <input type="submit" value="OK" /></form>
                [% ELSE %]
                        <input type="hidden" name="op" value="delete_confirmed" />
-                       <input type="hidden" name="categorycode" value="[% categorycode |html %]" /> <input type="submit" value="Delete this Category" /> <a class="cancel" href="/cgi-bin/koha/admin/categorie.pl">Cancel</a> 
+            <input type="hidden" name="categorycode" value="[% categorycode |html %]" /> <input type="submit" value="Delete this category" /> <a class="cancel" href="/cgi-bin/koha/admin/categorie.pl">Cancel</a>
                [% END %]</fieldset></fieldset></form>
 [% END %]
 
 [% IF ( delete_confirmed ) %]
-<h3>Category Deleted</h3>
+<h3>Category deleted</h3>
 
         <form action="[% script_name %]" method="post">
         <input type="submit" value="OK" />
@@ -266,10 +285,10 @@ Confirm Deletion of Category [% categorycode |html %][% END %]</legend>
        //]]>
        </script>
        <ul class="toolbar">
-       <li><a id="newcategory" href="/cgi-bin/koha/admin/categorie.pl?op=add_form">New Category</a></li>
+    <li><a id="newcategory" href="/cgi-bin/koha/admin/categorie.pl?op=add_form">New category</a></li>
 </ul></div>
 
-<h2>Patron Category Administration</h2>
+<h2>Patron category administration</h2>
 [% IF ( searchfield ) %]
                You Searched for [% searchfield %]</span>
        [% END %]
@@ -287,18 +306,19 @@ Confirm Deletion of Category [% categorycode |html %][% END %]</legend>
                        <th scope="col">Upper age limit</th>
                        <th scope="col">Enrollment fee</th>
                        <th scope="col">Overdue</th>
-                       <th scope="col">Lost Items</th>
+            <th scope="col">Lost items</th>
                        <th scope="col">Hold fee</th>
             [% IF ( EnhancedMessagingPreferences ) %]
             <th scope="col">Messaging</th>
             [% END %]
+            <th scope="col">Branches limitations</th>
                        <th scope="col" colspan="2">&nbsp; </th>
                </thead>
                [% FOREACH loo IN loop %]
                        <tr>
                         <td>[% loo.categorycode |html %]</td>
                         <td>
-                            <a href="[% loo.script_name %]?op=add_form&amp;categorycode=[% loo.categorycode |url %]">[% loo.description |html %]</a>
+                            <a href="[% loo.script_name %]?op=add_form&amp;categorycode=[% loo.categorycode |uri %]">[% loo.description |html %]</a>
                         </td>
                         <td>
                             [% IF ( loo.type_A ) %]Adult[% END %]
@@ -328,12 +348,12 @@ Confirm Deletion of Category [% categorycode |html %][% END %]</legend>
                               [% FOREACH prefs IN loo.messaging_prefs %]
                                        [% FOREACH transport IN prefs.transports %]
                                          [% IF ( transport.transport ) %]
-                                                       [% IF ( prefs.Item_Due ) %]Item Due
-                                                       [% ELSIF ( prefs.Advance_Notice ) %]Advance Notice
-                                                       [% ELSIF ( prefs.Upcoming_Events ) %]Upcoming Events
-                                                       [% ELSIF ( prefs.Hold_Filled ) %]Hold Filled
-                                                       [% ELSIF ( prefs.Item_Check_in ) %]Item Check-in
-                                                       [% ELSIF ( prefs.Item_Checkout ) %]Item Checkout
+                                            [% IF ( prefs.Item_Due ) %]Item due
+                                            [% ELSIF ( prefs.Advance_Notice ) %]Advance notice
+                                            [% ELSIF ( prefs.Upcoming_Events ) %]Upcoming events
+                                            [% ELSIF ( prefs.Hold_Filled ) %]Hold filled
+                                            [% ELSIF ( prefs.Item_Check_in ) %]Item check-in
+                                            [% ELSIF ( prefs.Item_Checkout ) %]Item checkout
                                                        [% ELSE %]Unknown
                                                        [% END %]:
                                                            <strong>[% transport.transport %]</strong><br />
@@ -345,8 +365,19 @@ Confirm Deletion of Category [% categorycode |html %][% END %]</legend>
                             [% END %]
                         </td>
                         [% END %]
-                        <td><a href="[% loo.script_name %]?op=add_form&amp;categorycode=[% loo.categorycode |url %]">Edit</a></td>
-                                               <td><a href="[% loo.script_name %]?op=delete_confirm&amp;categorycode=[% loo.categorycode |url %]">Delete</a></td>
+                        <td>
+                            [% IF loo.branches.size > 0 %]
+                                [% branches_str = "" %]
+                                [% FOREACH branch IN loo.branches %]
+                                    [% branches_str = branches_str _ " " _ branch.branchname _ "(" _ branch.branchcode _ ")" %]
+                                [% END %]
+                                <span title="[% branches_str %]">[% loo.branches.size %] branches limitations</span>
+                            [% ELSE %]
+                                No limitation
+                            [% END %]
+                        </td>
+                        <td><a href="[% loo.script_name %]?op=add_form&amp;categorycode=[% loo.categorycode |uri %]">Edit</a></td>
+                        <td><a href="[% loo.script_name %]?op=delete_confirm&amp;categorycode=[% loo.categorycode |uri %]">Delete</a></td>
                </tr>
                [% END %]
        </table>