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

(-)a/installer/data/mysql/en/mandatory/class_sources.sql (-3 / +3 lines)
Lines 1-4 Link Here
1
-- 
1
--
2
-- Default classification sources and filing rules
2
-- Default classification sources and filing rules
3
-- for Koha.
3
-- for Koha.
4
--
4
--
Lines 10-20 Link Here
10
-- terms of the GNU General Public License as published by the Free Software
10
-- terms of the GNU General Public License as published by the Free Software
11
-- Foundation; either version 2 of the License, or (at your option) any later
11
-- Foundation; either version 2 of the License, or (at your option) any later
12
-- version.
12
-- version.
13
-- 
13
--
14
-- Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14
-- Koha is distributed in the hope that it will be useful, but WITHOUT ANY
15
-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15
-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16
-- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
16
-- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
17
-- 
17
--
18
-- You should have received a copy of the GNU General Public License along
18
-- You should have received a copy of the GNU General Public License along
19
-- with Koha; if not, write to the Free Software Foundation, Inc.,
19
-- with Koha; if not, write to the Free Software Foundation, Inc.,
20
-- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
-- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
(-)a/installer/data/mysql/en/optional/csv_profiles.sql (-1 / +1 lines)
Lines 1-2 Link Here
1
INSERT IGNORE INTO export_format( profile, description, content, csv_separator, type ) 
1
INSERT IGNORE INTO export_format( profile, description, content, csv_separator, type )
2
VALUES ( "issues to claim", "default CSV export for serial issue claims", "SUPPLIER=aqbooksellers.name|TITLE=subscription.title|ISSUE NUMBER=serial.serialseq|LATE SINCE=serial.planneddate", ",", "sql" );
2
VALUES ( "issues to claim", "default CSV export for serial issue claims", "SUPPLIER=aqbooksellers.name|TITLE=subscription.title|ISSUE NUMBER=serial.serialseq|LATE SINCE=serial.planneddate", ",", "sql" );
(-)a/installer/data/mysql/en/optional/csv_profiles.txt (-2 lines)
Lines 1-3 Link Here
1
CSV profiles
2
3
Default CSV export profiles; including one for exporting serial claims.
1
Default CSV export profiles; including one for exporting serial claims.
(-)a/installer/data/mysql/en/mandatory/message_transport_types.txt (-1 lines)
Lines 1-2 Link Here
1
Defines default message transports for email and sms.
1
Defines default message transports for email and sms.
2
(-)a/installer/data/mysql/en/default/patron_attributes.txt (+1 lines)
Line 0 Link Here
1
Patron attributes
(-)a/installer/data/mysql/en/mandatory/sample_notices_message_attributes.sql (-1 lines)
Lines 6-9 values Link Here
6
(4, 'Hold_Filled', 0),
6
(4, 'Hold_Filled', 0),
7
(5, 'Item_Check_in', 0),
7
(5, 'Item_Check_in', 0),
8
(6, 'Item_Checkout', 0);
8
(6, 'Item_Checkout', 0);
9
(-)a/installer/data/mysql/en/marcflavour/marc21/default/authorities_normal_marc21.txt (+9 lines)
Line 0 Link Here
1
Default MARC21 Standard Authority types:
2
	Personal Name
3
	Corporate Name
4
	Meeting Name
5
	Uniform Title
6
	Chronological Term
7
	Topical Term
8
	Geographic Name
9
	Genre/Form Term
(-)a/installer/data/mysql/en/marcflavour/marc21/optional/marc21_default_matching_rules.sql (-9 / +9 lines)
Lines 1-4 Link Here
1
-- 
1
--
2
-- Default MARC matching rules for Koha
2
-- Default MARC matching rules for Koha
3
--
3
--
4
-- Copyright (C) 2007 LiblimeA
4
-- Copyright (C) 2007 LiblimeA
Lines 9-39 Link Here
9
-- terms of the GNU General Public License as published by the Free Software
9
-- terms of the GNU General Public License as published by the Free Software
10
-- Foundation; either version 2 of the License, or (at your option) any later
10
-- Foundation; either version 2 of the License, or (at your option) any later
11
-- version.
11
-- version.
12
-- 
12
--
13
-- Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
-- Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14
-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15
-- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
-- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
16
-- 
16
--
17
-- You should have received a copy of the GNU General Public License along
17
-- You should have received a copy of the GNU General Public License along
18
-- with Koha; if not, write to the Free Software Foundation, Inc.,
18
-- with Koha; if not, write to the Free Software Foundation, Inc.,
19
-- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
-- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
20
21
INSERT INTO marc_matchers (code, description, record_type, threshold) 
21
INSERT INTO marc_matchers (code, description, record_type, threshold)
22
    VALUES ('ISBN', '020$a', 'biblio', 1000);
22
    VALUES ('ISBN', '020$a', 'biblio', 1000);
23
INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'isbn', 1000 FROM marc_matchers;
23
INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'isbn', 1000 FROM marc_matchers;
24
INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints;
24
INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints;
25
INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields) 
25
INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields)
26
    SELECT MAX(matchpoint_id), 1, '020', 'a' FROM matchpoints;
26
    SELECT MAX(matchpoint_id), 1, '020', 'a' FROM matchpoints;
27
INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine) 
27
INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine)
28
    SELECT MAX(matchpoint_component_id), 1, 'ISBN' FROM matchpoint_components;
28
    SELECT MAX(matchpoint_component_id), 1, 'ISBN' FROM matchpoint_components;
29
29
30
INSERT INTO marc_matchers (code, description, record_type, threshold) 
30
INSERT INTO marc_matchers (code, description, record_type, threshold)
31
    VALUES ('ISSN', '022$a', 'biblio', 1000);
31
    VALUES ('ISSN', '022$a', 'biblio', 1000);
32
INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'issn', 1000 FROM marc_matchers;
32
INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'issn', 1000 FROM marc_matchers;
33
INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints;
33
INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints;
34
INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields) 
34
INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields)
35
    SELECT MAX(matchpoint_id), 1, '022', 'a' FROM matchpoints;
35
    SELECT MAX(matchpoint_id), 1, '022', 'a' FROM matchpoints;
36
INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine) 
36
INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine)
37
    SELECT MAX(matchpoint_component_id), 1, 'ISSN' FROM matchpoint_components;
37
    SELECT MAX(matchpoint_component_id), 1, 'ISSN' FROM matchpoint_components;
38
38
39
INSERT INTO marc_matchers (code, description, record_type, threshold)
39
INSERT INTO marc_matchers (code, description, record_type, threshold)
(-)a/installer/data/mysql/en/marcflavour/marc21/optional/marc21_default_matching_rules.txt (-4 / +1 lines)
Lines 1-5 Link Here
1
Selected matching rules for MARC 21 bibliographic
1
Selected matching rules for MARC 21 bibliographic
2
records, including:
2
records, including: ISBN, ISSN
3
4
ISBN
5
ISSN
(-)a/installer/data/mysql/en/marcflavour/marc21/optional/marc21_simple_bib_frameworks.txt (-1 lines)
Lines 1-5 Link Here
1
Simple MARC 21 bibliographic frameworks for some common types of bibliographic material.  Frameworks are used to define the structure of your MARC records and the behavior of the integrated MARC editor. You can change these at any time after installation. The frameworks in this optional default setting include:
1
Simple MARC 21 bibliographic frameworks for some common types of bibliographic material.  Frameworks are used to define the structure of your MARC records and the behavior of the integrated MARC editor. You can change these at any time after installation. The frameworks in this optional default setting include:
2
3
BKS	Books, Booklets, Workbooks
2
BKS	Books, Booklets, Workbooks
4
CF	CD-ROMs, DVD-ROMs, General Online Resources
3
CF	CD-ROMs, DVD-ROMs, General Online Resources
5
SR	Audio Cassettes, CDs
4
SR	Audio Cassettes, CDs
(-)a/installer/data/mysql/en/marcflavour/marc21/mandatory/authorities_normal_marc21.txt (-11 lines)
Lines 1-11 Link Here
1
Default MARC21 Standard Authority types:
2
3
	Personal Name 
4
	Corporate Name 
5
	Meeting Name 
6
	Uniform Title 
7
	Chronological Term 
8
	Topical Term 
9
	Geographic Name 
10
	Genre/Form Term 
11
(-)a/installer/data/mysql/en/marcflavour/unimarc/mandatory/authorities_normal_unimarc.sql (-2 lines)
Lines 819-823 INSERT INTO `auth_subfield_structure` (`authtypecode`, `tagfield`, `tagsubfield` Link Here
819
		('', '886', '2', 'System Code', 'System Code', 0, 0, 8, '', '', '', 0, -5, 0, '', ''),
819
		('', '886', '2', 'System Code', 'System Code', 0, 0, 8, '', '', '', 0, -5, 0, '', ''),
820
		('', '886', 'a', 'Tag of the Source Format Field', 'Tag of the Source Format Field', 1, 0, 8, '', '', '', 0, -5, 0, '', ''),
820
		('', '886', 'a', 'Tag of the Source Format Field', 'Tag of the Source Format Field', 1, 0, 8, '', '', '', 0, -5, 0, '', ''),
821
		('', '886', 'b', 'Indicators and Subfields of the Source Format Field', 'Indicators and Subfields of the Source Format Field', 1, 0, 8, '', '', '', 0, -5, 0, '', '');
821
		('', '886', 'b', 'Indicators and Subfields of the Source Format Field', 'Indicators and Subfields of the Source Format Field', 1, 0, 8, '', '', '', 0, -5, 0, '', '');
822
823
(-)a/installer/data/mysql/en/marcflavour/unimarc/default/authorities_normal_unimarc.txt (+1 lines)
Line 0 Link Here
1
 Authority structure for UNIMARC in English.
(-)a/installer/data/mysql/en/marcflavour/unimarc/mandatory/unimarc_framework_DEFAULT.sql (-5 / +5 lines)
Lines 23-29 Link Here
23
23
24
-- From Zeno Tajoli (2010-08-12):
24
-- From Zeno Tajoli (2010-08-12):
25
--
25
--
26
-- Improved default id Koha field (090) and koha date field (099). 
26
-- Improved default id Koha field (090) and koha date field (099).
27
-- Insert link to sql coloum biblio.biblionumber in tag 001
27
-- Insert link to sql coloum biblio.biblionumber in tag 001
28
-- Insert the use of 942, local data
28
-- Insert the use of 942, local data
29
-- Insert a standard minimun on 995 (holding field)
29
-- Insert a standard minimun on 995 (holding field)
Lines 72-78 Link Here
72
insert  into `marc_tag_structure`(`tagfield`,`liblibrarian`,`libopac`,`repeatable`,`mandatory`,`authorised_value`,`frameworkcode`) values
72
insert  into `marc_tag_structure`(`tagfield`,`liblibrarian`,`libopac`,`repeatable`,`mandatory`,`authorised_value`,`frameworkcode`) values
73
	('090','System Control Numbers (Koha)','System Control Numbers (Koha)',0,0,'','');
73
	('090','System Control Numbers (Koha)','System Control Numbers (Koha)',0,0,'','');
74
74
75
insert  into `marc_subfield_structure`(`tagfield`,`tagsubfield`,`liblibrarian`,`libopac`,`repeatable`,`mandatory`,`kohafield`,`tab`,`authorised_value`,`authtypecode`,`value_builder`,`isurl`,`hidden`,`frameworkcode`,`seealso`,`link`,`defaultvalue`) values 
75
insert  into `marc_subfield_structure`(`tagfield`,`tagsubfield`,`liblibrarian`,`libopac`,`repeatable`,`mandatory`,`kohafield`,`tab`,`authorised_value`,`authtypecode`,`value_builder`,`isurl`,`hidden`,`frameworkcode`,`seealso`,`link`,`defaultvalue`) values
76
	('090','a','Koha biblioitem number (autogenerated)','Koha biblioitem number (autogenerated)',0,0,'biblioitems.biblioitemnumber',9,'','','',0,-5,'',NULL,'','');
76
	('090','a','Koha biblioitem number (autogenerated)','Koha biblioitem number (autogenerated)',0,0,'biblioitems.biblioitemnumber',9,'','','',0,-5,'',NULL,'','');
77
77
78
-- Local date field/Subfields (099)
78
-- Local date field/Subfields (099)
Lines 80-88 insert into `marc_subfield_structure`(`tagfield`,`tagsubfield`,`liblibrarian`,` Link Here
80
insert  into `marc_tag_structure`(`tagfield`,`liblibrarian`,`libopac`,`repeatable`,`mandatory`,`authorised_value`,`frameworkcode`) values
80
insert  into `marc_tag_structure`(`tagfield`,`liblibrarian`,`libopac`,`repeatable`,`mandatory`,`authorised_value`,`frameworkcode`) values
81
	('099','local dates','',0,0,'','');
81
	('099','local dates','',0,0,'','');
82
82
83
insert  into `marc_subfield_structure`(`tagfield`,`tagsubfield`,`liblibrarian`,`libopac`,`repeatable`,`mandatory`,`kohafield`,`tab`,`authorised_value`,`authtypecode`,`value_builder`,`isurl`,`hidden`,`frameworkcode`,`seealso`,`link`,`defaultvalue`) values 
83
insert  into `marc_subfield_structure`(`tagfield`,`tagsubfield`,`liblibrarian`,`libopac`,`repeatable`,`mandatory`,`kohafield`,`tab`,`authorised_value`,`authtypecode`,`value_builder`,`isurl`,`hidden`,`frameworkcode`,`seealso`,`link`,`defaultvalue`) values
84
	('099','c','Date of creation (bib. record)','Date of creation (bib. record)',0,0,'biblio.datecreated',0,'','','',0,-5,'',NULL,'','');
84
	('099','c','Date of creation (bib. record)','Date of creation (bib. record)',0,0,'biblio.datecreated',0,'','','',0,-5,'',NULL,'','');
85
 
85
86
insert  into `marc_subfield_structure`(`tagfield`,`tagsubfield`,`liblibrarian`,`libopac`,`repeatable`,`mandatory`,`kohafield`,`tab`,`authorised_value`,`authtypecode`,`value_builder`,`isurl`,`hidden`,`frameworkcode`,`seealso`,`link`,`defaultvalue`) values
86
insert  into `marc_subfield_structure`(`tagfield`,`tagsubfield`,`liblibrarian`,`libopac`,`repeatable`,`mandatory`,`kohafield`,`tab`,`authorised_value`,`authtypecode`,`value_builder`,`isurl`,`hidden`,`frameworkcode`,`seealso`,`link`,`defaultvalue`) values
87
	('099','d','Last modified date (bib. record)','Last modified data (bib. record)',0,0,'biblio.timestamp',0,'','','',0,-5,'',NULL,'','');
87
	('099','d','Last modified date (bib. record)','Last modified data (bib. record)',0,0,'biblio.timestamp',0,'','','',0,-5,'',NULL,'','');
88
88
Lines 151-157 INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian` Link Here
151
		('995', 'r', 'Type of item and material', 'Type of item and material', 0, 1, 'items.itype', 10, 'itemtypes', '', '', 0, 0, '', '', '', NULL),
151
		('995', 'r', 'Type of item and material', 'Type of item and material', 0, 1, 'items.itype', 10, 'itemtypes', '', '', 0, 0, '', '', '', NULL),
152
		('995', 'u', 'Copy note', 'Copy note', 0, 0, 'items.itemnotes', 10, '', '', '', 0, 0, '', '', '', NULL),
152
		('995', 'u', 'Copy note', 'Copy note', 0, 0, 'items.itemnotes', 10, '', '', '', 0, 0, '', '', '', NULL),
153
		('995', 'v', 'Serial Enumeration / chronology', 'Serial Enumeration / chronology', 0, 0, 'items.enumchron', 10, '', '', '', 0, -1, '', '', '', NULL);
153
		('995', 'v', 'Serial Enumeration / chronology', 'Serial Enumeration / chronology', 0, 0, 'items.enumchron', 10, '', '', '', 0, -1, '', '', '', NULL);
154
 
154
155
155
156
156
157
-- *******************************************************
157
-- *******************************************************
(-)a/installer/data/mysql/en/marcflavour/unimarc/mandatory/authorities_normal_unimarc.txt (-1 lines)
Line 1 Link Here
1
Authority structure for UNIMARC in English.
(-)a/installer/data/mysql/en/optional/patron_categories.sql (-1 / +1 lines)
Lines 1-4 Link Here
1
INSERT INTO `categories` (`categorycode`, `description`, `enrolmentperiod`, `upperagelimit`, `dateofbirthrequired`, `finetype`, `bulk`, `enrolmentfee`, `overduenoticerequired`, `issuelimit`, `reservefee`, `category_type`) VALUES 
1
INSERT INTO `categories` (`categorycode`, `description`, `enrolmentperiod`, `upperagelimit`, `dateofbirthrequired`, `finetype`, `bulk`, `enrolmentfee`, `overduenoticerequired`, `issuelimit`, `reservefee`, `category_type`) VALUES
2
2
3
-- Adult Patrons
3
-- Adult Patrons
4
('PT','Patron',99,999,18,NULL,NULL,'0.000000',1,NULL,'0.000000','A'),
4
('PT','Patron',99,999,18,NULL,NULL,'0.000000',1,NULL,'0.000000','A'),
(-)a/installer/data/mysql/en/optional/patron_categories.txt (-5 / +1 lines)
Lines 1-6 Link Here
1
Sample patron types and categories: 
1
Sample patron types and categories. Types are currently hardcoded but you can manage categories after installation from the administration module.
2
3
Type:           Categories:
4
2
5
Adult patron - default patron type
3
Adult patron - default patron type
6
                PT  - Patron
4
                PT  - Patron
Lines 21-25 Professional - a member of an organization (organization is guarantor) Link Here
21
                T   - Teacher
19
                T   - Teacher
22
                S   - Staff
20
                S   - Staff
23
                B   - Board
21
                B   - Board
24
25
Types are currently hardcoded, but you can add/edit/delete categories after installation from the administration module.
(-)a/installer/data/mysql/en/optional/sample_holidays.txt (-4 / +1 lines)
Lines 1-4 Link Here
1
Sample holidays:
1
Sample holidays: Sunday, Christmas, New Year's
2
	Sundays
3
	Christmas
4
	New Year's
(-)a/installer/data/mysql/en/optional/sample_libraries.txt (-1 / +1 lines)
Line 1 Link Here
1
A few sample libraries.
1
Sample libraries.
(-)a/installer/data/mysql/en/optional/sample_z3950_servers.txt (+1 lines)
Lines 1-3 Link Here
1
Allow access to the following servers to search and download record information:
1
LIBRARY OF CONGRESS
2
LIBRARY OF CONGRESS
2
LIBRARY OF CONGRESS NAMES (authority records)
3
LIBRARY OF CONGRESS NAMES (authority records)
3
LIBRARY OF CONGRESS SUBJECTS (authority records)
4
LIBRARY OF CONGRESS SUBJECTS (authority records)
(-)a/installer/install.pl (-147 / +216 lines)
Lines 1-5 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
2
3
# This file is part of Koha.
4
#
5
# Copyright (C) YEAR  YOURNAME-OR-YOUREMPLOYER
6
#
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
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
3
use strict;
20
use strict;
4
use warnings;
21
use warnings;
5
use diagnostics;
22
use diagnostics;
Lines 40-49 if ( defined($language) ) { Link Here
40
my $installer = C4::Installer->new();
57
my $installer = C4::Installer->new();
41
my %info;
58
my %info;
42
$info{'dbname'} = C4::Context->config("database");
59
$info{'dbname'} = C4::Context->config("database");
43
$info{'dbms'} =
60
$info{'dbms'}   = (
44
  (   C4::Context->config("db_scheme")
61
      C4::Context->config("db_scheme")
45
    ? C4::Context->config("db_scheme")
62
    ? C4::Context->config("db_scheme")
46
    : "mysql" );
63
    : "mysql"
64
);
47
$info{'hostname'} = C4::Context->config("hostname");
65
$info{'hostname'} = C4::Context->config("hostname");
48
$info{'port'}     = C4::Context->config("port");
66
$info{'port'}     = C4::Context->config("port");
49
$info{'user'}     = C4::Context->config("user");
67
$info{'user'}     = C4::Context->config("user");
Lines 55-66 my $dbh = DBI->connect( Link Here
55
);
73
);
56
74
57
if ( $step && $step == 1 ) {
75
if ( $step && $step == 1 ) {
76
58
    #First Step (for both fresh installations and upgrades)
77
    #First Step (for both fresh installations and upgrades)
59
    #Checking ALL perl Modules and services needed are installed.
78
    #Checking ALL perl Modules and services needed are installed.
60
    #Whenever there is an error, adding a report to the page
79
    #Whenever there is an error, adding a report to the page
61
    my $op = $query->param('op') || 'noop';
80
    my $op = $query->param('op') || 'noop';
62
    $template->param( language => 1 );
81
    $template->param( language      => 1 );
63
    $template->param( 'checkmodule' => 1 ); # we start with the assumption that there are no problems and set this to 0 if there are
82
    $template->param( 'checkmodule' => 1 )
83
      ; # we start with the assumption that there are no problems and set this to 0 if there are
64
84
65
    unless ( $] >= 5.010000 ) {    # Bug 7375
85
    unless ( $] >= 5.010000 ) {    # Bug 7375
66
        $template->param( problems => 1, perlversion => 1, checkmodule => 0 );
86
        $template->param( problems => 1, perlversion => 1, checkmodule => 0 );
Lines 70-80 if ( $step && $step == 1 ) { Link Here
70
    $perl_modules->version_info;
90
    $perl_modules->version_info;
71
91
72
    my $modules = $perl_modules->get_attr('missing_pm');
92
    my $modules = $perl_modules->get_attr('missing_pm');
73
    if (scalar(@$modules)) {
93
    if ( scalar(@$modules) ) {
74
        my @components = ();
94
        my @components  = ();
75
        my $checkmodule = 1;
95
        my $checkmodule = 1;
76
        foreach (@$modules) {
96
        foreach (@$modules) {
77
            my ($module, $stats) = each %$_;
97
            my ( $module, $stats ) = each %$_;
78
            $checkmodule = 0 if $stats->{'required'};
98
            $checkmodule = 0 if $stats->{'required'};
79
            push(
99
            push(
80
                @components,
100
                @components,
Lines 86-99 if ( $step && $step == 1 ) { Link Here
86
                }
106
                }
87
            );
107
            );
88
        }
108
        }
89
        @components = sort {$a->{'name'} cmp $b->{'name'}} @components;
109
        @components = sort { $a->{'name'} cmp $b->{'name'} } @components;
90
        $template->param( missing_modules => \@components, checkmodule => $checkmodule, op => $op );
110
        $template->param(
111
            missing_modules => \@components,
112
            checkmodule     => $checkmodule,
113
            op              => $op
114
        );
91
    }
115
    }
92
}
116
}
93
elsif ( $step && $step == 2 ) {
117
elsif ( $step && $step == 2 ) {
94
#
118
95
#STEP 2 Check Database connection and access
119
    #STEP 2 Check Database connection and access
96
#
120
97
    $template->param(%info);
121
    $template->param(%info);
98
    my $checkdb = $query->param("checkdb");
122
    my $checkdb = $query->param("checkdb");
99
    $template->param( 'dbconnection' => $checkdb );
123
    $template->param( 'dbconnection' => $checkdb );
Lines 118-124 elsif ( $step && $step == 2 ) { Link Here
118
                my $grantaccess;
142
                my $grantaccess;
119
                while ( my ($line) = $rq->fetchrow ) {
143
                while ( my ($line) = $rq->fetchrow ) {
120
                    my $dbname = $info{dbname};
144
                    my $dbname = $info{dbname};
121
                    if ( $line =~ m/^GRANT (.*?) ON `$dbname`\.\*/ || index( $line, '*.*' ) > 0 ) {
145
                    if ( $line =~ m/^GRANT (.*?) ON `$dbname`\.\*/
146
                        || index( $line, '*.*' ) > 0 )
147
                    {
122
                        $grantaccess = 1
148
                        $grantaccess = 1
123
                          if (
149
                          if (
124
                            index( $line, 'ALL PRIVILEGES' ) > 0
150
                            index( $line, 'ALL PRIVILEGES' ) > 0
Lines 153-175 elsif ( $step && $step == 2 ) { Link Here
153
                    }
179
                    }
154
                }
180
                }
155
                $template->param( "checkgrantaccess" => $grantaccess );
181
                $template->param( "checkgrantaccess" => $grantaccess );
156
            }	# End mysql connect check...
182
            }    # End mysql connect check...
157
183
158
	    elsif ( $info{dbms} eq "Pg" ) {
184
            elsif ( $info{dbms} eq "Pg" ) {
159
		# Check if database has been created...
185
160
		my $rv = $dbh->do( "SELECT * FROM pg_catalog.pg_database WHERE datname = \'$info{dbname}\';" );
186
                # Check if database has been created...
161
		if ( $rv == 1 )	{
187
                my $rv = $dbh->do(
162
			$template->param( 'checkdatabasecreated' => 1 );
188
"SELECT * FROM pg_catalog.pg_database WHERE datname = \'$info{dbname}\';"
163
		}
189
                );
164
190
                if ( $rv == 1 ) {
165
		# Check if user has all necessary grants on this database...
191
                    $template->param( 'checkdatabasecreated' => 1 );
166
		my $rq = $dbh->do( "SELECT u.usesuper
192
                }
167
				    FROM pg_catalog.pg_user as u
193
168
				    WHERE u.usename = \'$info{user}\';" );
194
                # Check if user has all necessary grants on this database...
169
		if ( $rq == 1 ) {
195
                my $rq = $dbh->do(
170
			$template->param( "checkgrantaccess" => 1 );
196
                    "SELECT u.usesuper
171
		}
197
            FROM pg_catalog.pg_user as u
172
            }	# End Pg connect check...
198
            WHERE u.usename = \'$info{user}\';"
199
                );
200
                if ( $rq == 1 ) {
201
                    $template->param( "checkgrantaccess" => 1 );
202
                }
203
            }    # End Pg connect check...
173
        }
204
        }
174
        else {
205
        else {
175
            $template->param( "error" => DBI::err, "message" => DBI::errstr );
206
            $template->param( "error" => DBI::err, "message" => DBI::errstr );
Lines 177-187 elsif ( $step && $step == 2 ) { Link Here
177
    }
208
    }
178
}
209
}
179
elsif ( $step && $step == 3 ) {
210
elsif ( $step && $step == 3 ) {
180
#
211
181
#
212
    # STEP 3 : database setup
182
# STEP 3 : database setup
213
183
#
184
#
185
    my $op = $query->param('op');
214
    my $op = $query->param('op');
186
    if ( $op && $op eq 'finished' ) {
215
    if ( $op && $op eq 'finished' ) {
187
        #
216
        #
Lines 193-210 elsif ( $step && $step == 3 ) { Link Here
193
    elsif ( $op && $op eq 'finish' ) {
222
    elsif ( $op && $op eq 'finish' ) {
194
        $installer->set_version_syspref();
223
        $installer->set_version_syspref();
195
224
196
        # Installation is finished.
225
# Installation is finished.
197
        # We just deny anybody access to install
226
# We just deny anybody access to install
198
        # And we redirect people to mainpage.
227
# And we redirect people to mainpage.
199
        # The installer will have to relogin since we do not pass cookie to redirection.
228
# The installer will have to relogin since we do not pass cookie to redirection.
200
        $template->param( "$op" => 1 );
229
        $template->param( "$op" => 1 );
201
    }
230
    }
231
202
    elsif ( $op && $op eq 'addframeworks' ) {
232
    elsif ( $op && $op eq 'addframeworks' ) {
203
    #
204
    # 1ST install, 3rd sub-step : insert the SQL files the user has selected
205
    #
206
233
207
        my ($fwk_language, $list) = $installer->load_sql_in_order($all_languages, $query->param('framework'));
234
        # 1ST install, 3rd sub-step : insert the SQL files the user has selected
235
236
        my ( $fwk_language, $list ) =
237
          $installer->load_sql_in_order( $all_languages,
238
            $query->param('framework') );
208
        $template->param(
239
        $template->param(
209
            "fwklanguage" => $fwk_language,
240
            "fwklanguage" => $fwk_language,
210
            "list"        => $list
241
            "list"        => $list
Lines 214-255 elsif ( $step && $step == 3 ) { Link Here
214
        $template->param( "$op" => 1 );
245
        $template->param( "$op" => 1 );
215
    }
246
    }
216
    elsif ( $op && $op eq 'selectframeworks' ) {
247
    elsif ( $op && $op eq 'selectframeworks' ) {
217
        #
248
#
218
        #
249
#
219
        # 1ST install, 2nd sub-step : show the user the sql datas he can insert in the database.
250
# 1ST install, 2nd sub-step : show the user the sql datas he can insert in the database.
220
        #
251
#
221
        #
252
#
222
        # (note that the term "selectframeworks is not correct. The user can select various files, not only frameworks)
253
# (note that the term "selectframeworks is not correct. The user can select various files, not only frameworks)
223
254
224
        #Framework Selection
255
#Framework Selection
225
        #sql data for import are supposed to be located in installer/data/<language>/<level>
256
#sql data for import are supposed to be located in installer/data/<language>/<level>
226
        # Where <language> is en|fr or any international abbreviation (provided language hash is updated... This will be a problem with internationlisation.)
257
# Where <language> is en|fr or any international abbreviation (provided language hash is updated... This will be a problem with internationlisation.)
227
        # Where <level> is a category of requirement : required, recommended optional
258
# Where <level> is a category of requirement : required, recommended optional
228
        # level should contain :
259
# level should contain :
229
        #   SQL File for import With a readable name.
260
#   SQL File for import With a readable name.
230
        #   txt File that explains what this SQL File is meant for.
261
#   txt File that explains what this SQL File is meant for.
231
        # Could be VERY useful to have A Big file for a kind of library.
262
# Could be VERY useful to have A Big file for a kind of library.
232
        # But could also be useful to have some Authorised values data set prepared here.
263
# But could also be useful to have some Authorised values data set prepared here.
233
        # Framework Selection is achieved through checking boxes.
264
# Framework Selection is achieved through checking boxes.
234
        my $langchoice = $query->param('fwklanguage');
265
        my $langchoice = $query->param('fwklanguage');
235
        $langchoice = $query->cookie('KohaOpacLanguage') unless ($langchoice);
266
        $langchoice = $query->cookie('KohaOpacLanguage') unless ($langchoice);
236
	$langchoice =~ s/[^a-zA-Z_-]*//g;
267
        $langchoice =~ s/[^a-zA-Z_-]*//g;
237
        my $marcflavour = $query->param('marcflavour');
268
        my $marcflavour = $query->param('marcflavour');
238
        if ($marcflavour){
269
        if ($marcflavour) {
239
            $installer->set_marcflavour_syspref($marcflavour);
270
            $installer->set_marcflavour_syspref($marcflavour);
240
        };
271
        }
241
        $marcflavour = C4::Context->preference('marcflavour') unless ($marcflavour);
272
        $marcflavour = C4::Context->preference('marcflavour')
273
          unless ($marcflavour);
274
242
        #Insert into database the selected marcflavour
275
        #Insert into database the selected marcflavour
243
        undef $/;
276
        undef $/;
244
        my ($marc_defaulted_to_en, $fwklist) = $installer->marc_framework_sql_list($langchoice, $marcflavour);
277
        my ( $marc_defaulted_to_en, $fwklist ) =
245
        $template->param('en_marc_frameworks' => $marc_defaulted_to_en);
278
          $installer->marc_framework_sql_list( $langchoice, $marcflavour );
246
        $template->param( "frameworksloop" => $fwklist );
279
        $template->param( 'en_marc_frameworks' => $marc_defaulted_to_en );
247
        $template->param( "marcflavour" => ucfirst($marcflavour));
280
        $template->param( "frameworksloop"     => $fwklist );
248
281
        $template->param( "marcflavour"        => ucfirst($marcflavour) );
249
        my ($sample_defaulted_to_en, $levellist) = $installer->sample_data_sql_list($langchoice);
282
250
        $template->param( "en_sample_data" => $sample_defaulted_to_en);
283
        my ( $sample_defaulted_to_en, $levellist ) =
251
        $template->param( "levelloop" => $levellist );
284
          $installer->sample_data_sql_list($langchoice);
252
        $template->param( "$op"       => 1 );
285
        $template->param( "en_sample_data" => $sample_defaulted_to_en );
286
        $template->param( "levelloop"      => $levellist );
287
        $template->param( "$op"            => 1 );
288
289
        my $setup = $query->param('setup');
290
        $template->param( "setup" => $setup );
291
253
    }
292
    }
254
    elsif ( $op && $op eq 'choosemarc' ) {
293
    elsif ( $op && $op eq 'choosemarc' ) {
255
        #
294
        #
Lines 258-303 elsif ( $step && $step == 3 ) { Link Here
258
        #
297
        #
259
        #
298
        #
260
299
261
        #Choose Marc Flavour
300
#Choose Marc Flavour
262
        #sql data are supposed to be located in installer/data/<dbms>/<language>/marcflavour/marcflavourname
301
#sql data are supposed to be located in installer/data/<dbms>/<language>/marcflavour/marcflavourname
263
	# Where <dbms> is database type according to DBD syntax
302
# Where <dbms> is database type according to DBD syntax
264
        # Where <language> is en|fr or any international abbreviation (provided language hash is updated... This will be a problem with internationlisation.)
303
# Where <language> is en|fr or any international abbreviation (provided language hash is updated... This will be a problem with internationlisation.)
265
        # Where <level> is a category of requirement : required, recommended optional
304
# Where <level> is a category of requirement : required, recommended optional
266
        # level should contain :
305
# level should contain :
267
        #   SQL File for import With a readable name.
306
#   SQL File for import With a readable name.
268
        #   txt File taht explains what this SQL File is meant for.
307
#   txt File taht explains what this SQL File is meant for.
269
        # Could be VERY useful to have A Big file for a kind of library.
308
# Could be VERY useful to have A Big file for a kind of library.
270
        # But could also be useful to have some Authorised values data set prepared here.
309
# But could also be useful to have some Authorised values data set prepared here.
271
        # Marcflavour Selection is achieved through radiobuttons.
310
# Marcflavour Selection is achieved through radiobuttons.
272
        my $langchoice = $query->param('fwklanguage');
311
        my $langchoice = $query->param('fwklanguage');
312
273
        $langchoice = $query->cookie('KohaOpacLanguage') unless ($langchoice);
313
        $langchoice = $query->cookie('KohaOpacLanguage') unless ($langchoice);
274
	$langchoice =~ s/[^a-zA-Z_-]*//g;
314
        $langchoice =~ s/[^a-zA-Z_-]*//g;
275
        my $dir =
315
        my $dir =
276
          C4::Context->config('intranetdir') . "/installer/data/$info{dbms}/$langchoice/marcflavour";
316
          C4::Context->config('intranetdir')
277
        unless (opendir( MYDIR, $dir )) {
317
          . "/installer/data/$info{dbms}/$langchoice/marcflavour";
278
            if ($langchoice eq 'en') {
318
        unless ( opendir( MYDIR, $dir ) ) {
319
            if ( $langchoice eq 'en' ) {
279
                warn "cannot open MARC frameworks directory $dir";
320
                warn "cannot open MARC frameworks directory $dir";
280
            } else {
321
            }
322
            else {
281
                # if no translated MARC framework is available,
323
                # if no translated MARC framework is available,
282
                # default to English
324
                # default to English
283
                $dir = C4::Context->config('intranetdir') . "/installer/data/$info{dbms}/en/marcflavour";
325
                $dir = C4::Context->config('intranetdir')
284
                opendir(MYDIR, $dir) or warn "cannot open English MARC frameworks directory $dir";
326
                  . "/installer/data/$info{dbms}/en/marcflavour";
327
                opendir( MYDIR, $dir )
328
                  or warn "cannot open English MARC frameworks directory $dir";
285
            }
329
            }
286
        }
330
        }
287
        my @listdir = grep { !/^\./ && -d "$dir/$_" } readdir(MYDIR);
331
        my @listdir = grep { !/^\./ && -d "$dir/$_" } readdir(MYDIR);
288
        closedir MYDIR;
332
        closedir MYDIR;
289
        my $marcflavour=C4::Context->preference("marcflavour");
333
        my $marcflavour = C4::Context->preference("marcflavour");
290
        my @flavourlist;
334
        my @flavourlist;
291
        foreach my $marc (@listdir) {
335
        foreach my $marc (@listdir) {
292
            my %cell=(
336
            my %cell = (
293
            "label"=> ucfirst($marc),
337
                "label"   => ucfirst($marc),
294
            "code"=>uc($marc),
338
                "code"    => uc($marc),
295
            "checked"=> defined($marcflavour) ? uc($marc) eq $marcflavour : 0);
339
                "checked" => defined($marcflavour)
340
                ? uc($marc) eq $marcflavour
341
                : 0
342
            );
343
296
#             $cell{"description"}= do { local $/ = undef; open INPUT "<$dir/$marc.txt"||"";<INPUT> };
344
#             $cell{"description"}= do { local $/ = undef; open INPUT "<$dir/$marc.txt"||"";<INPUT> };
297
            push @flavourlist, \%cell;
345
            push @flavourlist, \%cell;
298
        }
346
        }
299
        $template->param( "flavourloop" => \@flavourlist );
347
        $template->param( "flavourloop" => \@flavourlist );
300
        $template->param( "$op"       => 1 );
348
        $template->param( "$op"         => 1 );
301
    }
349
    }
302
    elsif ( $op && $op eq 'importdatastructure' ) {
350
    elsif ( $op && $op eq 'importdatastructure' ) {
303
        #
351
        #
Lines 317-323 elsif ( $step && $step == 3 ) { Link Here
317
        #
365
        #
318
        #Do updatedatabase And report
366
        #Do updatedatabase And report
319
367
320
        if ( ! defined $ENV{PERL5LIB} ) {
368
        if ( !defined $ENV{PERL5LIB} ) {
321
            my $find = "C4/Context.pm";
369
            my $find = "C4/Context.pm";
322
            my $path = $INC{$find};
370
            my $path = $INC{$find};
323
            $path =~ s/\Q$find\E//;
371
            $path =~ s/\Q$find\E//;
Lines 325-383 elsif ( $step && $step == 3 ) { Link Here
325
            warn "# plack? inserted PERL5LIB $ENV{PERL5LIB}\n";
373
            warn "# plack? inserted PERL5LIB $ENV{PERL5LIB}\n";
326
        }
374
        }
327
375
328
        my $now = POSIX::strftime( "%Y-%m-%dT%H:%M:%S", localtime() );
376
        my $now         = POSIX::strftime( "%Y-%m-%dT%H:%M:%S", localtime() );
329
        my $logdir = C4::Context->config('logdir');
377
        my $logdir      = C4::Context->config('logdir');
330
        my $dbversion = C4::Context->preference('Version');
378
        my $dbversion   = C4::Context->preference('Version');
331
        my $kohaversion = Koha::version;
379
        my $kohaversion = Koha::version;
332
        $kohaversion =~ s/(.*\..*)\.(.*)\.(.*)/$1$2$3/;
380
        $kohaversion =~ s/(.*\..*)\.(.*)\.(.*)/$1$2$3/;
333
381
334
        my $filename_suffix = join '_', $now, $dbversion, $kohaversion;
382
        my $filename_suffix = join '_', $now, $dbversion, $kohaversion;
335
        my ( $logfilepath, $logfilepath_errors ) = ( chk_log($logdir, "updatedatabase_$filename_suffix"), chk_log($logdir, "updatedatabase-error_$filename_suffix") );
383
        my ( $logfilepath, $logfilepath_errors ) = (
384
            chk_log( $logdir, "updatedatabase_$filename_suffix" ),
385
            chk_log( $logdir, "updatedatabase-error_$filename_suffix" )
386
        );
336
387
337
        my $cmd = C4::Context->config("intranetdir") . "/installer/data/$info{dbms}/updatedatabase.pl >> $logfilepath 2>> $logfilepath_errors";
388
        my $cmd = C4::Context->config("intranetdir")
389
          . "/installer/data/$info{dbms}/updatedatabase.pl >> $logfilepath 2>> $logfilepath_errors";
338
390
339
        system($cmd );
391
        system($cmd );
340
392
341
        my $fh;
393
        my $fh;
342
        open( $fh, "<", $logfilepath ) or die "Cannot open log file $logfilepath: $!";
394
        open( $fh, "<", $logfilepath )
395
          or die "Cannot open log file $logfilepath: $!";
343
        my @report = <$fh>;
396
        my @report = <$fh>;
344
        close $fh;
397
        close $fh;
345
        if (@report) {
398
        if (@report) {
346
            $template->param( update_report => [ map { { line => $_ } } split( /\n/, join( '', @report ) ) ] );
399
            $template->param( update_report =>
400
                  [ map { { line => $_ } } split( /\n/, join( '', @report ) ) ]
401
            );
347
            $template->param( has_update_succeeds => 1 );
402
            $template->param( has_update_succeeds => 1 );
348
        } else {
349
            eval{ `rm $logfilepath` };
350
        }
403
        }
351
        open( $fh, "<", $logfilepath_errors ) or die "Cannot open log file $logfilepath_errors: $!";
404
        else {
405
            eval { `rm $logfilepath` };
406
        }
407
        open( $fh, "<", $logfilepath_errors )
408
          or die "Cannot open log file $logfilepath_errors: $!";
352
        @report = <$fh>;
409
        @report = <$fh>;
353
        close $fh;
410
        close $fh;
354
        if (@report) {
411
        if (@report) {
355
            $template->param( update_errors => [ map { { line => $_ } } split( /\n/, join( '', @report ) ) ] );
412
            $template->param( update_errors =>
413
                  [ map { { line => $_ } } split( /\n/, join( '', @report ) ) ]
414
            );
356
            $template->param( has_update_errors => 1 );
415
            $template->param( has_update_errors => 1 );
357
            warn "The following errors were returned while attempting to run the updatedatabase.pl script:\n";
416
            warn
417
"The following errors were returned while attempting to run the updatedatabase.pl script:\n";
358
            foreach my $line (@report) { warn "$line\n"; }
418
            foreach my $line (@report) { warn "$line\n"; }
359
        } else {
419
        }
360
            eval{ `rm $logfilepath_errors` };
420
        else {
421
            eval { `rm $logfilepath_errors` };
361
        }
422
        }
362
        $template->param( $op => 1 );
423
        $template->param( $op => 1 );
363
    }
424
    }
364
    else {
425
    else {
365
        #
426
#
366
        # check whether it's a 1st install or an update
427
# check whether it's a 1st install or an update
367
        #
428
#
368
        #Check if there are enough tables.
429
#Check if there are enough tables.
369
        # Paul has cleaned up tables so reduced the count
430
# Paul has cleaned up tables so reduced the count
370
        #I put it there because it implied a data import if condition was not satisfied.
431
#I put it there because it implied a data import if condition was not satisfied.
371
        my $dbh = DBI->connect(
432
        my $dbh = DBI->connect(
372
    		"DBI:$info{dbms}:dbname=$info{dbname};host=$info{hostname}"
433
            "DBI:$info{dbms}:dbname=$info{dbname};host=$info{hostname}"
373
      		. ( $info{port} ? ";port=$info{port}" : "" ),
434
              . ( $info{port} ? ";port=$info{port}" : "" ),
374
            	$info{'user'}, $info{'password'}
435
            $info{'user'}, $info{'password'}
375
        );
436
        );
376
	my $rq;
437
        my $rq;
377
        if ( $info{dbms} eq 'mysql' ) { $rq = $dbh->prepare( "SHOW TABLES" ); }
438
        if ( $info{dbms} eq 'mysql' ) { $rq = $dbh->prepare("SHOW TABLES"); }
378
	elsif ( $info{dbms} eq 'Pg' ) { $rq = $dbh->prepare( "SELECT *
439
        elsif ( $info{dbms} eq 'Pg' ) {
379
								FROM information_schema.tables
440
            $rq = $dbh->prepare(
380
								WHERE table_schema='public' and table_type='BASE TABLE';" ); }
441
                "SELECT *
442
                FROM information_schema.tables
443
                WHERE table_schema='public' and table_type='BASE TABLE';"
444
            );
445
        }
381
        $rq->execute;
446
        $rq->execute;
382
        my $data = $rq->fetchall_arrayref( {} );
447
        my $data = $rq->fetchall_arrayref( {} );
383
        my $count = scalar(@$data);
448
        my $count = scalar(@$data);
Lines 388-410 elsif ( $step && $step == 3 ) { Link Here
388
            $template->param( "count" => $count, "proposeimport" => 1 );
453
            $template->param( "count" => $count, "proposeimport" => 1 );
389
        }
454
        }
390
        else {
455
        else {
391
            #
456
           #
392
            # we have tables, propose to select files to upload or updatedatabase
457
           # we have tables, propose to select files to upload or updatedatabase
393
            #
458
           #
394
            $template->param( "count" => $count, "default" => 1 );
459
            $template->param( "count" => $count, "default" => 1 );
395
            #
460
     #
396
            # 1st part of step 3 : check if there is a databaseversion systempreference
461
     # 1st part of step 3 : check if there is a databaseversion systempreference
397
            # if there is, then we just need to upgrade
462
     # if there is, then we just need to upgrade
398
            # if there is none, then we need to install the database
463
     # if there is none, then we need to install the database
399
            #
464
     #
400
            if (C4::Context->preference('Version')) {
465
            if ( C4::Context->preference('Version') ) {
401
                my $dbversion = C4::Context->preference('Version');
466
                my $dbversion = C4::Context->preference('Version');
402
                $dbversion =~ /(.*)\.(..)(..)(...)/;
467
                $dbversion =~ /(.*)\.(..)(..)(...)/;
403
                $dbversion = "$1.$2.$3.$4";
468
                $dbversion = "$1.$2.$3.$4";
404
                $template->param("upgrading" => 1,
469
                $template->param(
405
                                "dbversion" => $dbversion,
470
                    "upgrading"   => 1,
406
                                "kohaversion" => Koha::version(),
471
                    "dbversion"   => $dbversion,
407
                                );
472
                    "kohaversion" => Koha::version(),
473
                );
408
            }
474
            }
409
        }
475
        }
410
    }
476
    }
Lines 422-428 else { Link Here
422
        if ( $rq->execute ) {
488
        if ( $rq->execute ) {
423
            my ($version) = $rq->fetchrow;
489
            my ($version) = $rq->fetchrow;
424
            if ($version) {
490
            if ($version) {
425
                print $query->redirect("/cgi-bin/koha/installer/install.pl?step=3");
491
                print $query->redirect(
492
                    "/cgi-bin/koha/installer/install.pl?step=3");
426
                exit;
493
                exit;
427
            }
494
            }
428
        }
495
        }
Lines 430-442 else { Link Here
430
}
497
}
431
output_html_with_http_headers $query, $cookie, $template->output;
498
output_html_with_http_headers $query, $cookie, $template->output;
432
499
433
sub chk_log { #returns a logfile in $dir or - if that failed - in temp dir
500
sub chk_log {    #returns a logfile in $dir or - if that failed - in temp dir
434
    my ($dir, $name) = @_;
501
    my ( $dir, $name ) = @_;
435
    my $fn=$dir.'/'.$name.'.log';
502
    my $fn = $dir . '/' . $name . '.log';
436
    if( ! open my $fh, '>', $fn ) {
503
    if ( !open my $fh, '>', $fn ) {
437
        $name.= '_XXXX';
504
        $name .= '_XXXX';
438
        require File::Temp;
505
        require File::Temp;
439
        ($fh, $fn)= File::Temp::tempfile( $name, TMPDIR => 1, SUFFIX => '.log');
506
        ( $fh, $fn ) =
507
          File::Temp::tempfile( $name, TMPDIR => 1, SUFFIX => '.log' );
508
440
        #if this should not work, let croak take over
509
        #if this should not work, let croak take over
441
    }
510
    }
442
    return $fn;
511
    return $fn;
(-)a/installer/onboarding.pl (+683 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Copyright (C) YEAR  YOURNAME-OR-YOUREMPLOYER
6
#
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
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
#Recommended pragmas
21
use Modern::Perl;
22
use diagnostics;
23
use C4::InstallAuth;
24
use CGI qw ( -utf8 );
25
use List::MoreUtils qw/uniq/;
26
use Digest::MD5 qw(md5_base64);
27
use Encode qw( encode );
28
use C4::Koha;
29
use C4::Context;
30
use C4::Output;
31
use C4::Form::MessagingPreferences;
32
use C4::Members;
33
use C4::Members::Attributes;
34
use C4::Members::AttributeTypes;
35
use C4::Log;
36
use C4::Letters;
37
use C4::Form::MessagingPreferences;
38
use Koha::AuthorisedValues;
39
use Koha::Patron::Debarments;
40
use Koha::Cities;
41
use Koha::Patrons;
42
use Koha::Items;
43
use Koha::Libraries;
44
use Koha::LibraryCategories;
45
use Koha::Database;
46
use Koha::DateUtils;
47
use Koha::Patron::Categories;
48
use Koha::Patron::HouseboundRole;
49
use Koha::Patron::HouseboundRoles;
50
use Koha::Token;
51
use Email::Valid;
52
use Module::Load;
53
use Koha::ItemTypes;
54
use Koha::IssuingRule;
55
use Koha::IssuingRules;
56
57
#Setting variables
58
my $input = new CGI;
59
my $step  = $input->param('step');
60
61
#Getting the appropriate template to display to the user
62
my ( $template, $loggedinuser, $cookie ) =
63
  C4::InstallAuth::get_template_and_user(
64
    {
65
        template_name => "/onboarding/onboardingstep"
66
          . ( $step ? $step : 1 ) . ".tt",
67
        query           => $input,
68
        type            => "intranet",
69
        authnotrequired => 0,
70
        debug           => 1,
71
    }
72
  );
73
74
#Check database connection
75
my %info;
76
$info{'dbname'} = C4::Context->config("database");
77
$info{'dbms'}   = (
78
      C4::Context->config("db_scheme")
79
    ? C4::Context->config("db_scheme")
80
    : "mysql"
81
);
82
83
$info{'hostname'} = C4::Context->config("hostname");
84
$info{'port'}     = C4::Context->config("port");
85
$info{'user'}     = C4::Context->config("user");
86
$info{'password'} = C4::Context->config("pass");
87
my $dbh = DBI->connect(
88
    "DBI:$info{dbms}:dbname=$info{dbname};host=$info{hostname}"
89
      . ( $info{port} ? ";port=$info{port}" : "" ),
90
    $info{'user'}, $info{'password'}
91
);
92
93
#Store the value of the template input name='op' in the variable $op so we can check if the user has pressed the button with the name="op" and value="finish" meaning the user has finished the onboarding tool.
94
my $op = $input->param('op');
95
$template->param( 'op' => $op );
96
97
if ( $op && $op eq 'finish' )
98
{ #If the value of $op equals 'finish' then redirect user to /cgi-bin/koha/mainpage.pl
99
    print $input->redirect("/cgi-bin/koha/mainpage.pl");
100
    exit;
101
}
102
103
my $libraries = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, );
104
$template->param(
105
     libraries   => $libraries,
106
     group_types => [
107
     {
108
            categorytype => 'searchdomain',
109
            categories   => [
110
               Koha::LibraryCategories->search(
111
                   { categorytype => 'searchdomain' }
112
               )
113
            ],
114
     },
115
     {
116
            categorytype => 'properties',
117
            categories   => [
118
               Koha::LibraryCategories->search(
119
                   { categorytype => 'properties' }
120
               )
121
            ],
122
     },
123
     ]
124
);
125
126
127
#Select all the patron category records in the categories database table and give them to the template
128
    my $categories = Koha::Patron::Categories->search();
129
    $template->param( 'categories' => $categories, );
130
131
#Check if the $step variable equals 1 i.e. the user has clicked to create a library in the create library screen 1
132
    my $itemtypes = Koha::ItemTypes->search();
133
    $template->param( 'itemtypes' => $itemtypes, );
134
135
if ( $step && $step == 1 ) {
136
    #store inputted parameters in variables
137
    my $branchcode = $input->param('branchcode');
138
    $branchcode = uc($branchcode);
139
    my $categorycode = $input->param('categorycode');
140
    my $op = $input->param('op') || 'list';
141
    my $message;
142
    my $library;
143
144
    #Take the text 'branchname' and store it in the @fields array
145
    my @fields = qw(
146
      branchname
147
    );
148
149
    $template->param( 'branchcode' => $branchcode );
150
    $branchcode =~ s|\s||g
151
      ; # Use a regular expression to check the value of the inputted branchcode
152
153
#Create a new library object and store the branchcode and @fields array values in this new library object
154
    $library = Koha::Library->new(
155
        {
156
            branchcode => $branchcode,
157
            ( map { $_ => scalar $input->param($_) || undef } @fields )
158
        }
159
    );
160
161
    eval { $library->store; }; #Use the eval{} function to store the library object
162
    if ($library) {
163
        $message = 'success_on_insert';
164
    }
165
    else {
166
        $message = 'error_on_insert';
167
    }
168
    warn $message;
169
    $template->param( 'message' => $message );
170
171
#Check if the $step variable equals 2 i.e. the user has clicked to create a patron category in the create patron category screen 1
172
}
173
elsif ( $step && $step == 2 ) {
174
    if ($op eq "add_validate_category"){
175
        #Initialising values
176
        my $searchfield  = $input->param('description') // q||;
177
        my $categorycode = $input->param('categorycode');
178
        my $op           = $input->param('op') // 'list';
179
        my $message;
180
        my $category;
181
        $template->param( 'categorycode' => $categorycode );
182
183
        my ( $template, $loggedinuser, $cookie ) =
184
            C4::InstallAuth::get_template_and_user(
185
            {
186
                template_name   => "/onboarding/onboardingstep2.tt",
187
                query           => $input,
188
                type            => "intranet",
189
                authnotrequired => 0,
190
                flagsrequired =>
191
                { parameters => 'parameters_remaining_permissions' },
192
                debug => 1,
193
            }
194
            );
195
196
        #Once the user submits the page, this code validates the input and adds it
197
        #to the database as a new patron category
198
        $categorycode = $input->param('categorycode');
199
        my $description           = $input->param('description');
200
        my $overduenoticerequired = $input->param('overduenoticerequired');
201
        my $category_type         = $input->param('category_type');
202
        my $default_privacy       = $input->param('default_privacy');
203
        my $enrolmentperiod       = $input->param('enrolmentperiod');
204
        my $enrolmentperioddate   = $input->param('enrolmentperioddate') || undef;
205
206
        #Converts the string into a date format
207
        if ($enrolmentperioddate) {
208
            $enrolmentperioddate = output_pref(
209
                {
210
                    dt         => dt_from_string($enrolmentperioddate),
211
                    dateformat => 'iso',
212
                    dateonly   => 1,
213
                }
214
            );
215
        }
216
217
        #Adds a new patron category to the database
218
        $category = Koha::Patron::Category->new(
219
            {
220
                categorycode          => $categorycode,
221
                description           => $description,
222
                overduenoticerequired => $overduenoticerequired,
223
                category_type         => $category_type,
224
                default_privacy       => $default_privacy,
225
                enrolmentperiod       => $enrolmentperiod,
226
                enrolmentperioddate   => $enrolmentperioddate,
227
            }
228
        );
229
230
        eval { $category->store; };
231
232
        #Error messages
233
        if ($category) {
234
            $message = 'success_on_insert';
235
        }
236
        else {
237
            $message = 'error_on_insert';
238
        }
239
240
        $template->param( 'message' => $message );
241
    }
242
    #Create a patron
243
}
244
elsif ( $step && $step == 3 ) {
245
    my $firstpassword  = $input->param('password');
246
    my $secondpassword = $input->param('password2');
247
248
249
    #Find all patron records in the database and hand them to the template
250
    my %currentpatrons = Koha::Patrons->search();
251
    my $currentpatrons = values %currentpatrons;
252
    warn $currentpatrons;
253
    $template->param( 'patrons' =>$currentpatrons);
254
255
256
#Find all library records in the database and hand them to the template to display in the library dropdown box
257
    my $libraries =
258
      Koha::Libraries->search( {}, { order_by => ['branchcode'] }, );
259
    $template->param(
260
        libraries   => $libraries,
261
        group_types => [
262
            {
263
                categorytype => 'searchdomain',
264
                categories   => [
265
                    Koha::LibraryCategories->search(
266
                        { categorytype => 'searchdomain' }
267
                    )
268
                ],
269
            },
270
            {
271
                categorytype => 'properties',
272
                categories   => [
273
                    Koha::LibraryCategories->search(
274
                        { categorytype => 'properties' }
275
                    )
276
                ],
277
            },
278
        ]
279
    );
280
281
#Find all patron categories in the database and hand them to the template to display in the patron category dropdown box
282
    my $categories = Koha::Patron::Categories->search();
283
    $template->param( 'categories' => $categories, );
284
285
#Incrementing the highest existing patron cardnumber to prevent duplicate cardnumber entry
286
    my $exisiting_cardnumber = my $sth_search =
287
      $dbh->prepare("SELECT MAX(cardnumber) FROM borrowers");
288
    warn $exisiting_cardnumber;
289
    my $new_cardnumber = $exisiting_cardnumber + 1;
290
    warn $new_cardnumber;
291
    $template->param( "newcardnumber" => $new_cardnumber );
292
293
    my $op = $input->param('op') // 'list';
294
    my $minpw = C4::Context->preference("minPasswordLength");
295
    $template->param( "minPasswordLength" => $minpw );
296
    my @messages;
297
    my @errors;
298
    my $nok            = $input->param('nok');
299
    my $cardnumber     = $input->param('cardnumber');
300
    my $borrowernumber = $input->param('borrowernumber');
301
    my $userid         = $input->param('userid');
302
303
    # function to designate mandatory fields (visually with css)
304
    my $check_BorrowerMandatoryField =
305
      C4::Context->preference("BorrowerMandatoryField");
306
    my @field_check = split( /\|/, $check_BorrowerMandatoryField );
307
    foreach (@field_check) {
308
        $template->param( "mandatory$_" => 1 );
309
        $template->param(
310
            BorrowerMandatoryField =>
311
              C4::Context->preference("BorrowerMandatoryField")
312
            ,    #field to test with javascript
313
        );
314
    }
315
316
 #If the entered cardnumber causes an error hand this error to the @errors array
317
    if ( my $error_code = checkcardnumber( $cardnumber, $borrowernumber ) ) {
318
        push @errors,
319
            $error_code == 1 ? 'ERROR_cardnumber_already_exists'
320
          : $error_code == 2 ? 'ERROR_cardnumber_length'
321
          :                    ();
322
    }
323
324
   #If the entered password causes an error hand this error to the @errors array
325
    push @errors, "ERROR_password_mismatch"
326
      if $firstpassword ne $secondpassword;
327
    push @errors, "ERROR_short_password"
328
      if ( $firstpassword
329
        && $minpw
330
        && $firstpassword ne '****'
331
        && ( length($firstpassword) < $minpw ) );
332
333
    #Passing errors to template
334
    $nok = $nok || scalar(@errors);
335
336
#If errors have been generated from the users inputted cardnumber or password then display the error and do not insert the patron into the borrowers table
337
    if ($nok) {
338
        foreach my $error (@errors) {
339
            if ( $error eq 'ERROR_password_mismatch' ) {
340
                $template->param( errorpasswordmismatch => 1 );
341
            }
342
            if ( $error eq 'ERROR_login_exist' ) {
343
                $template->param( errorloginexists => 1 );
344
            }
345
            if ( $error eq 'ERROR_cardnumber_already_exists' ) {
346
                $template->param( errorcardnumberexists => 1 );
347
            }
348
            if ( $error eq 'ERROR_cardnumber_length' ) {
349
                $template->param( errorcardnumberlength => 1 );
350
            }
351
            if ( $error eq 'ERROR_short_password' ) {
352
                $template->param( errorshortpassword => 1 );
353
            }
354
        }
355
        $template->param( 'nok' => 1 );
356
357
#Else if no errors have been caused by the users inputted card number or password then insert the patron into the borrowers table
358
    }
359
    else {
360
        my ( $template, $loggedinuser, $cookie ) =
361
          C4::InstallAuth::get_template_and_user(
362
            {
363
                template_name   => "/onboarding/onboardingstep3.tt",
364
                query           => $input,
365
                type            => "intranet",
366
                authnotrequired => 0,
367
                flagsrequired   => { borrowers => 1 },
368
                debug           => 1,
369
            }
370
          );
371
372
        if ( $op eq 'add_validate' ) {
373
            my %newdata;
374
375
            #Store the template form values in the newdata hash
376
            $newdata{borrowernumber} = $input->param('borrowernumber');
377
            $newdata{surname}        = $input->param('surname');
378
            $newdata{firstname}      = $input->param('firstname');
379
            $newdata{cardnumber}     = $input->param('cardnumber');
380
            $newdata{branchcode}     = $input->param('libraries');
381
            $newdata{categorycode}   = $input->param('categorycode_entry');
382
            $newdata{userid}         = $input->param('userid');
383
            $newdata{password}       = $input->param('password');
384
            $newdata{password2}      = $input->param('password2');
385
            $newdata{dateexpiry}     = '12/10/2016';
386
            $newdata{privacy}        = "default";
387
388
#Hand the newdata hash to the AddMember subroutine in the C4::Members module and it creates a patron and hands back a borrowernumber which is being stored
389
            my $borrowernumber = &AddMember(%newdata);
390
391
#Create a hash named member2 and fill it with the borrowernumber of the borrower that has just been created
392
            my %member2;
393
            $member2{'borrowernumber'} = $borrowernumber;
394
395
#Perform data validation on the flag that has been handed to onboarding.pl by the template
396
            my $flag = $input->param('flag');
397
            if ( $input->param('newflags') ) {
398
                my $dbh              = C4::Context->dbh();
399
                my @perms            = $input->multi_param('flag');
400
                my %all_module_perms = ();
401
                my %sub_perms        = ();
402
                foreach my $perm (@perms) {
403
                    if ( $perm !~ /:/ ) {
404
                        $all_module_perms{$perm} = 1;
405
                    }
406
                    else {
407
                        my ( $module, $sub_perm ) = split /:/, $perm, 2;
408
                        push @{ $sub_perms{$module} }, $sub_perm;
409
                    }
410
                }
411
412
                # construct flags
413
                my $module_flags = 0;
414
                my $sth =
415
                  $dbh->prepare("SELECT bit,flag FROM userflags ORDER BY bit");
416
                $sth->execute();
417
                while ( my ( $bit, $flag ) = $sth->fetchrow_array ) {
418
                    if ( exists $all_module_perms{$flag} ) {
419
                        $module_flags += 2**$bit;
420
                    }
421
                }
422
423
#Set the superlibrarian permission of the newly created patron to superlibrarian
424
                $sth = $dbh->prepare(
425
                    "UPDATE borrowers SET flags=? WHERE borrowernumber=?");
426
                $sth->execute( $module_flags, $borrowernumber );
427
428
                #Error handling checking if the patron was created successfully
429
                if ( !$borrowernumber ) {
430
                    push @messages,
431
                      { type => 'error', code => 'error_on_insert' };
432
                }
433
                else {
434
                    push @messages,
435
                      { type => 'message', code => 'success_on_insert' };
436
                }
437
            }
438
        }
439
    }
440
}
441
elsif ( $step && $step == 4 ) {
442
    my ( $template, $borrowernumber, $cookie ) =
443
      C4::InstallAuth::get_template_and_user(
444
        {
445
            template_name   => "/onboarding/onboardingstep4.tt",
446
            query           => $input,
447
            type            => "intranet",
448
            authnotrequired => 0,
449
            flagsrequired =>
450
              { parameters => 'parameters_remaining_permissions' },
451
            debug => 1,
452
        }
453
    );
454
  if ($op eq "add_validate"){
455
        my $description   = $input->param('description');
456
        my $itemtype_code = $input->param('itemtype');
457
        warn $description;
458
        $itemtype_code = uc($itemtype_code);
459
460
  #Create a new itemtype object using the user inputted itemtype and description
461
        my $itemtype = Koha::ItemType->new(
462
            {
463
                itemtype    => $itemtype_code,
464
                description => $description,
465
            }
466
        );
467
        eval { $itemtype->store; };
468
        my $message;
469
470
#Fill the $message variable with an error if the item type object was not successfully created and inserted into the itemtypes table
471
        if ($itemtype) {
472
            $message = 'success_on_insert';
473
        }
474
        else {
475
            $message = 'error_on_insert';
476
        }
477
        $template->param( 'message' => $message );
478
    }
479
}
480
elsif ( $step && $step == 5 ) {
481
482
  #Find all the existing categories to display in a dropdown box in the template
483
    my $categories;
484
    $categories = Koha::Patron::Categories->search();
485
    $template->param( categories => $categories, );
486
487
 #Find all the exisiting item types to display in a dropdown box in the template
488
    my $itemtypes;
489
    $itemtypes = Koha::ItemTypes->search();
490
    $template->param( itemtypes => $itemtypes, );
491
492
  #Find all the exisiting libraries to display in a dropdown box in the template
493
    my $libraries =
494
      Koha::Libraries->search( {}, { order_by => ['branchcode'] }, );
495
    $template->param(
496
        libraries   => $libraries,
497
        group_types => [
498
            {
499
                categorytype => 'searchdomain',
500
                categories   => [
501
                    Koha::LibraryCategories->search(
502
                        { categorytype => 'searchdomain' }
503
                    )
504
                ],
505
            },
506
            {
507
                categorytype => 'properties',
508
                categories   => [
509
                    Koha::LibraryCategories->search(
510
                        { categorytype => 'properties' }
511
                    )
512
                ],
513
            },
514
        ]
515
    );
516
517
    my $input = CGI->new;
518
    my $dbh   = C4::Context->dbh;
519
520
    my ( $template, $loggedinuser, $cookie ) =
521
      C4::InstallAuth::get_template_and_user(
522
        {
523
            template_name   => "/onboarding/onboardingstep5.tt",
524
            query           => $input,
525
            type            => "intranet",
526
            authnotrequired => 0,
527
            flagsrequired   => { parameters => 'manage_circ_rules' },
528
            debug           => 1,
529
        }
530
      );
531
532
    #If no libraries exist then set the $branch value to *
533
    my $branch = $input->param('branch');
534
    unless ($branch) {
535
        if ( C4::Context->preference('DefaultToLoggedInLibraryCircRules') ) {
536
            $branch =
537
              Koha::Libraries->search->count() == 1
538
              ? undef
539
              : C4::Context::mybranch();
540
        }
541
        else {
542
            $branch =
543
              C4::Context::only_my_library()
544
              ? ( C4::Context::mybranch() || '*' )
545
              : '*';
546
        }
547
    }
548
    $branch = '*' if $branch eq 'NO_LIBRARY_SET';
549
    my $op = $input->param('op') || q{};
550
551
    if ( $op eq 'add_validate' ) {
552
        my $type            = $input->param('type');
553
        my $br              = $input->param('branch');
554
        my $bor             = $input->param('categorycode');
555
        my $itemtype        = $input->param('itemtype');
556
        my $maxissueqty     = $input->param('maxissueqty');
557
        my $issuelength     = $input->param('issuelength');
558
        my $lengthunit      = $input->param('lengthunit');
559
        my $renewalsallowed = $input->param('renewalsallowed');
560
        my $renewalperiod   = $input->param('renewalperiod');
561
        my $onshelfholds    = $input->param('onshelfholds') || 0;
562
        $maxissueqty =~ s/\s//g;
563
        $maxissueqty = undef if $maxissueqty !~ /^\d+/;
564
        $issuelength = $issuelength eq q{} ? undef : $issuelength;
565
566
        my $params = {
567
            branchcode      => $br,
568
            categorycode    => $bor,
569
            itemtype        => $itemtype,
570
            maxissueqty     => $maxissueqty,
571
            renewalsallowed => $renewalsallowed,
572
            renewalperiod   => $renewalperiod,
573
            issuelength     => $issuelength,
574
            lengthunit      => $lengthunit,
575
            onshelfholds    => $onshelfholds,
576
        };
577
578
        my @messages;
579
580
#New code from smart-rules.tt starts here. Needs to be added to library
581
#Allows for the 'All' option to work when selecting all libraries for a circulation rule to apply to.
582
        if ( $branch eq "*" ) {
583
            my $sth_search = $dbh->prepare(
584
                "SELECT count(*) AS total
585
                                        FROM default_circ_rules"
586
            );
587
            my $sth_insert = $dbh->prepare(
588
                "INSERT INTO default_circ_rules
589
                                        (maxissueqty, onshelfholds)
590
                                        VALUES (?, ?)"
591
            );
592
            my $sth_update = $dbh->prepare(
593
                "UPDATE default_circ_rules
594
                                        SET maxissueqty = ?, onshelfholds = ?"
595
            );
596
597
            $sth_search->execute();
598
            my $res = $sth_search->fetchrow_hashref();
599
            if ( $res->{total} ) {
600
                $sth_update->execute( $maxissueqty, $onshelfholds );
601
            }
602
            else {
603
                $sth_insert->execute( $maxissueqty, $onshelfholds );
604
            }
605
        }
606
607
#Allows for the 'All' option to work when selecting all patron categories for a circulation rule to apply to.
608
        if ( $bor eq "*" ) {
609
            my $sth_search = $dbh->prepare(
610
                "SELECT count(*) AS total
611
                                            FROM default_circ_rules"
612
            );
613
            my $sth_insert = $dbh->prepare(
614
                q|
615
                INSERT INTO default_circ_rules
616
                    (maxissueqty)
617
                    VALUES (?)
618
            |
619
            );
620
            my $sth_update = $dbh->prepare(
621
                q|
622
                UPDATE default_circ_rules
623
                SET maxissueqty = ?
624
            |
625
            );
626
627
            $sth_search->execute();
628
            my $res = $sth_search->fetchrow_hashref();
629
            if ( $res->{total} ) {
630
                $sth_update->execute($maxissueqty);
631
            }
632
            else {
633
                $sth_insert->execute($maxissueqty);
634
            }
635
        }
636
637
#Allows for the 'All' option to work when selecting all itemtypes for a circulation rule to apply to
638
        if ( $itemtype eq "*" ) {
639
            my $sth_search = $dbh->prepare(
640
                "SELECT count(*) AS total
641
                                        FROM default_branch_circ_rules
642
                                        WHERE branchcode = ?"
643
            );
644
            my $sth_insert = $dbh->prepare(
645
                "INSERT INTO default_branch_circ_rules
646
                                        (branchcode, onshelfholds)
647
                                        VALUES (?, ?)"
648
            );
649
            my $sth_update = $dbh->prepare(
650
                "UPDATE default_branch_circ_rules
651
                                        SET onshelfholds = ?
652
                                        WHERE branchcode = ?"
653
            );
654
            $sth_search->execute($branch);
655
            my $res = $sth_search->fetchrow_hashref();
656
657
            if ( $res->{total} ) {
658
                $sth_update->execute( $onshelfholds, $branch );
659
            }
660
            else {
661
                $sth_insert->execute( $branch, $onshelfholds );
662
            }
663
        }
664
665
        my $issuingrule = Koha::IssuingRules->find(
666
            { categorycode => $bor, itemtype => $itemtype, branchcode => $br }
667
        );
668
        if ($issuingrule) {
669
            $issuingrule->set($params)->store();
670
            push @messages,
671
              {
672
                type => 'error',
673
                code => 'error_on_insert'
674
              }; #Stops crash of the onboarding tool if someone makes a circulation rule with the same item type, library and patron categroy as an exisiting circulation rule.
675
676
        }
677
        else {
678
            Koha::IssuingRule->new()->set($params)->store();
679
        }
680
    }
681
}
682
683
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc (-1 / +1 lines)
Lines 6-12 var debug = "[% debug %]"; Link Here
6
var dformat  = "[% dateformat %]";
6
var dformat  = "[% dateformat %]";
7
var sentmsg = 0;
7
var sentmsg = 0;
8
if (debug > 1) {alert("dateformat: " + dformat + "\ndebug is on (level " + debug + ")");}
8
if (debug > 1) {alert("dateformat: " + dformat + "\ndebug is on (level " + debug + ")");}
9
var MSG_PLEASE_ENTER_A_VALID_DATE = _("Please enter a valid date (should match %s).");
9
var MSG_PLEASE_ENTER_A_VALID_DATE = (_("Please enter a valid date (should match %s)."));
10
10
11
function is_valid_date(date) {
11
function is_valid_date(date) {
12
    // An empty string is considered as a valid date for convenient reasons.
12
    // An empty string is considered as a valid date for convenient reasons.
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc (+2 lines)
Lines 42-47 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
45
                </ul>
47
                </ul>
46
            </li>
48
            </li>
47
        </ul>
49
        </ul>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/installer-doc-head-close.inc (+15 lines)
Lines 1-5 Link Here
1
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
1
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
2
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
2
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
3
<link rel="stylesheet" type="text/css" href="[% interface %]/lib/jquery/jquery-ui-1.11.4.min.css" />
4
<link rel="stylesheet" type="text/css" href="[% interface %]/lib/bootstrap/bootstrap.min.css" />
5
<link rel="stylesheet" type="text/css" href="[% interface %]/lib/font-awesome/css/font-awesome.min.css" />
6
<link rel="stylesheet" type="text/css" media="print" href="[% interface %]/[% theme %]/css/print.css" />
3
<style type="text/css" media="screen">
7
<style type="text/css" media="screen">
4
8
5
[% IF ( login ) %]
9
[% IF ( login ) %]
Lines 69-74 td input { font-size: 1.5em; } Link Here
69
73
70
</style>
74
</style>
71
75
76
<script type="text/javascript" src="[% interface %]/lib/jquery/jquery-2.2.3.min.js"></script>
77
<script type="text/javascript" src="[% interface %]/lib/jquery/jquery-migrate-1.3.0.min.js"></script>
78
<script type="text/javascript" src="[% interface %]/lib/jquery/jquery-ui-1.11.4.min.js"></script>
79
<script type="text/javascript" src="[% interface %]/lib/shortcut/shortcut.js"></script>
80
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.cookie.min.js"></script>
81
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.highlight-3.js"></script>
82
<script type="text/javascript" src="[% interface %]/lib/bootstrap/bootstrap.min.js"></script>
83
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.validate.min.js"></script>
84
<!-- koha core js -->
85
<script type="text/javascript" src="[% interface %]/[% theme %]/js/staff-global.js"></script>
86
72
<script type="text/javascript">
87
<script type="text/javascript">
73
    //<![CDATA[
88
    //<![CDATA[
74
        function _(s) { return s } // dummy function for gettext
89
        function _(s) { return s } // dummy function for gettext
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt (-1 / +1 lines)
Lines 93-99 Link Here
93
                            </li>
93
                            </li>
94
                            <li>
94
                            <li>
95
                                <label for="enrolmentperioddate" style="width:6em;">Until date: </label>
95
                                <label for="enrolmentperioddate" style="width:6em;">Until date: </label>
96
                                <input type="text" class="enrollmentperiod" name="enrolmentperioddate" id="enrolmentperioddate" value="[% category.enrolmentperioddate | $KohaDates %]" />
96
                                <input type="text" class="enrollmentperiod datepicker" name="enrolmentperioddate" id="enrolmentperioddate" value="[% category.enrolmentperioddate | $KohaDates %]" />
97
                            </li>
97
                            </li>
98
                        </ol>
98
                        </ol>
99
                    </fieldset>
99
                    </fieldset>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt (-124 / +179 lines)
Lines 1-130 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]<title>Koha &rsaquo; Web installer &rsaquo; Step 3</title>
1
[% INCLUDE 'doc-head-open.inc' %]<title>Koha &rsaquo; Web installer &rsaquo; Step 3</title>
2
[% IF ( finish ) %]<meta http-equiv="refresh" content="10; url=/cgi-bin/koha/mainpage.pl">[% END %]
2
[% IF ( finish ) %]<meta http-equiv="refresh" content="10; url=/cgi-bin/koha/installer/onboarding.pl">[% END %]
3
[% INCLUDE 'installer-doc-head-close.inc' %]
3
[% INCLUDE 'installer-doc-head-close.inc' %]
4
<div>
4
<div>
5
<h1 id="logo"><img alt="Koha" src="[% interface %]/[% theme %]/img/koha.org-logo.gif" /> Web installer &rsaquo; Step 3</h1>
5
<h1 id="logo"><img alt="Koha" src="[% interface %]/[% theme %]/img/koha.org-logo.gif" /> Koha web  installer &rsaquo; Step 3</h1>
6
6
7
[% IF ( selectframeworks ) %]
7
[% IF ( selectframeworks ) %]
8
    <script type="text/javascript">
8
    <script type="text/javascript">
9
    //<![CDATA[
9
//<![CDATA[
10
10
11
    var surl = unescape(window.location.pathname);
11
var surl = unescape(window.location.pathname);
12
12
13
    function doLoad()
13
function doLoad()
14
    {
14
{
15
        // the timeout value should be the same as in the "refresh" meta-tag
15
    // the timeout value should be the same as in the "refresh" meta-tag
16
        setTimeout( "refresh()", 2*1000 );
16
    setTimeout( "refresh()", 2*1000 );
17
    }
17
}
18
18
19
    function refresh(value)
19
function refresh(value)
20
    {
20
{
21
        //  The argument to the location.reload function determines
21
    //  The argument to the location.reload function determines
22
        //  if the browser should retrieve the document from the
22
    //  if the browser should retrieve the document from the
23
        //  web-server.  In our example all we need to do is cause
23
    //  web-server.  In our example all we need to do is cause
24
        //  the JavaScript block in the document body to be
24
    //  the JavaScript block in the document body to be
25
        //  re-evaluated.  If we needed to pull the document from
25
    //  re-evaluated.  If we needed to pull the document from
26
        //  the web-server again (such as where the document contents
26
    //  the web-server again (such as where the document contents
27
        //  change dynamically) we would pass the argument as 'true'.
27
    //  change dynamically) we would pass the argument as 'true'.
28
        //
28
    //
29
        surl=surl+'?step=3&op=selectframeworks&fwklanguage='+value;
29
    surl=surl+'?step=3&op=selectframeworks&fwklanguage='+value;
30
30
31
        window.location.replace( surl );
31
    window.location.replace( surl );
32
    }
32
}
33
33
34
    function selectAllFrameworks()
34
function selectAllFrameworks()
35
{
36
    //  A handy short link that selects all available checkboxes
37
    //  on the page.
38
    //
39
    var checkboxes = document.getElementsByTagName("input");
40
    for (var i = 0; i < checkboxes.length; i++)
35
    {
41
    {
36
        //  A handy short link that selects all available checkboxes
42
        if (checkboxes[i].type == 'checkbox')
37
        //  on the page.
38
        //
39
        var checkboxes = document.getElementsByTagName("input");
40
        for (var i = 0; i < checkboxes.length; i++)
41
        {
43
        {
42
            if (checkboxes[i].type == 'checkbox')
44
            checkboxes[i].checked = true;
43
            {
44
                checkboxes[i].checked = true;
45
            }
46
        }
45
        }
47
48
        //  Prevent event propergation.
49
        return false;
50
    }
46
    }
51
47
52
    function Hide(link)
48
    //  Prevent event propergation.
53
    {
49
    return false;
54
        //  Toggle the display of a given element on the page.
50
}
55
        //
51
56
        subfield = document.getElementById('bloc'+link);
52
function Hide(link)
57
        var initstyle = subfield.style.display;
53
{
58
        if (initstyle == 'block') subfield.style.display = 'none' ;
54
    //  Toggle the display of a given element on the page.
59
        if (initstyle == 'none') subfield.style.display = 'block' ;
55
    //
60
    }
56
    subfield = document.getElementById('bloc'+link);
57
    var initstyle = subfield.style.display;
58
    if (initstyle == 'block') subfield.style.display = 'none' ;
59
    if (initstyle == 'none') subfield.style.display = 'block' ;
60
}
61
61
62
    //]]>
62
//]]>
63
    </script>
63
</script>
64
[% END %]
64
[% END %]
65
66
65
[% IF ( finish ) %]
67
[% IF ( finish ) %]
66
    <h1>Congratulations, installation complete</h1>
68
    <h1>Congratulations, installation complete</h1>
67
    <p>If this page does not redirect in 5 seconds, click <a href="/">here</a>.</p>
69
    <p>If this page does not redirect in 10 seconds, click <a href="/cgi-bin/koha/installer/onboarding.pl">Start onboarding process</a>.</p>
68
[% END %]
70
[% END %]
71
72
69
[% IF ( choosemarc ) %]
73
[% IF ( choosemarc ) %]
70
    <h2 align="center">Select your MARC flavor</h2>
74
    <h2 align="center">Choose your setup</h2>
75
    <p>Basic setup selects recommended settings by default.</p>
71
    <form name="frameworkselection" method="post" action="install.pl">
76
    <form name="frameworkselection" method="post" action="install.pl">
72
    <input type="hidden" name="step" value="3" />
77
    <input type="hidden" name="step" value="3" />
73
    <input type="hidden" name="op" value="selectframeworks" />
78
    <input type="hidden" name="op" value="selectframeworks"/>
74
    <p>
79
80
    <div>
81
        <input type="radio" name="setup" value="Basic" checked="checked">Basic<br/>
82
        <input type="radio" name="setup" value="Advanced"/>Advanced<br/>
83
    </div>
84
85
    <h2 align="center">Select your MARC flavor</h2>
86
    <p>MARC stands for Machine Readable Cataloging, containing information about a bibliographic record. MARC21 is more commonly used globally, whereas UNIMARC tends to be used in Europe. </p>
87
75
    [% FOREACH flavourloo IN flavourloop %]
88
    [% FOREACH flavourloo IN flavourloop %]
76
    <div>
89
    <div>
77
            [% IF ( flavourloo.checked ) %]
90
            [% IF ( flavourloo.label == "Unimarc") %]
78
                <input type="radio" name="marcflavour" value="[% flavourloo.code %]" checked /> [% flavourloo.label %] <br/>
91
                 <input type="radio" name="marcflavour" value="[% flavourloo.code %]" /> [% flavourloo.label %]<br/>
79
            [% ELSE %]
92
            [% ELSE %]
80
                <input type="radio" name="marcflavour" value="[% flavourloo.code %]" /> [% flavourloo.label %] <br/>
93
                 <input type="radio" name="marcflavour" value="[% flavourloo.code %]" checked="checked" /> [% flavourloo.label %] <br/>
81
            [% END %]
94
            [% END %]
82
    </div>
95
    </div>
83
    [% END %]
96
    [% END %]
84
    </p>
97
85
    <p> Click 'Next' to continue <input value="Next &gt;&gt;" type="submit" /></p>
98
        <p>Click 'Next' to continue <input value="Next &gt;&gt;" type="submit" /></p>
99
86
    </form>
100
    </form>
101
87
[% END %]
102
[% END %]
88
103
89
[% IF ( selectframeworks ) %]
104
[% IF ( selectframeworks ) %]
90
    <h2 align="center">Selecting Default Settings</h2>
105
        <h2 align= "center"> [% setup %] setup</h2>
91
    <script type="text/javascript">
106
        <h2 align="center">Selecting Default Settings</h2>
92
        var linklabel = _("Select all sample data");
93
        document.write('<p><a href="#" onclick="return selectAllFrameworks();">'+linklabel+'</a></p>');
94
    </script>
95
    <form name="frameworkselection" method="post" action="install.pl">
96
    <input type="hidden" name="step" value="3" />
97
    <input type="hidden" name="op" value="addframeworks" />
98
107
108
        [% IF setup == "Advanced" %]
109
            <script type="text/javascript">
110
                var linklabel = _("Select all options");
111
                document.write('<p><a href="#" onclick="return selectAllFrameworks();"><button>'+linklabel+'</button></a></p>');
112
            </script>
113
        [% END %]
114
        <form name="frameworkselection" method="post" action="install.pl">
115
            <input type="hidden" name="step" value="3" />
116
            <input type="hidden" name="op" value="addframeworks" />
99
    [% IF ( frameworksloop ) %]
117
    [% IF ( frameworksloop ) %]
100
    <h2>MARC frameworks: [% marcflavour %]</h2>
118
        <h2>MARC frameworks: [% marcflavour %]</h2>
101
    [% IF ( en_marc_frameworks ) %]
119
        [% IF ( en_marc_frameworks ) %]
102
        <h4><span class="error">No MARC frameworks are available for your language.
120
            <h4><span class="error">No MARC frameworks are available for your language.
103
                Defaulting to the frameworks supplied for English (en)<span></h4>
121
                    Defaulting to the frameworks supplied for English (en)<span></h4>
104
    [% END %]
122
        [% END %]
105
    [% FOREACH frameworksloo IN frameworksloop %]
123
        [% FOREACH frameworksloo IN frameworksloop %]
106
    <div>
124
           <div>
107
    <h3>[% frameworksloo.label %]</h3>
125
           <h3>[% frameworksloo.label %]</h3>
108
    [% FOREACH framework IN frameworksloo.frameworks %]
126
           [% FOREACH framework IN frameworksloo.frameworks %]
109
        <table style="border:1px;vertical-align:top;">
127
                <table style="border:1px;vertical-align:top;">
110
        <tr>
128
                <tr>
111
        <td style="vertical-align:top;">
129
                    <td style = "border:1px; vertical-align:top;">
112
            [% IF ( framework.checked ) %]
130
                        [% IF (frameworksloo.label == "Default") && (setup=="Basic") %]
113
                <input type="checkbox" name="framework" value="[% framework.fwkfile %]" checked="checked" id="[% framework.fwkname %]" />
131
                            <input type="hidden" name="framework" value="[% framework.fwkfile %]" id ="[%framework.fwkname%]" />
114
            [% ELSE %]
132
                        [% ELSE %]
115
                <input type="checkbox" name="framework" value="[% framework.fwkfile %]" id="[% framework.fwkname %]" />
133
                            <input type="checkbox" name="framework" value="[% framework.fwkfile %]" id ="[%framework.fwkname%]" />
116
            [% END %]
134
                        [% END %]
117
        </td>
135
                    </td>
118
        <td>
136
                    <td>
119
            <label for="[% framework.fwkname %]">
137
                    [% IF (frameworksloo.label == "Default") && (setup=="Basic") %]
120
                [% framework.fwkdescription %]
138
                        <ul>
121
                <em>([% framework.fwkname %])</em>
139
                            <li>
122
            </label>
140
                                <label for="[% framework.fwkname %]">
123
        </td>
141
                                    [% framework.fwkdescription %]
124
        </table>
142
                                    <em>([% framework.fwkname %])</em>
125
    [% END %]
143
                                </label>
126
    </div>
144
                            </li>
127
    [% END %]
145
                        </ul>
146
                    </td>
147
                    [% ELSE %]
148
                    <td>
149
                        <label for= "[% framework.fwkname %]">
150
                            [% framework.fwkdescription %]
151
                            <em>([% framework.fwkname %])</em>
152
                        </label>
153
                    </td>
154
                    [% END %]
155
                </tr>
156
                </table>
157
           [% END %]
158
           </div>
159
        [% END %]
128
    <h2>Other data</h2>
160
    <h2>Other data</h2>
129
    [% END %]
161
    [% END %]
130
    [% IF ( en_sample_data ) %]
162
    [% IF ( en_sample_data ) %]
Lines 132-158 Link Here
132
                Defaulting to the samples supplied for English (en)<span></h4>
164
                Defaulting to the samples supplied for English (en)<span></h4>
133
    [% END %]
165
    [% END %]
134
    [% FOREACH levelloo IN levelloop %]
166
    [% FOREACH levelloo IN levelloop %]
135
    <div>
167
        <div>
136
    <h3>[% levelloo.label %]</h3>
168
        <h3>[% levelloo.label %]</h3>
137
    [% FOREACH framework IN levelloo.frameworks %]
169
138
        <table style="border:1px;vertical-align:top;">
170
        [% IF (setup == "Basic" && levelloo.label == "Optional") %]
139
        <tr>
171
            <script type="text/javascript">
140
        <td style="vertical-align:top;">
172
                var linklabel = _("Select all options");
141
            [% IF ( framework.checked ) %]
173
                document.write('<p><a href="#" onclick="return selectAllFrameworks();"><button>'+linklabel+'</button></a></p>');
142
                <input type="checkbox" name="framework" value="[% framework.fwkfile %]" checked="checked" id="[% framework.fwkname %]" />
174
            </script>
143
            [% ELSE %]
175
        [% END %]
144
                <input type="checkbox" name="framework" value="[% framework.fwkfile %]" id="[% framework.fwkname %]" />
176
145
            [% END %]
177
        [% FOREACH framework IN levelloo.frameworks %]
146
        </td>
178
            <table style="border:1px;vertical-align:top;">
147
        <td>
179
            <tr>
148
            <label for="[% framework.fwkname %]">
180
                <td style="vertical-align:top;">
149
                [% framework.fwkdescription %]
181
                [% IF (levelloo.label == "Default" ) && (setup=="Basic")%]
150
                <em>([% framework.fwkname %])</em>
182
                     <input type="hidden" name="framework" value="[% framework.fwkfile %]" id="[%framework.fwkname %]" />
151
            </label>
183
                [% ELSE %]
152
        </td>
184
                     <input type="checkbox" name="framework" value="[%framework.fwkfile %]" id="[%framework.fwkname%]"/>
153
        </table>
185
                [% END %]
154
    [% END %]
186
                </td>
155
    </div>
187
                <td>
188
                [% IF (levelloo.label == "Default") && (setup=="Basic")%]
189
                <ul>
190
                    <li>
191
                        <label for="[% framework.fwkname %]">
192
                            [% framework.fwkdescription %]
193
                            <em>([% framework.fwkname %])</em>
194
                        </label>
195
                    </li>
196
                </ul>
197
                </td>
198
                [% ELSE %]
199
                <td>
200
                    <label for= "[% framework.fwkname %]">
201
                        [% framework.fwkdescription %]
202
                        <em>([% framework.fwkname %])</em>
203
                    </label>
204
                </td>
205
                [% END %]
206
            </tr>
207
            </table>
208
        [% END %]
209
        </div>
156
    [% END %]
210
    [% END %]
157
    <p>When you've made your selections, please click 'Import' below to begin the process. It may take a while to complete,
211
    <p>When you've made your selections, please click 'Import' below to begin the process. It may take a while to complete,
158
    please be patient.</p>
212
    please be patient.</p>
Lines 173-183 Link Here
173
    [% END %]
227
    [% END %]
174
    <h3>All done!</h3>
228
    <h3>All done!</h3>
175
    <p>Installation complete.<br />
229
    <p>Installation complete.<br />
176
        <p>Click on 'Finish' to complete and load the Koha Staff Interface.
230
        <p>Click on 'Set up Koha with the onboarding tool' to complete and load the Koha onboarding tool.
177
        <form name="finish">
231
        <form name="finish">
178
        <input type="hidden" name="step" value="3" />
232
        <input type="hidden" name="step" value="3" />
179
        <input type="hidden" name="op" value="finish" />
233
        <input type="hidden" name="op" value="finish" />
180
        <input type="submit" value="Finish" /></form>
234
        <input type="submit" value="Set up Koha with the onboarding tool"/>
235
        </form>
181
        </p>
236
        </p>
182
    </p>
237
    </p>
183
[% END %]
238
[% END %]
Lines 210-231 Link Here
210
    </form>
265
    </form>
211
[% END %]
266
[% END %]
212
267
213
214
[% IF ( default ) %]
268
[% IF ( default ) %]
215
    [% IF ( upgrading ) %]
269
    [% IF ( upgrading ) %]
216
        <p>
270
        <p>
217
            We are upgrading from Koha [% dbversion %] to [% kohaversion %], you must <a href="install.pl?step=3&amp;op=updatestructure" class="button">update your database</a>
271
            We are upgrading from Koha [% dbversion %] to [% kohaversion %], you must update your database.
272
        <br>
273
        <a href="install.pl?step=3&amp;op=updatestructure" class="button"><button>Update Database</button></a>
218
        </p>
274
        </p>
219
    [% ELSE %]
275
    [% ELSE %]
220
        <p>We are ready to do some basic configuration. Please
276
        <p>We are ready to do some basic configuration. Please install some basic configuration settings to continue the installation:
221
            <a href="install.pl?step=3&amp;op=choosemarc" class="button">install basic configuration settings</a>
277
        <br>
222
            to continue the installation.
278
        <br>
223
        </p>
279
            <a href="install.pl?step=3&amp;op=choosemarc" class="button"><button>Install Basic Configuration Settings</button></a>
280
224
    [% END %]
281
    [% END %]
225
[% END %]
282
[% END %]
226
283
227
228
229
[% IF ( updatestructure ) %]
284
[% IF ( updatestructure ) %]
230
  <div><h2 align="center">Updating database structure</h2>
285
  <div><h2 align="center">Updating database structure</h2>
231
  [% IF ( has_update_succeeds ) %]
286
  [% IF ( has_update_succeeds ) %]
Lines 247-253 Link Here
247
 [% UNLESS ( has_update_errors ) %]
302
 [% UNLESS ( has_update_errors ) %]
248
    <p>Everything went OK, update done.</p>
303
    <p>Everything went OK, update done.</p>
249
  [% END %]
304
  [% END %]
250
<a href="install.pl?step=3&amp;op=finished" class="button">Continue to log in to Koha</a>
305
<a href="install.pl?step=3&amp;op=choosemarc" class="button"><button>Back to Installation</button></a>
251
  </div>
306
  </div>
252
[% END %]
307
[% END %]
253
308
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt (-2 lines)
Lines 1-5 Link Here
1
[% USE Koha %]
2
[% SET footerjs = 1 %]
3
[% INCLUDE 'doc-head-open.inc' %]
1
[% INCLUDE 'doc-head-open.inc' %]
4
<title>Koha staff client</title>
2
<title>Koha staff client</title>
5
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/mainpage.css" />
3
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/mainpage.css" />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep1.tt (+81 lines)
Line 0 Link Here
1
<!--Includes for creating library-->
2
[% INCLUDE 'doc-head-open.inc' %]
3
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
4
[% INCLUDE 'installer-doc-head-close.inc' %]
5
[% INCLUDE 'datatables.inc' %]
6
7
[% IF (libraries && libraries.count > 1) %]
8
    <meta http-equiv="refresh" content="0; url=/cgi-bin/koha/installer/onboarding.pl?step=2">
9
10
[% ELSIF (op == "add_validate_library") %]
11
    <head>
12
        <title>Welcome &rsaquo; to  &rsaquo; Koha</title>
13
    </head>
14
15
    <!--Header for the koha onboarding tool-->
16
    <div>
17
        <h1 id="logo"><img alt="Koha" src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/> Welcome to Koha</h1>
18
    </div>
19
20
<!--New Library created-->
21
       [% IF message == "success_on_insert" %]
22
            <form name="createlibrary" method="post" action="onboarding.pl" >
23
                <input type="hidden" name="step" value="2"/>
24
                <h1 align="left"> New library</h1>
25
                <div>
26
                    <p> Success: library created!
27
                    </p>
28
                    <p> To add another library and for more settings, <br>
29
                    go to:<br>
30
                    More -> Administration -> Libraries and groups<br>
31
                    </p>
32
                </div>
33
                Next up:
34
                <input type="submit" name="start" value="Minimal patron category setup"/>
35
            </form>
36
37
        [%ELSE %]
38
            <form name="retrylibrary" method="post" action="onboarding.pl">
39
                <input type="hidden" name="step" value="1"/>
40
                <h1 align="left">Failed </h1>
41
                <div>
42
                    <p> Library was not successfully created</br>
43
                    Please try again or contact your system administrator. </p>
44
                </div>
45
                <input type="submit" value="Try again"/>
46
            </form>
47
        [%END%]
48
49
[% ELSE %]
50
    <head>
51
        <title>Welcome &rsaquo; to  &rsaquo; Koha</title>
52
    </head>
53
54
    <!--Header for the koha onboarding tool-->
55
    <div>
56
        <h1 id="logo"><img alt="Koha" src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/> Welcome to Koha</h1>
57
    </div>
58
59
<!--Create a library screen 1-->
60
        <form name="LibraryCreation" method="post" action="onboarding.pl">
61
            <fieldset class="rows" >
62
                 <h2>Create a library</h2>
63
                 <input type="hidden" name="step" value="1"/>
64
                 <input type="hidden" name="op" value="add_validate_library"/>
65
                 <ol>
66
                     <li>
67
                        <label for="branchcode" class="required">Library code: </label>
68
                        <input type="text"  pattern="^[A-Za-z]{0,10}$" title="Please enter 3 capital letters" name="branchcode" id="branchcode" size="10" maxlength="10" value="[% library.branchcode |html %]" class="required" required="required" />
69
                        <span class="required">Required</span>
70
                    </li>
71
                    <li>
72
                        <label for="branchname" class="required">Name: </label>
73
                        <input type="text" pattern="[a-zA-Z ]+" title="Please enter a sentence of letters only" name="branchname" id="branchname" size="42" value="[% library.branchname |html %]" class="    required" required="required" style="width:200px;">
74
                        <span class="required">Required</span>
75
                    </li>
76
                 </ol>
77
             <br>
78
             <input type="submit" class="action" value="Submit"/>
79
            </fieldset>
80
     </form>
81
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep2.tt (+405 lines)
Line 0 Link Here
1
<!--Pragmas for using and including packages for create patron category-->
2
[% USE Koha %]
3
[% USE KohaDates %]
4
[% USE Price %]
5
[% INCLUDE 'doc-head-open.inc' %]
6
<title> Add a patron category</title>
7
[% INCLUDE 'installer-doc-head-close.inc' %]
8
[% INCLUDE 'calendar.inc' %]
9
10
<script type="text/javascript">
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">
169
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."));
171
var MSG_ONLY_ONE_ENROLLMENTPERIOD=(_("Please only choose one enrolment period."));
172
var MSG_DESCRIPTION_LETTERS_ONLY=(_("Please only enter letters."));
173
</script>
174
175
<script type="text/javascript">
176
jQuery.validator.addMethod( "category_code_check", function(value,element){
177
     var patt = /^[A-Za-z]{0,10}$/g;
178
     if (patt.test(element.value)) {
179
              return true;
180
     } else {
181
              return false;
182
     }
183
}, MSG_CATEGORYCODE_CHARS
184
);
185
jQuery.validator.addMethod( "letters_only", function(value,element){
186
        var patt =/^[A-Za-z ]{0,30}$/g;
187
        if (patt.test(element.value)){
188
            return true;
189
        } else {
190
            return false;
191
        }
192
    }, MSG_DESCRIPTION_LETTERS_ONLY
193
);
194
195
jQuery.validator.addMethod( "enrollment_period", function(){
196
      enrolmentperiod = $("#enrolmentperiod").val();
197
      enrolmentperioddate = $("#enrolmentperioddate").val();
198
      if (( $("#enrolmentperiod").val() == "" && $("#enrolmentperioddate").val() == "") || ($("#enrolmentperiod").val() !== "" && $("#enrolmentperioddate").val() !== "")) {
199
             return false;
200
      } else {
201
             return true;
202
      }
203
    }, MSG_ONLY_ONE_ENROLLMENTPERIOD
204
);
205
206
$(document).ready(function() {
207
      $("#enrolmentperioddate").datepicker({
208
            minDate: 1
209
      }); // Require that "until date" be in the future
210
      if ($("#branches option:selected").length < 1) {
211
          $("#branches option:first").attr("selected", "selected");
212
      }
213
      $("#categorycode").on("blur",function(){
214
           toUC(this);
215
      });
216
      $("#category_form").validate({
217
                rules: {
218
                     categorycode: {
219
                            required: true,
220
                            category_code_check: true
221
                     },
222
                     description: {
223
                            required:true,
224
                            letters_only: true
225
                     },
226
                     enrolmentperiod: {
227
                           required: function(element){
228
                                 return $("#enrolmentperioddate").val() === "";
229
                           },
230
                           digits: true,
231
                           enrollment_period: true,
232
                    },
233
                     enrolmentperioddate: {
234
                            required: function(element){
235
                               return $("#enrolmentperiod").val() === "";
236
                            },
237
                            enrollment_period: true,
238
                           // is_valid_date ($(#"enrolementperioddate").val());
239
                    },
240
                     dateofbirthrequired: {
241
                             digits: true
242
                     },
243
                     upperagelimit: {
244
                             digits: true
245
                     },
246
                     enrolmentfee: {
247
                             number: true
248
                     },
249
                     reservefee: {
250
                             number: true
251
                     },
252
                     category_type: {
253
                             required: true
254
                    }
255
                },
256
                messages: {
257
                      enrolmentperiod: {
258
                             required: MSG_ONE_ENROLLMENTPERIOD
259
                      },
260
                      enrolmentperioddate: {
261
                             required: MSG_ONE_ENROLLMENTPERIOD
262
                      }
263
                }
264
       });
265
});
266
267
</script>
268
</head>
269
270
[% 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-->
271
272
273
     <meta http-equiv="refresh" content="0; url=/cgi-bin/koha/installer/onboarding.pl?step=3">
274
275
[% ELSIF (op == "add_validate_category") %]
276
<!--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-->
277
278
    <div> <!-- Header that appears at the top of every screen in the koha onboarding tool-->
279
        <h1 id="logo"><img alt="Koha" src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/> Welcome to Koha</h1>
280
    </div>
281
282
    [% IF message != "error_on_insert" %]
283
     <form name="createcat" method="post" action="onboarding.pl">
284
            <input type="hidden" name="step" value="3"/>
285
             <h1 align="left">  New patron category</h1>
286
             <div>
287
                 <p> Success: patron category created! </p>
288
                 <p> To add another patron category and for more settings<br>
289
                 go to:<br>
290
                 More -> Administration -> Patron categories<br>
291
             </div>
292
             Next up:<br>
293
             <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-->
294
     </form>
295
     [% ELSE %]
296
        <form name="retrypatcat" method="post" action="onboarding.pl">
297
        Message is [% message %]
298
        <input type="hidden" name="step" value="2"/>
299
            <h1 align="left">Failed</h1>
300
            <div>Patron category was not successfully created.</br>
301
            Please try again or contact your system administrator.</p>
302
            </div>
303
            <input type="submit" value="Try again"/>
304
        </form>
305
    [% END %]
306
307
308
[% ELSE %] <!--Else display create patron category screen 1 where the user can input values to create their first patron category-->
309
    <div> <!-- Header that appears at the top of every screen in the koha onboarding tool-->
310
        <h1 id="logo"><img alt="Koha" src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/> Welcome to Koha</h1>
311
    </div>
312
313
    <h1 align="left"> Create a new patron category</h1>
314
    <p> The patron category you create in this form is going to be the one which the new administrator patron account will have.</p>
315
       <form id="category_form" method="post" action="onboarding.pl">
316
       <fieldset class="rows">
317
            <input type="hidden" name="step" value="2"/>
318
            <input type="hidden" name="op" value="add_validate_category" />
319
                <ol>
320
                    <li>
321
                        <label for="categorycode" class="required">Category code: </label>
322
                        <input type="text" pattern="^[A-Za-z]{0,10}$" title="Please enter 1 or 2 capital letters" id="categorycode" name="categorycode" value="[% category.categorycode |html %]" size="10" maxlength="10" class="required" required="required" />
323
                        <span class="required">Required</span>
324
                    </li>
325
326
                    <li>
327
                        <label for="description" class="required">Description: </label>
328
                        <input type="text"  pattern="[a-zA-Z ]+" title="Please enter a description sentence of letters only" name="description" size="40" maxlength="80" class="required" required="required" value="[% category.description |html %]" />
329
                        <span class="required">Required</span>
330
                    </li>
331
332
                    <li>
333
                        <label for="overduenoticerequired">Overdue notice required: </label>
334
                        <select name="overduenoticerequired" value="overduenoticerequired">
335
                            [% IF category.overduenoticerequired %]
336
                                <option value="0">No</option>
337
                                <option value="1" selected="selected">Yes</option>
338
                            [% ELSE %]
339
                                <option value="0" selected="selected">No</option>
340
                                <option value="1">Yes</option>
341
                            [% END %]
342
                        </select>
343
                    </li>
344
345
                    <li>
346
                        <label for="category_type" class="required">Category type: </label>
347
                        <select name="category_type" value="category_type" class='required' required='required'>
348
                            [% IF category and category.category_type == 'S' %]
349
                                <option value="S" selected="selected">Staff</option>
350
                            [% ELSE %]
351
                                <option value="S">Staff</option>
352
                            [% END %]
353
                        </select>
354
                        <span class="required">Required</span>
355
                    </li>
356
357
                    <li>
358
                        <label for="default_privacy">Default privacy: </label>
359
                        <select value="default_privacy" name="default_privacy" required="required">
360
                            [% SET default_privacy = 'default' %]
361
362
                            [% IF category %]
363
                               [% SET default_privacy = category.default_privacy %]
364
                            [% END %]
365
366
                            [% SWITCH default_privacy %]
367
                            [% CASE 'forever' %]
368
                                <option value="default">Default</option>
369
                                <option value="never">Never</option>
370
                                <option value="forever" selected="selected">Forever</option>
371
                            [% CASE 'never' %]
372
                                <option value="default">Default</option>
373
                                <option value="never" selected="selected">Never</option>
374
                                <option value="forever">Forever</option>
375
                            [% CASE %]
376
                                <option value="default" selected="selected">Default</option>
377
                                <option value="never">Never</option>
378
                                <option value="forever">Forever</option>
379
                            [% END %]
380
                        </select>
381
                        <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>
382
                    </li>
383
            </ol>
384
            <span class="label">Enrolment period: </span>
385
            </br>
386
                    <fieldset>
387
                    <legend>Choose one</legend>
388
                            <ol>
389
                                <li>
390
                                    <label for="enrolmentperiod" style="width:6em;">In months: </label>
391
                                    <input type="number" class="enrolmentperiod" name="enrolmentperiod" id="enrolmentperiod" size="3" maxlength="3" value="[% IF category.enrolmentperiod %][% category.enrolmentperiod %][% END %]" /> months
392
                                </li>
393
                                <li>
394
                                    <label for="enrolmentperioddate" style="width:6em;">Until date: </label>
395
                                    <input type="text" class="enrolmentperioddate datepicker" name="enrolmentperioddate" id="enrolmentperioddate" value="[% category.enrolmentperioddate | $KohaDates %]" />
396
                                </li>
397
                            </ol>
398
                     </fieldset>
399
                    <br>
400
                    <input type="submit" class="action" value="Submit" />
401
    </fieldset>
402
    </form>
403
[% END %]
404
405
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep3.tt (+241 lines)
Line 0 Link Here
1
<!--Includes for creating patron-->
2
[% USE Koha %]
3
[% USE KohaDates %]
4
[% USE Price %]
5
[% INCLUDE 'doc-head-open.inc' %]
6
[% IF ( finish ) %]<meta http-equiv="refresh" content="10; url=/cgi-bin/koha/mainpage.pl">[% END%]
7
[% INCLUDE 'installer-doc-head-close.inc' %]
8
[% INCLUDE 'calendar.inc' %]
9
[% INCLUDE 'datatables.inc' %]
10
11
<head>
12
<title>Create Koha administrator patron</title>
13
14
<!--jQuery scripts for creating patron-->
15
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.fixFloat.js"></script>
16
17
<script type="text/javascript">
18
 var MSG_CATEGORYCODE_CHARS=(_("Please only enter letters into this field."));
19
 var MSG_PASSWORD_MISMATCH=(_("The entered passwords do not match, please rewrite them"));
20
 </script>
21
22
<script type="text/javascript">
23
jQuery.validator.addMethod( "password_match", function(value,element){
24
        var MSG_PASSWORD_MISMATCH = (_("The passwords entered do not match"));
25
        var password = document.getElementById('password').value
26
        var confirmpassword = document.getElementById('password2').value
27
28
        if ( password != confirmpassword ){
29
               return false;
30
          }
31
          else{
32
               return true
33
          }
34
    },  MSG_PASSWORD_MISMATCH
35
);
36
37
jQuery.validator.addMethod( "letters_only", function(value,element){
38
         var patt =/^[a-zA-Z ]+$/g;
39
         if (patt.test(element.value)){
40
             return true;
41
         } else {
42
             return false;
43
         }
44
     }, MSG_DESCRIPTION_LETTERS_ONLY
45
);
46
47
48
jQuery.validator.addMethod( "cardnumber_check", function(value,element){
49
          var patt =/[A-Za-z1-9 ]+$/g;
50
          if (patt.test(element.value)){
51
              return true;
52
          } else {
53
              return false;
54
          }
55
     }, MSG_CARDNUMBER_LETTERS_NUMBERS_ONLY
56
);
57
58
59
60
61
$(document).ready(function(){
62
63
    $("#Submit").click(function(){
64
        $("#createpatron").validate({
65
         rules: {
66
            surname: {
67
                required: true,
68
                letters_only: true
69
            },
70
            firstname: {
71
                required: true,
72
                letters_only: true
73
            },
74
            cardnumber: {
75
                required: true,
76
                cardnumber_check: true
77
            },
78
           password: {
79
                 password_match:true
80
            }
81
         },
82
         messages: {
83
            surname: {
84
                required: MSG_DESCRIPTION_LETTERS_ONLY
85
            },
86
            firstname: {
87
                required: MSG_DESCRIPTION_LETTERS_ONLY
88
            },
89
            cardnumber: {
90
                required: MSG_CARDNUMBER_LETTERS_NUMBERS_ONLY
91
            },
92
            password: {
93
                 required: MSG_PASSWORD_MISMATCH
94
            },
95
         }
96
97
     });
98
});
99
});
100
</script>
101
</head>
102
103
<div>
104
    <h1 id="logo"><img alt="Koha" src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/> Welcome to Koha</h1>
105
</div>
106
107
108
[%  IF (nok) %]
109
        <form name="errors" method="post" action="onboarding.pl">
110
            <input type="hidden" name="step" value="3"/>
111
            <h1 align="left">There was an error</h1>
112
            <p>Try again </p>
113
            <div>
114
            <ul>
115
            [% IF errorloginexists %]
116
                <li id="ERROR_login_exist">Username/password already exists.</li>
117
            [% END %]
118
            [% IF errorcardnumberexists %]
119
                <li id="ERROR_cardnumber">Cardnumber already in use.</li>
120
            [% END %]
121
            [% IF errorcardnumberlength %]
122
                <li id="ERROR_cardnumber">Cardnumber length is incorrect</li>
123
            [% END %]
124
            [% IF errorshortpassword %]
125
                <li id="ERROR_short_password">Password length is incorrect, must be at least [% minPasswordLength %] characters long.</li>
126
            [% END %]
127
            [% IF errorpasswordmismatch %]
128
                <li id="ERROR_password_mismatch">Passwords do not match.</li>
129
            [% END %]
130
            </ul>
131
132
            </div>
133
            <input type="submit" name="step" value="Try again"/>
134
        </form>
135
136
137
<!--Create a patron screen 2-->
138
[% ELSIF op == 'add_validate' %]
139
          <!--New patron created-->
140
        <form name="patrondone" method="post" action="onboarding.pl">
141
            <input type="hidden" name="step" value="4"/>
142
            <h1 align="left"> Koha administrator patron </h1>
143
            <div>
144
                 <p> Success: administrator patron created!</p>
145
                 <p> To create another patron, go to Patrons -> New Patron. <br>
146
                More -> Set Permissions in a user page to gain superlibrarian permissions.
147
            </div>
148
            Next up:
149
            <input type="submit" name="start" value="Minimal item type setup"/>
150
        </form>
151
[% ELSE %]
152
<!--Create a patron screen 1-->
153
       <h1 align="left"> Create koha administrator patron</h1>
154
        <p>
155
        Now we will create a patron with superlibrarian permissions. Login with this to access Koha as a staff member will all permissions.
156
        </p>
157
        <form name="createpatron" id="createpatron" method="post" action="onboarding.pl">
158
            <fieldset class="rows">
159
                 <input type="hidden" name="step" value="3"/>
160
                 <input type="hidden" name="op" value="add_validate" />
161
                    <legend id="library_management_lgd">Library management</legend>
162
                    <ol>
163
                    <h3>Patron identity</h3>
164
                        <li>
165
                            <label for="surname" class="required">Surname: </label>
166
                            <input type="text"  pattern="[a-zA-Z- ]+" title="Please only enter letters in the surname field" id="surname" name="surname"  value="[% surname %]" class="required" required="required" />
167
                            <span class="required">Required</span>
168
                        </li>
169
                        <li>
170
                            <label for="firstname" class="required">First name: </label>
171
                            <input  type="text"  pattern="[a-zA-Z ]+" title="Please only enter letters in the firstname field" name="firstname" id="firstname" size="20" value="[% firstname |html %]" class="required" required="required">
172
                            <span class="required">Required</span>
173
                        </li>
174
                    </ol>
175
176
                    <ol>
177
                        <li>
178
                            <label for="cardnumber" class="required">Card number: </label>
179
                            [% IF patrons && patrons > 1 %]
180
                            <input type="text" pattern="[A-Za-z1-9 ]+" title="Please only enter letters and numbers into the card number field" id="cardnumber" class="noEnterSubmit valid" name="cardnumber" value="[% newcardnumber %]" class="required" required="required">
181
                            [% ELSE %]
182
                            <input type="text" pattern="[A-Za-z1-9 ]+" title="Please only enter letters and numbers into the card number field"id="cardnumber" name="cardnumber" value="[% cardnumber %]" class="required" required="required">
183
                            [% END %]
184
                            <span class="required">Required</span>
185
                        </li>
186
                        <li>
187
188
                        <!--require a foreach loop to get all the values for the library that the user has either imported (in web installer) or created in the first step of this onboarding tool-->
189
                            <label for="libraries" class="required"> Library: </label>
190
                            <select name="libraries" size="1" id="libraries">
191
192
                             [% FOREACH library IN libraries %]
193
                                  <option name="libraries" value="[% library.branchcode %]"> [% library.branchname %]
194
                             [% END %]
195
196
                                </select>
197
                            <span class="required"> Required</span>
198
                        </li>
199
                        <li>
200
                            <label for="categorycode_entry" class="required"> Patron category</label>
201
                            <select id="categorycode_entry" name="categorycode_entry" onchange="update_category_code(this);">
202
                            [% FOREACH category IN categories %]
203
                                <option name="categorycode_entry" value = "[% category.categorycode %]">[%category.description %]</option>
204
                            [% END %]
205
                            </select>
206
                            <span class="required">Required</span><br><br>
207
                            <b>Note:</b> If you installed sample patron categories please select the "Staff" option in the patron categories dropdown box.
208
                        </li>
209
                    </ol>
210
211
                    <ol>
212
                            <h3> Koha administrator patron permissions</h3>
213
                            <input type="hidden" name="newflags" value="1"/>
214
                            <li>
215
                                <input type="hidden" class="flag parent" id="flag-0" name="flag" value="superlibrarian"/>
216
                                <label name="permissioncode" for="flag-0"> superlibrarian</label>
217
                            </li>
218
                    </ol>
219
                    <ol>
220
                    <h3>OPAC/Staff Login</h3>
221
                        <li>
222
                            <input type="hidden" name="BorrowerMandatoryField" value = [% BorrowerMandatoryField %] />
223
                            <label for="userid" class="required">Username: </label>
224
                            <input type="text" name="userid" id ="userid" pattern="[A-Za-z1-9 ]+" title="Please only enter letters or numbers into this username field" size="20" value="[% userid %]" class="required" required="required" />
225
                            <span class="required">Required</span>
226
                        </li>
227
                        <li>
228
                            <label for="passwordlabel" class="required">Password: </label>
229
                            <input type="password" name="password" id="password" size="20" value="[% member.password |html %]" class="required" required="required">
230
                            <span class="required">Required</span>
231
                        </li>
232
                        <li>
233
                            <label for="password2" class="required">Confirm password: </label>
234
                            <input type="password" id="password2" name="password2" size="20" value="" class="required" required="required">
235
                            <span class="required">Required</span>
236
                        </li>
237
                    </ol>
238
             </fieldset><br>
239
                <input type="submit" id="Submit" class="action" value="Submit"/>
240
     </form>
241
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep4.tt (+67 lines)
Line 0 Link Here
1
<!-- includes for creating item type-->
2
[% INCLUDE 'doc-head-open.inc' %]
3
[% IF ( finish ) %]<meta http-equiv="refresh" content="10; url=/cgi-bin/koha/mainpage.pl">[% END%]
4
[% INCLUDE 'installer-doc-head-close.inc' %]
5
<head>
6
    <title>Create item type</title>
7
</head>
8
<div>
9
    <h1 id="logo"><img alt="Koha" src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/> Welcome to Koha</h1>
10
</div>
11
12
[% IF (itemtypes && itemtypes.count >1) %]
13
14
     <meta http-equiv="refresh" content="0; url=/cgi-bin/koha/installer/onboarding.pl?step=5">
15
16
[% ELSIF op == "add_validate" %]
17
        [% IF message != "error_on_insert" %]
18
            <form name="createitemtype" method="post" action="onboarding.pl">
19
                <input type="hidden" name="step" value="5"/>
20
                <h1 align="left"> New Item type </h1>
21
                <div>
22
                    <p> Success: New item type created!</p>
23
                    <p> To create another item type later and for more settings <br>
24
                    go to: <br>
25
                    More -> Administration -> Item types <br>
26
                </div>
27
                Next up:
28
                <input type="submit" value="Add a circulation rule"/>
29
            </form>
30
        [% ELSE %]
31
        <form name="retryitem" method="post" action="onboarding.pl">
32
            <input type="hidden" name="step" value="4"/>
33
            <h1 align="left">Failed </h1>
34
            <div>
35
                <p>Item type was not successfully created. </br>
36
                Please try again or contact your system administrator.
37
                </p>
38
            </div>
39
        </form>
40
        <!--Implement a if statement to check if the item type was successfully created or not -->
41
        [% END %]
42
[% ELSE %]
43
    <!--Create a item type screen 1-->
44
        <h1 align="center"> Create a new Item type </h1>
45
        <p> Item types are used to group related items. Examples of item types are books, cds, and DVDs. <br><br> When adding to your institutions catalogue you will create an item of a particular item type. <br><br> Importantly item types are what you apply     circulation rules to. Circulation rules govern how your institution will lend its items, for example a circulation rule applied to the DVD item type may enforce a payment of $1.00 for borrowing any DVD.</p>
46
        <form name="createitemform" method="post" action="onboarding.pl">
47
            <fieldset class="rows">
48
                <input type="hidden" name="step" value="4"/>
49
                <input type="hidden" name="op" value="add_validate" />
50
                <ol>
51
                    <li>
52
                        <label for="itemtype" class="required">Item type code: </label>
53
                        <input type="text" name="itemtype" pattern="^[A-Za-z]{0,10}$" title="Please enter either 2 or 3 capital letters as the item type" id="itemtype" size="10" maxlength="10"  class="required" required="required" />
54
                        <span class="required">Required</span>
55
                    </li>
56
57
                    <li>
58
                        <label for="description" class="required">Description: </label>
59
                        <input type="text" name="description" pattern="[A-Za-z1-9 ]+" title="Please only enter letters or numbers into this item type description" id="description" size="42" value="[% itemtype.description |html %]" class="required" required="required">
60
                        <span class="required">Required</span>
61
                    </li>
62
                </ol>
63
            <br>
64
            <input type="submit" class="action" value="Submit"/>
65
        </fieldset>
66
        </form>
67
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep5.tt (+127 lines)
Line 0 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Create Circulation rule</title>
3
[% IF ( finish ) %]<meta http-equiv="refresh" content="10; url=/cgi-bin/koha/mainpage.pl">[% END %]
4
[% INCLUDE 'installer-doc-head-close.inc' %]
5
6
<div>
7
    <h1 id="logo"><img alt="Koha" src="[% interface %]/[% theme %]/img/koha.org-logo.gif"/> Welcome to Koha</h1>
8
</div>
9
10
[% IF (finish) %]
11
<h1>Congratulations you have finished and ready to use Koha</h1>
12
<a href="/cgi-bin/koha/mainpage.pl">Start using Koha</a>
13
14
[% END %]
15
16
<!--Create a circulation rule screen 2-->
17
[% IF op == "add_validate" %]
18
        <!--New circulation rule created-->
19
        <form name="finish" method="post" action="onboarding.pl">
20
            <input type="hidden" name="op" value="finish" />
21
            <h1 align="left"> New circulation rule </h1>
22
            <div>
23
                 <p> Success: circulation rule created!</p>
24
                 <p> To create circulation rule, go to <br>
25
                 More -> Administration -> Circulation and Fine Rules
26
            </div>
27
                 Next up:
28
                 <input type="submit" name="op" value="Finish"/>
29
        </form>
30
[% ELSE %]
31
<!--Create a circulation rule screen 1-->
32
       <h1 align="left"> Create a new circulation rule </h1>
33
       <form name="createcirculationrule" method="post" action="onboarding.pl">
34
            <fieldset class="rows">
35
                 <input type="hidden" name="step" value="5"/>
36
                 <input type="hidden" name="op" value="add_validate" />
37
                    <ol>
38
                    <li>
39
                        <label for="branch" class="required"> Library branch</label>
40
                        <select name="branch" id="branchname" required="required">
41
                        <option value""> Choose</option>
42
                        <option value="*" selected="selected">All</option>
43
                        [% FOREACH library IN libraries %]
44
                            <option id="branch" value="[% library.branchcode %]"> [% library.branchname %]</option>
45
                        [% END %]
46
                        </select>
47
                        <span class="required">Required</span>
48
                    </li>
49
                    <li>
50
                        <label for="categorycode" class="required">Patron category: </label>
51
                        <select name="categorycode" id="categorycodeselection" required="required" onchange = "update_categorycode(this);">
52
                            <option value=""> Choose</option>
53
                            <option value="*" selected="selected">All</option>
54
                            [% FOREACH category IN categories %]
55
                                <option id="categorycode" value = "[% category.categorycode %]"> [%category.description %]</option>
56
                            [%END%]
57
                        </select>
58
                        <span class="required">Required</span>
59
                    </li>
60
61
                    <li>
62
                        <label for="itemtype"> Item type: </label>
63
                        <select id="itemtype" name="itemtype" required="required">
64
                        <option value""> Choose </option>
65
                        <option value="*" selected="selected">All</option>
66
                            [% FOREACH item IN itemtypes %]
67
                                <option name="itemtype" value = "[% item.itemtype %]"> [% item.itemtype %]
68
                            [%END%]
69
                        </select>
70
                        <span class="required"> Required</span>
71
                    </li>
72
                    <li>
73
                        <label for="maxissueqty" class="required">Current checkouts allowed: </label>
74
                        <input type="number" min="0" name="maxissueqty" title="Please only enter numbers" id="maxissueqty" size="10" max="10" value="" class="required" required="required" />
75
                        <span class="required">Required</span>
76
                    </li>
77
78
                    <li>
79
                        <label for="issuelength" class="required">Loan period: </label>
80
                        <input type="number" min="0" name="issuelength" title="Please only enter numbers" id="issuelength" size="10" max="10" value="" class="required" required="required" />
81
                        <span class="required">Required</span>
82
                   </li>
83
                   <li>
84
                        <label for="lengthunit">Units: </label>
85
                        <select name="lengthunit" id="lengthunit" required="required">
86
                        <option value=""> Choose </option>
87
                        [% SET units = 'days' %]
88
                        [% IF category %]
89
                            [% SET default_privacy = category.default_privacy %]
90
                        [% END %]
91
92
                        [% SWITCH units %]
93
                             [% CASE 'days' %]
94
                                   <option value="days" selected="selected">Days</option>
95
                                   <option value="hours">Hours</option>
96
                             [% CASE 'hours' %]
97
                                   <option value="days">Days</option>
98
                                   <option value="hours" selected="selected">Hours</option>
99
                        [% END %]
100
                        </select>
101
                     </li>
102
                     <li>
103
                        <label for="renewalsallowed" class="required">Renewals allowed: </label>
104
                        <input type="number" min="0" name="renewalsallowed" title="Please only enter numbers" id="renewalsallowed" size="10" max="10" value="" class="required" required="required" />
105
                        <span class="required">Required</span>
106
                     </li>
107
108
                     <li>
109
                        <label for="renewalperiod" class="required">Renewals period: </label>
110
                        <input type="number" min="0" name="renewalperiod" title="Please only enter numbers" id="renewalperiod" size="10" max="10" value="" class="required" required="required" />
111
                        <span class="required">Required</span>
112
                     </li>
113
114
                     <li>
115
                        <label for="onshelfholds">On shelf holds allowed: </label>
116
                        <select name="onshelfholds" id="onshelfholds" required="required">
117
                              <option value="">Choose</option>
118
                              <option value="yes" selected="selected">Yes</option>
119
                              <option value="anyunavailable">If any unavailable</option>
120
                              <option value="allunavailable">If all unavailable</option>
121
                        </select>
122
                     </li>
123
                  </ol>
124
            </fieldset><br>
125
                <input type="submit" class="action" value="Submit"/>
126
     </form>
127
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/summary.tt (+41 lines)
Line 0 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 (-1 / +43 lines)
Line 0 Link Here
0
- 
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;

Return to bug 17855