Bug 17855 - Followup patch following requests in comments 176 and 177
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / onboarding / onboardingstep2.tt
1 [% USE Koha %]
2 [% USE KohaDates %]
3 [% USE Price %]
4 [% INCLUDE 'doc-head-open.inc' %]
5 <title> Add a patron category</title>
6 [% INCLUDE 'installer-doc-head-close.inc' %]
7 [% INCLUDE 'calendar.inc' %]
8 [% INCLUDE 'js_includes.inc' %]
9 [% INCLUDE 'datatables.inc' %]
10 <script type="text/javascript">
11     var MSG_CATEGORYCODE_CHARS=(_("Please only enter letters into this field."));
12     var MSG_ONE_ENROLLMENTPERIOD =(_("Please choose an enrollment period in months OR by date."));
13     var MSG_ONLY_ONE_ENROLLMENTPERIOD=(_("Please only choose one enrolment period."));
14
15 jQuery.validator.addMethod( "enrollment_period", function(){
16       enrolmentperiod = $("#enrolmentperiod").val();
17       enrolmentperioddate = $("#enrolmentperioddate").val();
18       if (( $("#enrolmentperiod").val() == "" && $("#enrolmentperioddate").val() == "") || ($("#enrolmentperiod").val() !== "" && $("#enrolmentperioddate").val() !== "")) {
19              return false;
20       } else {
21              return true;
22       }
23     }, MSG_ONE_ENROLLMENTPERIOD
24 );
25 </script>
26 <script type="text/javascript" src="[% themelang %]/js/categories.js"></script>
27 </head>
28
29 [% IF (categories && categories.count > 1 ) %] <!--This if statement checks if the categories variable handed to this template by onboarding.pl has data in it. If the categories variable does have data in it this means that the user has previously imported sample patron category data and so we do not need to show them the create patron category screen 1, instead we can display a screen with ubtton redirecting the user to step 3-->
30
31
32      <meta http-equiv="refresh" content="0; url=/cgi-bin/koha/installer/onboarding.pl?step=3">
33
34 [% ELSIF (op == "add_validate_category") %]
35 <!--else if the user has not previously imported sample patron categories check if the user has pressed the button name="add_validate" in the create patron category screen 1, and if they have pressed that button then display the below screen with a button to redirect the user to step 3-->
36
37     <div> <!-- Header that appears at the top of every screen in the koha onboarding tool-->
38         <h1 id="logo"><img alt="Koha" src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/> Welcome to Koha</h1>
39     </div>
40
41     [% IF message != "error_on_insert" %]
42      <form name="createcat" method="post" action="onboarding.pl">
43             <input type="hidden" name="step" value="3"/>
44              <h1 align="left">  New patron category</h1>
45              <div>
46                  <p> Success: patron category created! </p>
47                  <p> To add another patron category and for more settings<br>
48                  go to:<br>
49                  More -> Administration -> Patron categories<br>
50              </div>
51              Next up:<br>
52              <input type="submit" name="start" value="Add a patron"><!-- When the user clicks on this button then redirect them to step 3 of the onboarding tool-->
53      </form>
54      [% ELSE %]
55         <form name="retrypatcat" method="post" action="onboarding.pl">
56         Message is [% message %]
57         <input type="hidden" name="step" value="2"/>
58             <h1 align="left">Failed</h1>
59             <div>Patron category was not successfully created.</br>
60             Please try again or contact your system administrator.</p>
61             </div>
62             <input type="submit" value="Try again"/>
63         </form>
64     [% END %]
65
66
67 [% ELSE %] <!--Else display create patron category screen 1 where the user can input values to create their first patron category-->
68     <div> <!-- Header that appears at the top of every screen in the koha onboarding tool-->
69         <h1 id="logo"><img alt="Koha" src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/> Welcome to Koha</h1>
70     </div>
71
72     <h1 align="left"> Create a new patron category</h1>
73     <p> The patron category you create in this form is going to be the one which the new administrator patron account will have.</p>
74        <form id="category_form" method="post" action="onboarding.pl">
75        <fieldset class="rows">
76             <input type="hidden" name="step" value="2"/>
77             <input type="hidden" name="op" value="add_validate_category" />
78                 <ol>
79                     <li>
80                         <label for="categorycode" class="required">Category code: </label>
81                         <input type="text" pattern="[0-9A-Za-z]{1,10}" title="Please enter up to 10 letters and/or numbers" id="categorycode" name="categorycode" value="[% category.categorycode |html %]" size="10" maxlength="10" class="required" required="required" />
82                         <span class="required">Required</span>
83                     </li>
84
85                     <li>
86                         <label for="description" class="required">Description: </label>
87                         <input type="text" name="description" title="Please enter a description of the category" size="40" maxlength="80" class="required" required="required" value="[% category.description |html%]" />
88                         <span class="required">Required</span>
89                     </li>
90
91                     <li>
92                         <label for="overduenoticerequired">Overdue notice required: </label>
93                         <select name="overduenoticerequired" value="overduenoticerequired">
94                             [% IF category.overduenoticerequired %]
95                                 <option value="0">No</option>
96                                 <option value="1" selected="selected">Yes</option>
97                             [% ELSE %]
98                                 <option value="0" selected="selected">No</option>
99                                 <option value="1">Yes</option>
100                             [% END %]
101                         </select>
102                     </li>
103
104                     <li>
105                         <label for="category_type" class="required">Category type: </label>
106                         <select name="category_type" value="category_type" class='required' required='required'>
107                             [% IF category and category.category_type == 'S' %]
108                                 <option value="S" selected="selected">Staff</option>
109                             [% ELSE %]
110                                 <option value="S">Staff</option>
111                             [% END %]
112                         </select>
113                         <span class="required">Required</span>
114                     </li>
115
116                     <li>
117                         <label for="default_privacy">Default privacy: </label>
118                         <select value="default_privacy" name="default_privacy" required="required">
119                             [% SET default_privacy = 'default' %]
120
121                             [% IF category %]
122                                [% SET default_privacy = category.default_privacy %]
123                             [% END %]
124
125                             [% SWITCH default_privacy %]
126                             [% CASE 'forever' %]
127                                 <option value="default">Default</option>
128                                 <option value="never">Never</option>
129                                 <option value="forever" selected="selected">Forever</option>
130                             [% CASE 'never' %]
131                                 <option value="default">Default</option>
132                                 <option value="never" selected="selected">Never</option>
133                                 <option value="forever">Forever</option>
134                             [% CASE %]
135                                 <option value="default" selected="selected">Default</option>
136                                 <option value="never">Never</option>
137                                 <option value="forever">Forever</option>
138                             [% END %]
139                         </select>
140                         <p>Controls how long a patrons checkout history is kept for new patrons of this category. "Never"     anonymizes checkouts on return, and "Forever" keeps a patron's checkout history indefinitely. When set to "Default", the amount of history kept is controlled by the cronjob <i>batch_anonymise.pl</i> which should be set up by your system administrator.</p>
141                     </li>
142             </ol>
143             <span class="label">Enrolment period: </span>
144             </br>
145                     <fieldset>
146                     <legend>Choose one</legend>
147                             <ol>
148                                 <li>
149                                     <label for="enrolmentperiod" style="width:6em;">In months: </label>
150                                     <input type="number" class="enrolmentperiod" name="enrolmentperiod" id="enrolmentperiod" min="0" size="3" maxlength="3" value="[% IF category.enrolmentperiod %][% category.enrolmentperiod %][% END %]" /> months
151                                 </li>
152                                 <li>
153                                     <label for="enrolmentperioddate" style="width:6em;">Until date: </label>
154                                     <input type="text" class="enrolmentperioddate datepicker" name="enrolmentperioddate" id="enrolmentperioddate" value="[% category.enrolmentperioddate | $KohaDates %]" />
155                                 </li>
156                             </ol>
157                      </fieldset>
158                     <br>
159                     <input type="submit" class="action" value="Submit" />
160     </fieldset>
161     </form>
162 [% END %]
163
164 [% INCLUDE 'intranet-bottom.inc' %]