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

(-)a/installer/onboarding.pl (-9 / +1 lines)
Lines 2-8 Link Here
2
2
3
# This file is part of Koha.
3
# This file is part of Koha.
4
#
4
#
5
# Copyright (C) YEAR  YOURNAME-OR-YOUREMPLOYER
5
# Copyright (C) 2017 Catalyst IT
6
#
6
#
7
# Koha is free software; you can redistribute it and/or modify it
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
8
# under the terms of the GNU General Public License as published by
Lines 27-37 use Encode qw( encode ); Link Here
27
use C4::Koha;
27
use C4::Koha;
28
use C4::Output;
28
use C4::Output;
29
use C4::Members;
29
use C4::Members;
30
use C4::Members::Attributes;
31
use C4::Members::AttributeTypes;
32
use C4::Log;
33
use Koha::AuthorisedValues;
34
use Koha::Patron::Debarments;
35
use Koha::Patrons;
30
use Koha::Patrons;
36
use Koha::Items;
31
use Koha::Items;
37
use Koha::Libraries;
32
use Koha::Libraries;
Lines 39-50 use Koha::Database; Link Here
39
use Koha::DateUtils;
34
use Koha::DateUtils;
40
use Koha::Patron::Categories;
35
use Koha::Patron::Categories;
41
use Koha::Patron::Category;
36
use Koha::Patron::Category;
42
use Koha::Patron::HouseboundRole;
43
use Koha::Patron::HouseboundRoles;
44
use Koha::ItemTypes;
37
use Koha::ItemTypes;
45
use Koha::IssuingRule;
38
use Koha::IssuingRule;
46
use Koha::IssuingRules;
39
use Koha::IssuingRules;
47
use Data::Dumper;
48
40
49
#Setting variables
41
#Setting variables
50
my $input = new CGI;
42
my $input = new CGI;
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc (-2 lines)
Lines 42-49 Link Here
42
                    <li><a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a></li>
42
                    <li><a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a></li>
43
                    [% END %]
43
                    [% END %]
44
                    <li><a href="/cgi-bin/koha/about.pl">About Koha</a></li>
44
                    <li><a href="/cgi-bin/koha/about.pl">About Koha</a></li>
45
                    <li><a href="/cgi-bin/koha/summary.pl">Summary</a></li>
46
47
                </ul>
45
                </ul>
48
            </li>
46
            </li>
49
        </ul>
47
        </ul>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep2.tt (-236 / +4 lines)
Lines 1-4 Link Here
1
<!--Pragmas for using and including packages for create patron category-->
2
[% USE Koha %]
1
[% USE Koha %]
3
[% USE KohaDates %]
2
[% USE KohaDates %]
4
[% USE Price %]
3
[% USE Price %]
Lines 6-186 Link Here
6
<title> Add a patron category</title>
5
<title> Add a patron category</title>
7
[% INCLUDE 'installer-doc-head-close.inc' %]
6
[% INCLUDE 'installer-doc-head-close.inc' %]
8
[% INCLUDE 'calendar.inc' %]
7
[% INCLUDE 'calendar.inc' %]
9
8
[% INCLUDE 'js_includes.inc' %]
10
<script type="text/javascript">
9
[% INCLUDE 'datatables.inc' %]
11
//<![CDATA[
12
13
var debug    = "";
14
var dformat  = "us";
15
var sentmsg = 0;
16
if (debug > 1) {alert("dateformat: " + dformat + "\ndebug is on (level " + debug + ")");}
17
var MSG_PLEASE_ENTER_A_VALID_DATE = (_("Please enter a valid date (should match %s)."));
18
19
function is_valid_date(date) {
20
        // An empty string is considered as a valid date for convenient reasons.
21
        if ( date === '' ) return 1;
22
        var dateformat = dateformat_str = 'us';
23
        if ( dateformat == 'us' ) {
24
           if ( date.search(/^\d{2}\/\d{2}\/\d{4}($|\s)/) == -1 ) return 0;
25
                  dateformat = 'mm/dd/yy';
26
           } else if ( dateformat == 'metric' ) {
27
                  if ( date.search(/^\d{2}\/\d{2}\/\d{4}($|\s)/) == -1 ) return 0;
28
                  dateformat = 'dd/mm/yy';
29
           } else if (dateformat == 'iso' ) {
30
                  if ( date.search(/^\d{4}-\d{2}-\d{2}($|\s)/) == -1 ) return 0;
31
                  dateformat = 'yy-mm-dd';
32
           } else if ( dateformat == 'dmydot' ) {
33
                  if ( date.search(/^\d{2}\.\d{2}\.\d{4}($|\s)/) == -1 ) return 0;
34
                  dateformat = 'dd.mm.yy';
35
           }
36
           try {
37
               $.datepicker.parseDate(dateformat, date);
38
           } catch (e) {
39
               return 0;
40
           };
41
               return 1;
42
}function get_dateformat_str(dateformat) {
43
           var dateformat_str;
44
           if ( dateformat == 'us' ) {
45
                dateformat_str = 'mm/dd/yyyy';
46
           } else if ( dateformat == 'metric' ) {
47
                dateformat_str = 'dd/mm/yyyy';
48
           } else if (dateformat == 'iso' ) {
49
                dateformat_str = 'yyyy-mm-dd';
50
           } else if ( dateformat == 'dmydot' ) {
51
                dateformat_str = 'dd.mm.yyyy';
52
           }
53
           return dateformat_str;
54
}
55
56
function validate_date (dateText, inst) {
57
           if ( !is_valid_date(dateText) ) {
58
               var dateformat_str = get_dateformat_str( 'us' );
59
               alert(MSG_PLEASE_ENTER_A_VALID_DATE.format(dateformat_str));
60
               $('#'+inst.id).val('');
61
           }
62
}
63
function Date_from_syspref(dstring) {
64
            var dateX = dstring.split(/[-/.]/);
65
            if (debug > 1 && sentmsg < 1) {sentmsg++; alert("Date_from_syspref(" + dstring + ") splits to:\n" + dateX.join("\n"));}
66
            if (dformat === "iso") {
67
                return new Date(dateX[0], (dateX[1] - 1), dateX[2]);  // YYYY-MM-DD to (YYYY,m(0-11),d)
68
            } else if (dformat === "us") {
69
                return new Date(dateX[2], (dateX[0] - 1), dateX[1]);  // MM/DD/YYYY to (YYYY,m(0-11),d)
70
            } else if (dformat === "metric") {
71
                return new Date(dateX[2], (dateX[1] - 1), dateX[0]);  // DD/MM/YYYY to (YYYY,m(0-11),d)
72
            } else if (dformat === "dmydot") {
73
                return new Date(dateX[2], (dateX[1] - 1), dateX[0]);  // DD.MM.YYYY to (YYYY,m(0-11),d)
74
            } else {
75
                if (debug > 0) {alert("KOHA ERROR - Unrecognized date format: " +dformat);}
76
                return 0;
77
            }
78
}
79
80
function DateTime_from_syspref(date_time) {
81
           var parts = date_time.split(" ");
82
           var date = parts[0];
83
           var time = parts[1];
84
           parts = time.split(":");
85
           var hour = parts[0];
86
           var minute = parts[1];
87
           if ( hour < 0 || hour > 23 ) {
88
                   return 0;
89
           }
90
           if ( minute < 0 || minute > 59 ) {
91
                   return 0;
92
           }
93
           var datetime = Date_from_syspref( date );
94
           if ( isNaN( datetime.getTime() ) ) {
95
                   return 0;
96
           }
97
           datetime.setHours( hour );
98
           datetime.setMinutes( minute );
99
           return datetime;
100
}
101
102
/* Instead of including multiple localization files as you would normally see with
103
      jQueryUI we expose the localization strings in the default configuration */
104
jQuery(function($){
105
          $.datepicker.regional[''] = {
106
              closeText: _("Done"),
107
              prevText: _("Prev"),
108
              nextText: _("Next"),
109
              currentText: _("Today"),
110
              monthNames: [_("January"),_("February"),_("March"),_("April"),_("May"),_("June"),
111
                           _("July"),_("August"),_("September"),_("October"),_("November"),_("December")],
112
              monthNamesShort: [_("Jan"), _("Feb"), _("Mar"), _("Apr"), _("May"), _("Jun"),
113
                                _("Jul"), _("Aug"), _("Sep"), _("Oct"), _("Nov"), _("Dec")],
114
              dayNames: [_("Sunday"), _("Monday"), _("Tuesday"), _("Wednesday"), _("Thursday"), _("Friday"), _("Saturday")],
115
              dayNamesShort: [_("Sun"), _("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat")],
116
              dayNamesMin: [_("Su"),_("Mo"),_("Tu"),_("We"),_("Th"),_("Fr"),_("Sa")],
117
              weekHeader: _("Wk"),
118
              dateFormat: "mm/dd/yy",
119
              firstDay: 0,
120
              isRTL: false,
121
              showMonthAfterYear: false,
122
              yearSuffix: ''};
123
              $.datepicker.setDefaults($.datepicker.regional['']);
124
                                                                                                                                               });
125
126
$(document).ready(function(){
127
        $.datepicker.setDefaults({
128
             showOn: "both",
129
             changeMonth: true,
130
             changeYear: true,
131
             buttonImage: '/[% interface %]/prog/img/famfamfam/silk/calendar.png',
132
             buttonImageOnly: true,
133
             showButtonPanel: true,
134
             showOtherMonths: true,
135
             selectOtherMonths: true
136
        });
137
        $( ".datepicker" ).datepicker({
138
             onClose: function(dateText, inst) {
139
             validate_date(dateText, inst);
140
             },
141
        }).on("change", function(e, value) {
142
        if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");}
143
        });
144
       // http://jqueryui.com/demos/datepicker/#date-range
145
            var dates = $( ".datepickerfrom, .datepickerto" ).datepicker({
146
            changeMonth: true,
147
            numberOfMonths: 1,
148
            onSelect: function( selectedDate ) {
149
            var option = this.id == "from" ? "minDate" : "maxDate",
150
            instance = $( this ).data( "datepicker" );
151
            date = $.datepicker.parseDate(
152
                   instance.settings.dateFormat ||
153
                   $.datepicker._defaults.dateFormat,
154
                   selectedDate, instance.settings );
155
                   dates.not( this ).datepicker( "option", option, date );
156
            },
157
            onClose: function(dateText, inst) {
158
                 validate_date(dateText, inst);
159
            },
160
            }).on("change", function(e, value) {
161
            if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");}
162
            });
163
});
164
//]]>
165
</script>
166
167
168
<script type="text/javascript">
10
<script type="text/javascript">
169
    var MSG_CATEGORYCODE_CHARS=(_("Please only enter letters into this field."));
11
    var MSG_CATEGORYCODE_CHARS=(_("Please only enter letters into this field."));
170
    var MSG_ONE_ENROLLMENTPERIOD =(_("Please choose an enrollment period in months OR by date."));
12
    var MSG_ONE_ENROLLMENTPERIOD =(_("Please choose an enrollment period in months OR by date."));
171
    var MSG_ONLY_ONE_ENROLLMENTPERIOD=(_("Please only choose one enrolment period."));
13
    var MSG_ONLY_ONE_ENROLLMENTPERIOD=(_("Please only choose one enrolment period."));
172
</script>
173
174
<script type="text/javascript">
175
jQuery.validator.addMethod( "category_code_check", function(value,element){
176
     var patt = /[0-9A-Za-z]{1,10}$/g;
177
     if (patt.test(element.value)) {
178
              return true;
179
     } else {
180
              return false;
181
     }
182
   }, MSG_CATEGORYCODE_CHARS
183
);
184
14
185
jQuery.validator.addMethod( "enrollment_period", function(){
15
jQuery.validator.addMethod( "enrollment_period", function(){
186
      enrolmentperiod = $("#enrolmentperiod").val();
16
      enrolmentperiod = $("#enrolmentperiod").val();
Lines 190-261 jQuery.validator.addMethod( "enrollment_period", function(){ Link Here
190
      } else {
20
      } else {
191
             return true;
21
             return true;
192
      }
22
      }
193
    }, MSG_ONLY_ONE_ENROLLMENTPERIOD
23
    }, MSG_ONE_ENROLLMENTPERIOD
194
);
24
);
195
196
$(document).ready(function() {
197
      $("#enrolmentperioddate").datepicker({
198
            minDate: 1
199
      }); // Require that "until date" be in the future
200
      if ($("#branches option:selected").length < 1) {
201
          $("#branches option:first").attr("selected", "selected");
202
      }
203
      $("#categorycode").on("blur",function(){
204
           toUC(this);
205
      });
206
      $("#category_form").validate({
207
                rules: {
208
                     categorycode: {
209
                            required: true,
210
                            category_code_check: true
211
                     },
212
                     description: {
213
                            required:true,
214
                     },
215
                     enrolmentperiod: {
216
                           required: function(element){
217
                                 return $("#enrolmentperioddate").val() === "";
218
                           },
219
                           digits: true,
220
                           enrollment_period: true,
221
                    },
222
                     enrolmentperioddate: {
223
                            required: function(element){
224
                               return $("#enrolmentperiod").val() === "";
225
                            },
226
                            enrollment_period: true,
227
                    },
228
                     dateofbirthrequired: {
229
                             digits: true
230
                     },
231
                     upperagelimit: {
232
                             digits: true
233
                     },
234
                     enrolmentfee: {
235
                             number: true
236
                     },
237
                     reservefee: {
238
                             number: true
239
                     },
240
                     category_type: {
241
                             required: true
242
                    }
243
                },
244
                messages: {
245
                      categorycode: {
246
                            required:  MSG_CATEGORYCODE_CHARS
247
                      },
248
                      enrolmentperiod: {
249
                             required: MSG_ONE_ENROLLMENTPERIOD
250
                      },
251
                      enrolmentperioddate: {
252
                             required: MSG_ONE_ENROLLMENTPERIOD
253
                      }
254
                }
255
       });
256
});
257
258
</script>
25
</script>
26
<script type="text/javascript" src="[% themelang %]/js/categories.js"></script>
259
</head>
27
</head>
260
28
261
[% 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-->
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-->
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep3.tt (-30 / +20 lines)
Lines 7-45 Link Here
7
[% INCLUDE 'installer-doc-head-close.inc' %]
7
[% INCLUDE 'installer-doc-head-close.inc' %]
8
[% INCLUDE 'calendar.inc' %]
8
[% INCLUDE 'calendar.inc' %]
9
[% INCLUDE 'datatables.inc' %]
9
[% INCLUDE 'datatables.inc' %]
10
[% INCLUDE 'js_includes.inc' %]
10
11
11
<head>
12
<head>
12
<title>Create Koha administrator patron</title>
13
<title>Create Koha administrator patron</title>
13
14
<!--jQuery scripts for creating patron-->
14
<!--jQuery scripts for creating patron-->
15
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.fixFloat.js"></script>
15
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.fixFloat.js"></script>
16
17
<script type="text/javascript">
16
<script type="text/javascript">
18
     var MSG_PASSWORD_MISMATCH=(_("The entered passwords do not match, please rewrite them"));
17
     var MSG_PASSWORD_MISMATCH=(_("The entered passwords do not match, please rewrite them"));
19
</script>
18
     jQuery.validator.addMethod( "password_match", function(value,element){
20
21
22
23
<script type="text/javascript">
24
jQuery.validator.addMethod( "password_match", function(value,element){
25
        var MSG_PASSWORD_MISMATCH = (_("The passwords entered do not match"));
26
        var password = document.getElementById('password').value
19
        var password = document.getElementById('password').value
27
        var confirmpassword = document.getElementById('password2').value
20
        var confirmpassword = document.getElementById('password2').value
28
29
        if ( password != confirmpassword ){
21
        if ( password != confirmpassword ){
30
               return false;
22
                return false;
31
          }
23
        }
32
          else{
24
        else{
33
               return true
25
                return true
34
          }
26
        }
35
    },  MSG_PASSWORD_MISMATCH
27
     },  MSG_PASSWORD_MISMATCH
36
);
28
);
37
29
38
$(document).ready(function(){
30
$(document).ready(function(){
39
31
   $("#Submit").click(function(){
40
    $("#Submit").click(function(){
32
      $("#createpatron").validate({
41
        $("#createpatron").validate({
33
        rules: {
42
         rules: {
43
            surname: {
34
            surname: {
44
                required: true,
35
                required: true,
45
            },
36
            },
Lines 49-66 $(document).ready(function(){ Link Here
49
            cardnumber: {
40
            cardnumber: {
50
                required: true,
41
                required: true,
51
            },
42
            },
52
           password: {
43
            password: {
53
                 password_match:true
44
                 password_match:true
54
            }
45
            }
55
         },
46
        },
56
         messages: {
47
        messages: {
57
            password: {
48
           password: {
58
                 required: MSG_PASSWORD_MISMATCH
49
                 required: MSG_PASSWORD_MISMATCH
59
            },
50
           },
60
         }
51
        }
61
52
      });
62
     });
53
   });
63
});
64
});
54
});
65
</script>
55
</script>
66
</head>
56
</head>
Lines 184-190 $(document).ready(function(){ Link Here
184
                    <ol>
174
                    <ol>
185
                    <h3>OPAC/Staff Login</h3>
175
                    <h3>OPAC/Staff Login</h3>
186
                        <li>
176
                        <li>
187
                            <input type="hidden" name="BorrowerMandatoryField" value = [% BorrowerMandatoryField %] />
177
                            <input type="hidden" name="BorrowerMandatoryField" value = "[% BorrowerMandatoryField %]" />
188
                            <label for="userid" class="required">Username: </label>
178
                            <label for="userid" class="required">Username: </label>
189
                            <input type="text" name="userid" id ="userid" size="20" title="Please only enter a username of letters and numbers" value="[% userid |html %]" class="required" required="required" />
179
                            <input type="text" name="userid" id ="userid" size="20" title="Please only enter a username of letters and numbers" value="[% userid |html %]" class="required" required="required" />
190
                            <span class="required">Required</span>
180
                            <span class="required">Required</span>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/summary.tt (-41 lines)
Lines 1-41 Link Here
1
[% USE Koha %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha Tutorial Summary</title>
4
[% INCLUDE 'doc-head-close.inc' %]
5
</head>
6
<body id="admin_admin-home" class="admin">
7
[% INCLUDE 'header.inc' %]
8
[% INCLUDE 'cat-search.inc' %]
9
10
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; Summary</div>
11
12
<div id="doc" class="yui-t7">
13
    <div id="bd">
14
        <div id="yui-main" class="sysprefs">
15
            <div class="yui-g"><h1>Tutorial Summary Page</h1></div>
16
            <fieldset style="font-size:120%">
17
            <h2>Library</h2>
18
            <p> To add another library and for more settings, go to </br>
19
            More -> Administration -> Libraries and groups </p> OR<br>
20
21
            <h2>Patron Category</h2>
22
            <p>To add another patron category and for more settings, go to</br>
23
            More -> Administration -> Patron Categories</p> OR <br>
24
25
            <h2>Patron</h2>
26
            <p>To create another patron, go to Patrons -> New Patron. To set the </br>
27
            permissions of the patron, go to the patron's page and More -> Set Permissions</p>
28
29
            <h2>Item Type</h2>
30
            <p>To create another item type and for more settings, go to</br>
31
            More -> Administration -> Item types </p> OR <br>
32
33
            <h2>Circulation Rule</h2>
34
            <p>To create another circulation rule, go to </br>
35
            More -> Administration -> Circulation and Fine Rules</p>
36
            </fieldset>
37
38
        </div>
39
    </div>
40
</div>
41
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/summary.pl (-44 lines)
Lines 1-43 Link Here
1
#!/usr/bin/perl
2
3
# Copyright Pat Eyler 2003
4
# Copyright Biblibre 2006
5
# Parts Copyright Liblime 2008
6
# Parts Copyright Chris Nighswonger 2010
7
#
8
# This file is part of Koha.
9
#
10
# Koha is free software; you can redistribute it and/or modify it
11
# under the terms of the GNU General Public License as published by
12
# the Free Software Foundation; either version 3 of the License, or
13
# (at your option) any later version.
14
#
15
# Koha is distributed in the hope that it will be useful, but
16
# WITHOUT ANY WARRANTY; without even the implied warranty of
17
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
# GNU General Public License for more details.
19
#
20
# You should have received a copy of the GNU General Public License
21
# along with Koha; if not, see <http://www.gnu.org/licenses>.
22
23
use Modern::Perl;
24
use CGI qw ( -utf8 );
25
use C4::Auth;
26
use C4::Output;
27
use C4::Context;
28
use C4::Koha;
29
30
my $query = new CGI;
31
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
32
    {
33
        template_name   => "summary.tt",
34
        query           => $query,
35
        type            => "intranet",
36
        authnotrequired => 0,
37
        flagsrequired   => { catalogue => 1 },
38
        debug           => 1,
39
    }
40
);
41
42
43
output_html_with_http_headers $query, $cookie, $template->output;
44
- 

Return to bug 17855