From ef07ea6c2c4a51c079bcbbcc215bf63b72f56284 Mon Sep 17 00:00:00 2001
From: Alex Buckley
Date: Wed, 7 Dec 2016 23:20:59 +0000
Subject: [PATCH] bug 17855 - Updated web installer finished
The onboarding tool has been implemented and integrated with the updated
web installer. The onboarding tool has the following functionality:
* After the user has finished the web installer they are automatically
redirected to the onboarding tool with no authentication in between
required
* Ability to create library, patron category, patron (set with
superlibrarian priviliages), item type and circulation rule.
* If the uaser installed sample libraries, patron categories and/or item
types then the step to create one in the onboarding tool will be skipped
and a skipping message will be displayed.
*HTML regxes on all text input fields in all forms in the onboarding
tool this prevents the user from writing in special characters
*Working date picker on the patron category form
Have moved all data values from mandatory to default.
Now all default data values are displayed with a bulletpoint rather than
a selectable checkbox stopping users from unticking neccisary data
values
Test plan:
1. Go through the web installer and onboarding tool with the same steps
as outlined in this below guide and check that the functionality
outlined in the guide exists in the patch:
https://koha-community.org/manual/installation/html/
This is a combination of 67 commits.
Initial 3 HTML screens of the onboarding tool and
the perl onboarding.pl script
Note: The advanced setup option has not yet been
implemented, so what you will see is just the basic setup.
Altered web installer
Moved files from optional to mandatory. Edited
MARC screen so that MARC21 is selected by default.
Conflicts:
koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt
Changed mandatory to default for MARC values
Changed a few file name descriptions to reduce
spacing in installer step 3 screen.
Changed the radiobuttons to bulletpoints for default settings
removed = sign:wq
Fixed bug in installer where a loop was created if
you're database structure needed to be updated.
Redirected this to the marcflavour screen instead
of logging straight into Koha and skipping over
the basic configuration steps.
Changed the bulletpoints to disabled checkboxes
which are checked by default
Backup of step3.tt
Successfully working insertion of the default
options which are shown as bulletpoints
Removed test text
Working insertion of default and optional options
Correctly selected default marc flavour of marc21
NOTE: Mark Tompsett merged the first two commits
Signed-off-by: Mark Tompsett
---
.../mysql/en/{optional => default}/auth_val.sql | 0
.../mysql/en/{optional => default}/auth_val.txt | 0
.../en/{mandatory => default}/auth_values.sql | 0
.../en/{mandatory => default}/auth_values.txt | 0
.../en/{mandatory => default}/class_sources.sql | 6 +-
.../en/{mandatory => default}/class_sources.txt | 0
.../en/{optional => default}/csv_profiles.sql | 2 +-
.../en/{optional => default}/csv_profiles.txt | 2 -
.../message_transport_types.sql | 0
.../message_transport_types.txt | 1 -
.../mysql/en/{optional => default}/parameters.sql | 0
.../mysql/en/{optional => default}/parameters.txt | 0
.../{mandatory => default}/patron_attributes.sql | 0
.../data/mysql/en/default/patron_attributes.txt | 1 +
.../{mandatory => default}/sample_frequencies.sql | 0
.../{mandatory => default}/sample_frequencies.txt | 0
.../en/{mandatory => default}/sample_notices.sql | 0
.../en/{mandatory => default}/sample_notices.txt | 0
.../sample_notices_message_attributes.sql | 1 -
.../sample_notices_message_attributes.txt | 0
.../sample_notices_message_transports.sql | 0
.../sample_notices_message_transports.txt | 0
.../sample_numberpatterns.sql | 0
.../sample_numberpatterns.txt | 0
.../data/mysql/en/mandatory/patron_attributes.txt | 0
.../authorities_normal_marc21.sql | 0
.../marc21/default/authorities_normal_marc21.txt | 9 +
.../marc21_default_matching_rules.sql | 18 +-
.../marc21_default_matching_rules.txt | 5 +-
.../marc21_framework_DEFAULT.sql | 0
.../marc21_framework_DEFAULT.txt | 0
.../marc21_sample_fastadd_framework.sql | 0
.../marc21_sample_fastadd_framework.txt | 0
.../marc21_simple_bib_frameworks.sql | 0
.../marc21_simple_bib_frameworks.txt | 1 -
.../marc21/mandatory/authorities_normal_marc21.txt | 11 -
.../authorities_normal_unimarc.sql | 2 -
.../unimarc/default/authorities_normal_unimarc.txt | 1 +
.../unimarc_framework_DEFAULT.sql | 10 +-
.../unimarc_framework_DEFAULT.txt | 0
.../mandatory/authorities_normal_unimarc.txt | 1 -
.../data/mysql/en/optional/patron_categories.sql | 2 +-
.../data/mysql/en/optional/patron_categories.txt | 6 +-
.../data/mysql/en/optional/sample_holidays.txt | 5 +-
.../data/mysql/en/optional/sample_libraries.txt | 2 +-
.../mysql/en/optional/sample_z3950_servers.txt | 1 +
installer/install.pl | 23 +
installer/onboarding.pl | 593 +++++++++++++++++++++
.../intranet-tmpl/prog/en/includes/calendar.inc | 2 +-
.../intranet-tmpl/prog/en/includes/header.inc | 2 +
.../prog/en/includes/installer-doc-head-close.inc | 15 +
.../prog/en/modules/admin/categories.tt | 2 +-
.../prog/en/modules/installer/Backupstep3.tt | 257 +++++++++
.../prog/en/modules/installer/step3.tt | 206 ++++---
.../intranet-tmpl/prog/en/modules/intranet-main.tt | 2 -
.../prog/en/modules/onboarding/onboardingstep0.tt | 18 +
.../prog/en/modules/onboarding/onboardingstep1.tt | 81 +++
.../prog/en/modules/onboarding/onboardingstep2.tt | 407 ++++++++++++++
.../prog/en/modules/onboarding/onboardingstep3.tt | 206 +++++++
.../prog/en/modules/onboarding/onboardingstep4.tt | 81 +++
.../prog/en/modules/onboarding/onboardingstep5.tt | 125 +++++
koha-tmpl/intranet-tmpl/prog/en/modules/summary.tt | 41 ++
summary.pl | 58 ++
63 files changed, 2071 insertions(+), 135 deletions(-)
rename installer/data/mysql/en/{optional => default}/auth_val.sql (100%)
rename installer/data/mysql/en/{optional => default}/auth_val.txt (100%)
rename installer/data/mysql/en/{mandatory => default}/auth_values.sql (100%)
rename installer/data/mysql/en/{mandatory => default}/auth_values.txt (100%)
rename installer/data/mysql/en/{mandatory => default}/class_sources.sql (99%)
rename installer/data/mysql/en/{mandatory => default}/class_sources.txt (100%)
rename installer/data/mysql/en/{optional => default}/csv_profiles.sql (91%)
rename installer/data/mysql/en/{optional => default}/csv_profiles.txt (83%)
rename installer/data/mysql/en/{mandatory => default}/message_transport_types.sql (100%)
rename installer/data/mysql/en/{mandatory => default}/message_transport_types.txt (98%)
rename installer/data/mysql/en/{optional => default}/parameters.sql (100%)
rename installer/data/mysql/en/{optional => default}/parameters.txt (100%)
rename installer/data/mysql/en/{mandatory => default}/patron_attributes.sql (100%)
create mode 100644 installer/data/mysql/en/default/patron_attributes.txt
rename installer/data/mysql/en/{mandatory => default}/sample_frequencies.sql (100%)
rename installer/data/mysql/en/{mandatory => default}/sample_frequencies.txt (100%)
rename installer/data/mysql/en/{mandatory => default}/sample_notices.sql (100%)
rename installer/data/mysql/en/{mandatory => default}/sample_notices.txt (100%)
rename installer/data/mysql/en/{mandatory => default}/sample_notices_message_attributes.sql (99%)
rename installer/data/mysql/en/{mandatory => default}/sample_notices_message_attributes.txt (100%)
rename installer/data/mysql/en/{mandatory => default}/sample_notices_message_transports.sql (100%)
rename installer/data/mysql/en/{mandatory => default}/sample_notices_message_transports.txt (100%)
rename installer/data/mysql/en/{mandatory => default}/sample_numberpatterns.sql (100%)
rename installer/data/mysql/en/{mandatory => default}/sample_numberpatterns.txt (100%)
delete mode 100644 installer/data/mysql/en/mandatory/patron_attributes.txt
rename installer/data/mysql/en/marcflavour/marc21/{mandatory => default}/authorities_normal_marc21.sql (100%)
create mode 100644 installer/data/mysql/en/marcflavour/marc21/default/authorities_normal_marc21.txt
rename installer/data/mysql/en/marcflavour/marc21/{optional => default}/marc21_default_matching_rules.sql (96%)
rename installer/data/mysql/en/marcflavour/marc21/{optional => default}/marc21_default_matching_rules.txt (61%)
rename installer/data/mysql/en/marcflavour/marc21/{mandatory => default}/marc21_framework_DEFAULT.sql (100%)
rename installer/data/mysql/en/marcflavour/marc21/{mandatory => default}/marc21_framework_DEFAULT.txt (100%)
rename installer/data/mysql/en/marcflavour/marc21/{optional => default}/marc21_sample_fastadd_framework.sql (100%)
rename installer/data/mysql/en/marcflavour/marc21/{optional => default}/marc21_sample_fastadd_framework.txt (100%)
rename installer/data/mysql/en/marcflavour/marc21/{optional => default}/marc21_simple_bib_frameworks.sql (100%)
rename installer/data/mysql/en/marcflavour/marc21/{optional => default}/marc21_simple_bib_frameworks.txt (99%)
delete mode 100644 installer/data/mysql/en/marcflavour/marc21/mandatory/authorities_normal_marc21.txt
rename installer/data/mysql/en/marcflavour/unimarc/{mandatory => default}/authorities_normal_unimarc.sql (99%)
create mode 100644 installer/data/mysql/en/marcflavour/unimarc/default/authorities_normal_unimarc.txt
rename installer/data/mysql/en/marcflavour/unimarc/{mandatory => default}/unimarc_framework_DEFAULT.sql (99%)
rename installer/data/mysql/en/marcflavour/unimarc/{mandatory => default}/unimarc_framework_DEFAULT.txt (100%)
delete mode 100644 installer/data/mysql/en/marcflavour/unimarc/mandatory/authorities_normal_unimarc.txt
create mode 100755 installer/onboarding.pl
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/installer/Backupstep3.tt
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep0.tt
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep1.tt
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep2.tt
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep3.tt
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep4.tt
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep5.tt
create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/summary.tt
create mode 100755 summary.pl
diff --git a/installer/data/mysql/en/optional/auth_val.sql b/installer/data/mysql/en/default/auth_val.sql
similarity index 100%
rename from installer/data/mysql/en/optional/auth_val.sql
rename to installer/data/mysql/en/default/auth_val.sql
diff --git a/installer/data/mysql/en/optional/auth_val.txt b/installer/data/mysql/en/default/auth_val.txt
similarity index 100%
rename from installer/data/mysql/en/optional/auth_val.txt
rename to installer/data/mysql/en/default/auth_val.txt
diff --git a/installer/data/mysql/en/mandatory/auth_values.sql b/installer/data/mysql/en/default/auth_values.sql
similarity index 100%
rename from installer/data/mysql/en/mandatory/auth_values.sql
rename to installer/data/mysql/en/default/auth_values.sql
diff --git a/installer/data/mysql/en/mandatory/auth_values.txt b/installer/data/mysql/en/default/auth_values.txt
similarity index 100%
rename from installer/data/mysql/en/mandatory/auth_values.txt
rename to installer/data/mysql/en/default/auth_values.txt
diff --git a/installer/data/mysql/en/mandatory/class_sources.sql b/installer/data/mysql/en/default/class_sources.sql
similarity index 99%
rename from installer/data/mysql/en/mandatory/class_sources.sql
rename to installer/data/mysql/en/default/class_sources.sql
index 589ea7a..bad1ad4 100644
--- a/installer/data/mysql/en/mandatory/class_sources.sql
+++ b/installer/data/mysql/en/default/class_sources.sql
@@ -1,4 +1,4 @@
---
+--
-- Default classification sources and filing rules
-- for Koha.
--
@@ -10,11 +10,11 @@
-- terms of the GNU General Public License as published by the Free Software
-- Foundation; either version 2 of the License, or (at your option) any later
-- version.
---
+--
-- Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
---
+--
-- You should have received a copy of the GNU General Public License along
-- with Koha; if not, write to the Free Software Foundation, Inc.,
-- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
diff --git a/installer/data/mysql/en/mandatory/class_sources.txt b/installer/data/mysql/en/default/class_sources.txt
similarity index 100%
rename from installer/data/mysql/en/mandatory/class_sources.txt
rename to installer/data/mysql/en/default/class_sources.txt
diff --git a/installer/data/mysql/en/optional/csv_profiles.sql b/installer/data/mysql/en/default/csv_profiles.sql
similarity index 91%
rename from installer/data/mysql/en/optional/csv_profiles.sql
rename to installer/data/mysql/en/default/csv_profiles.sql
index ebf599c..f7c5e22 100644
--- a/installer/data/mysql/en/optional/csv_profiles.sql
+++ b/installer/data/mysql/en/default/csv_profiles.sql
@@ -1,2 +1,2 @@
-INSERT IGNORE INTO export_format( profile, description, content, csv_separator, type )
+INSERT IGNORE INTO export_format( profile, description, content, csv_separator, type )
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" );
diff --git a/installer/data/mysql/en/optional/csv_profiles.txt b/installer/data/mysql/en/default/csv_profiles.txt
similarity index 83%
rename from installer/data/mysql/en/optional/csv_profiles.txt
rename to installer/data/mysql/en/default/csv_profiles.txt
index 9dcff5d..2bca64f 100644
--- a/installer/data/mysql/en/optional/csv_profiles.txt
+++ b/installer/data/mysql/en/default/csv_profiles.txt
@@ -1,3 +1 @@
-CSV profiles
-
Default CSV export profiles; including one for exporting serial claims.
diff --git a/installer/data/mysql/en/mandatory/message_transport_types.sql b/installer/data/mysql/en/default/message_transport_types.sql
similarity index 100%
rename from installer/data/mysql/en/mandatory/message_transport_types.sql
rename to installer/data/mysql/en/default/message_transport_types.sql
diff --git a/installer/data/mysql/en/mandatory/message_transport_types.txt b/installer/data/mysql/en/default/message_transport_types.txt
similarity index 98%
rename from installer/data/mysql/en/mandatory/message_transport_types.txt
rename to installer/data/mysql/en/default/message_transport_types.txt
index 054d914..9665f67 100644
--- a/installer/data/mysql/en/mandatory/message_transport_types.txt
+++ b/installer/data/mysql/en/default/message_transport_types.txt
@@ -1,2 +1 @@
Defines default message transports for email and sms.
-
diff --git a/installer/data/mysql/en/optional/parameters.sql b/installer/data/mysql/en/default/parameters.sql
similarity index 100%
rename from installer/data/mysql/en/optional/parameters.sql
rename to installer/data/mysql/en/default/parameters.sql
diff --git a/installer/data/mysql/en/optional/parameters.txt b/installer/data/mysql/en/default/parameters.txt
similarity index 100%
rename from installer/data/mysql/en/optional/parameters.txt
rename to installer/data/mysql/en/default/parameters.txt
diff --git a/installer/data/mysql/en/mandatory/patron_attributes.sql b/installer/data/mysql/en/default/patron_attributes.sql
similarity index 100%
rename from installer/data/mysql/en/mandatory/patron_attributes.sql
rename to installer/data/mysql/en/default/patron_attributes.sql
diff --git a/installer/data/mysql/en/default/patron_attributes.txt b/installer/data/mysql/en/default/patron_attributes.txt
new file mode 100644
index 0000000..fa912e3
--- /dev/null
+++ b/installer/data/mysql/en/default/patron_attributes.txt
@@ -0,0 +1 @@
+Patron attributes
diff --git a/installer/data/mysql/en/mandatory/sample_frequencies.sql b/installer/data/mysql/en/default/sample_frequencies.sql
similarity index 100%
rename from installer/data/mysql/en/mandatory/sample_frequencies.sql
rename to installer/data/mysql/en/default/sample_frequencies.sql
diff --git a/installer/data/mysql/en/mandatory/sample_frequencies.txt b/installer/data/mysql/en/default/sample_frequencies.txt
similarity index 100%
rename from installer/data/mysql/en/mandatory/sample_frequencies.txt
rename to installer/data/mysql/en/default/sample_frequencies.txt
diff --git a/installer/data/mysql/en/mandatory/sample_notices.sql b/installer/data/mysql/en/default/sample_notices.sql
similarity index 100%
rename from installer/data/mysql/en/mandatory/sample_notices.sql
rename to installer/data/mysql/en/default/sample_notices.sql
diff --git a/installer/data/mysql/en/mandatory/sample_notices.txt b/installer/data/mysql/en/default/sample_notices.txt
similarity index 100%
rename from installer/data/mysql/en/mandatory/sample_notices.txt
rename to installer/data/mysql/en/default/sample_notices.txt
diff --git a/installer/data/mysql/en/mandatory/sample_notices_message_attributes.sql b/installer/data/mysql/en/default/sample_notices_message_attributes.sql
similarity index 99%
rename from installer/data/mysql/en/mandatory/sample_notices_message_attributes.sql
rename to installer/data/mysql/en/default/sample_notices_message_attributes.sql
index a7a6032..8499d3d 100644
--- a/installer/data/mysql/en/mandatory/sample_notices_message_attributes.sql
+++ b/installer/data/mysql/en/default/sample_notices_message_attributes.sql
@@ -6,4 +6,3 @@ values
(4, 'Hold_Filled', 0),
(5, 'Item_Check_in', 0),
(6, 'Item_Checkout', 0);
-
diff --git a/installer/data/mysql/en/mandatory/sample_notices_message_attributes.txt b/installer/data/mysql/en/default/sample_notices_message_attributes.txt
similarity index 100%
rename from installer/data/mysql/en/mandatory/sample_notices_message_attributes.txt
rename to installer/data/mysql/en/default/sample_notices_message_attributes.txt
diff --git a/installer/data/mysql/en/mandatory/sample_notices_message_transports.sql b/installer/data/mysql/en/default/sample_notices_message_transports.sql
similarity index 100%
rename from installer/data/mysql/en/mandatory/sample_notices_message_transports.sql
rename to installer/data/mysql/en/default/sample_notices_message_transports.sql
diff --git a/installer/data/mysql/en/mandatory/sample_notices_message_transports.txt b/installer/data/mysql/en/default/sample_notices_message_transports.txt
similarity index 100%
rename from installer/data/mysql/en/mandatory/sample_notices_message_transports.txt
rename to installer/data/mysql/en/default/sample_notices_message_transports.txt
diff --git a/installer/data/mysql/en/mandatory/sample_numberpatterns.sql b/installer/data/mysql/en/default/sample_numberpatterns.sql
similarity index 100%
rename from installer/data/mysql/en/mandatory/sample_numberpatterns.sql
rename to installer/data/mysql/en/default/sample_numberpatterns.sql
diff --git a/installer/data/mysql/en/mandatory/sample_numberpatterns.txt b/installer/data/mysql/en/default/sample_numberpatterns.txt
similarity index 100%
rename from installer/data/mysql/en/mandatory/sample_numberpatterns.txt
rename to installer/data/mysql/en/default/sample_numberpatterns.txt
diff --git a/installer/data/mysql/en/mandatory/patron_attributes.txt b/installer/data/mysql/en/mandatory/patron_attributes.txt
deleted file mode 100644
index e69de29..0000000
diff --git a/installer/data/mysql/en/marcflavour/marc21/mandatory/authorities_normal_marc21.sql b/installer/data/mysql/en/marcflavour/marc21/default/authorities_normal_marc21.sql
similarity index 100%
rename from installer/data/mysql/en/marcflavour/marc21/mandatory/authorities_normal_marc21.sql
rename to installer/data/mysql/en/marcflavour/marc21/default/authorities_normal_marc21.sql
diff --git a/installer/data/mysql/en/marcflavour/marc21/default/authorities_normal_marc21.txt b/installer/data/mysql/en/marcflavour/marc21/default/authorities_normal_marc21.txt
new file mode 100644
index 0000000..076918f
--- /dev/null
+++ b/installer/data/mysql/en/marcflavour/marc21/default/authorities_normal_marc21.txt
@@ -0,0 +1,9 @@
+Default MARC21 Standard Authority types:
+ Personal Name
+ Corporate Name
+ Meeting Name
+ Uniform Title
+ Chronological Term
+ Topical Term
+ Geographic Name
+ Genre/Form Term
diff --git a/installer/data/mysql/en/marcflavour/marc21/optional/marc21_default_matching_rules.sql b/installer/data/mysql/en/marcflavour/marc21/default/marc21_default_matching_rules.sql
similarity index 96%
rename from installer/data/mysql/en/marcflavour/marc21/optional/marc21_default_matching_rules.sql
rename to installer/data/mysql/en/marcflavour/marc21/default/marc21_default_matching_rules.sql
index 2e538a4..5192044 100644
--- a/installer/data/mysql/en/marcflavour/marc21/optional/marc21_default_matching_rules.sql
+++ b/installer/data/mysql/en/marcflavour/marc21/default/marc21_default_matching_rules.sql
@@ -1,4 +1,4 @@
---
+--
-- Default MARC matching rules for Koha
--
-- Copyright (C) 2007 LiblimeA
@@ -9,31 +9,31 @@
-- terms of the GNU General Public License as published by the Free Software
-- Foundation; either version 2 of the License, or (at your option) any later
-- version.
---
+--
-- Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
---
+--
-- You should have received a copy of the GNU General Public License along
-- with Koha; if not, write to the Free Software Foundation, Inc.,
-- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-INSERT INTO marc_matchers (code, description, record_type, threshold)
+INSERT INTO marc_matchers (code, description, record_type, threshold)
VALUES ('ISBN', '020$a', 'biblio', 1000);
INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'isbn', 1000 FROM marc_matchers;
INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints;
-INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields)
+INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields)
SELECT MAX(matchpoint_id), 1, '020', 'a' FROM matchpoints;
-INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine)
+INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine)
SELECT MAX(matchpoint_component_id), 1, 'ISBN' FROM matchpoint_components;
-INSERT INTO marc_matchers (code, description, record_type, threshold)
+INSERT INTO marc_matchers (code, description, record_type, threshold)
VALUES ('ISSN', '022$a', 'biblio', 1000);
INSERT INTO matchpoints (matcher_id, search_index, score) SELECT MAX(matcher_id), 'issn', 1000 FROM marc_matchers;
INSERT INTO matcher_matchpoints SELECT MAX(matcher_id), MAX(matchpoint_id) FROM matchpoints;
-INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields)
+INSERT INTO matchpoint_components (matchpoint_id, sequence, tag, subfields)
SELECT MAX(matchpoint_id), 1, '022', 'a' FROM matchpoints;
-INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine)
+INSERT INTO matchpoint_component_norms (matchpoint_component_id, sequence, norm_routine)
SELECT MAX(matchpoint_component_id), 1, 'ISSN' FROM matchpoint_components;
INSERT INTO marc_matchers (code, description, record_type, threshold)
diff --git a/installer/data/mysql/en/marcflavour/marc21/optional/marc21_default_matching_rules.txt b/installer/data/mysql/en/marcflavour/marc21/default/marc21_default_matching_rules.txt
similarity index 61%
rename from installer/data/mysql/en/marcflavour/marc21/optional/marc21_default_matching_rules.txt
rename to installer/data/mysql/en/marcflavour/marc21/default/marc21_default_matching_rules.txt
index 471db24..7cbd6f4 100644
--- a/installer/data/mysql/en/marcflavour/marc21/optional/marc21_default_matching_rules.txt
+++ b/installer/data/mysql/en/marcflavour/marc21/default/marc21_default_matching_rules.txt
@@ -1,5 +1,2 @@
Selected matching rules for MARC 21 bibliographic
-records, including:
-
-ISBN
-ISSN
+records, including: ISBN, ISSN
diff --git a/installer/data/mysql/en/marcflavour/marc21/mandatory/marc21_framework_DEFAULT.sql b/installer/data/mysql/en/marcflavour/marc21/default/marc21_framework_DEFAULT.sql
similarity index 100%
rename from installer/data/mysql/en/marcflavour/marc21/mandatory/marc21_framework_DEFAULT.sql
rename to installer/data/mysql/en/marcflavour/marc21/default/marc21_framework_DEFAULT.sql
diff --git a/installer/data/mysql/en/marcflavour/marc21/mandatory/marc21_framework_DEFAULT.txt b/installer/data/mysql/en/marcflavour/marc21/default/marc21_framework_DEFAULT.txt
similarity index 100%
rename from installer/data/mysql/en/marcflavour/marc21/mandatory/marc21_framework_DEFAULT.txt
rename to installer/data/mysql/en/marcflavour/marc21/default/marc21_framework_DEFAULT.txt
diff --git a/installer/data/mysql/en/marcflavour/marc21/optional/marc21_sample_fastadd_framework.sql b/installer/data/mysql/en/marcflavour/marc21/default/marc21_sample_fastadd_framework.sql
similarity index 100%
rename from installer/data/mysql/en/marcflavour/marc21/optional/marc21_sample_fastadd_framework.sql
rename to installer/data/mysql/en/marcflavour/marc21/default/marc21_sample_fastadd_framework.sql
diff --git a/installer/data/mysql/en/marcflavour/marc21/optional/marc21_sample_fastadd_framework.txt b/installer/data/mysql/en/marcflavour/marc21/default/marc21_sample_fastadd_framework.txt
similarity index 100%
rename from installer/data/mysql/en/marcflavour/marc21/optional/marc21_sample_fastadd_framework.txt
rename to installer/data/mysql/en/marcflavour/marc21/default/marc21_sample_fastadd_framework.txt
diff --git a/installer/data/mysql/en/marcflavour/marc21/optional/marc21_simple_bib_frameworks.sql b/installer/data/mysql/en/marcflavour/marc21/default/marc21_simple_bib_frameworks.sql
similarity index 100%
rename from installer/data/mysql/en/marcflavour/marc21/optional/marc21_simple_bib_frameworks.sql
rename to installer/data/mysql/en/marcflavour/marc21/default/marc21_simple_bib_frameworks.sql
diff --git a/installer/data/mysql/en/marcflavour/marc21/optional/marc21_simple_bib_frameworks.txt b/installer/data/mysql/en/marcflavour/marc21/default/marc21_simple_bib_frameworks.txt
similarity index 99%
rename from installer/data/mysql/en/marcflavour/marc21/optional/marc21_simple_bib_frameworks.txt
rename to installer/data/mysql/en/marcflavour/marc21/default/marc21_simple_bib_frameworks.txt
index cf49dc3..7bfd5d6 100644
--- a/installer/data/mysql/en/marcflavour/marc21/optional/marc21_simple_bib_frameworks.txt
+++ b/installer/data/mysql/en/marcflavour/marc21/default/marc21_simple_bib_frameworks.txt
@@ -1,5 +1,4 @@
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:
-
BKS Books, Booklets, Workbooks
CF CD-ROMs, DVD-ROMs, General Online Resources
SR Audio Cassettes, CDs
diff --git a/installer/data/mysql/en/marcflavour/marc21/mandatory/authorities_normal_marc21.txt b/installer/data/mysql/en/marcflavour/marc21/mandatory/authorities_normal_marc21.txt
deleted file mode 100644
index b14f98b..0000000
--- a/installer/data/mysql/en/marcflavour/marc21/mandatory/authorities_normal_marc21.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-Default MARC21 Standard Authority types:
-
- Personal Name
- Corporate Name
- Meeting Name
- Uniform Title
- Chronological Term
- Topical Term
- Geographic Name
- Genre/Form Term
-
diff --git a/installer/data/mysql/en/marcflavour/unimarc/mandatory/authorities_normal_unimarc.sql b/installer/data/mysql/en/marcflavour/unimarc/default/authorities_normal_unimarc.sql
similarity index 99%
rename from installer/data/mysql/en/marcflavour/unimarc/mandatory/authorities_normal_unimarc.sql
rename to installer/data/mysql/en/marcflavour/unimarc/default/authorities_normal_unimarc.sql
index 52267c7..c9f5456 100644
--- a/installer/data/mysql/en/marcflavour/unimarc/mandatory/authorities_normal_unimarc.sql
+++ b/installer/data/mysql/en/marcflavour/unimarc/default/authorities_normal_unimarc.sql
@@ -819,5 +819,3 @@ INSERT INTO `auth_subfield_structure` (`authtypecode`, `tagfield`, `tagsubfield`
('', '886', '2', 'System Code', 'System Code', 0, 0, 8, '', '', '', 0, -5, 0, '', ''),
('', '886', 'a', 'Tag of the Source Format Field', 'Tag of the Source Format Field', 1, 0, 8, '', '', '', 0, -5, 0, '', ''),
('', '886', 'b', 'Indicators and Subfields of the Source Format Field', 'Indicators and Subfields of the Source Format Field', 1, 0, 8, '', '', '', 0, -5, 0, '', '');
-
-
diff --git a/installer/data/mysql/en/marcflavour/unimarc/default/authorities_normal_unimarc.txt b/installer/data/mysql/en/marcflavour/unimarc/default/authorities_normal_unimarc.txt
new file mode 100644
index 0000000..202a9cc
--- /dev/null
+++ b/installer/data/mysql/en/marcflavour/unimarc/default/authorities_normal_unimarc.txt
@@ -0,0 +1 @@
+ Authority structure for UNIMARC in English.
diff --git a/installer/data/mysql/en/marcflavour/unimarc/mandatory/unimarc_framework_DEFAULT.sql b/installer/data/mysql/en/marcflavour/unimarc/default/unimarc_framework_DEFAULT.sql
similarity index 99%
rename from installer/data/mysql/en/marcflavour/unimarc/mandatory/unimarc_framework_DEFAULT.sql
rename to installer/data/mysql/en/marcflavour/unimarc/default/unimarc_framework_DEFAULT.sql
index 94ccaa9..0d65c11 100644
--- a/installer/data/mysql/en/marcflavour/unimarc/mandatory/unimarc_framework_DEFAULT.sql
+++ b/installer/data/mysql/en/marcflavour/unimarc/default/unimarc_framework_DEFAULT.sql
@@ -23,7 +23,7 @@
-- From Zeno Tajoli (2010-08-12):
--
--- Improved default id Koha field (090) and koha date field (099).
+-- Improved default id Koha field (090) and koha date field (099).
-- Insert link to sql coloum biblio.biblionumber in tag 001
-- Insert the use of 942, local data
-- Insert a standard minimun on 995 (holding field)
@@ -72,7 +72,7 @@
insert into `marc_tag_structure`(`tagfield`,`liblibrarian`,`libopac`,`repeatable`,`mandatory`,`authorised_value`,`frameworkcode`) values
('090','System Control Numbers (Koha)','System Control Numbers (Koha)',0,0,'','');
-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
+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
('090','a','Koha biblioitem number (autogenerated)','Koha biblioitem number (autogenerated)',0,0,'biblioitems.biblioitemnumber',9,'','','',0,-5,'',NULL,'','');
-- Local date field/Subfields (099)
@@ -80,9 +80,9 @@ insert into `marc_subfield_structure`(`tagfield`,`tagsubfield`,`liblibrarian`,`
insert into `marc_tag_structure`(`tagfield`,`liblibrarian`,`libopac`,`repeatable`,`mandatory`,`authorised_value`,`frameworkcode`) values
('099','local dates','',0,0,'','');
-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
+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
('099','c','Date of creation (bib. record)','Date of creation (bib. record)',0,0,'biblio.datecreated',0,'','','',0,-5,'',NULL,'','');
-
+
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
('099','d','Last modified date (bib. record)','Last modified data (bib. record)',0,0,'biblio.timestamp',0,'','','',0,-5,'',NULL,'','');
@@ -151,7 +151,7 @@ INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`
('995', 'r', 'Type of item and material', 'Type of item and material', 0, 1, 'items.itype', 10, 'itemtypes', '', '', 0, 0, '', '', '', NULL),
('995', 'u', 'Copy note', 'Copy note', 0, 0, 'items.itemnotes', 10, '', '', '', 0, 0, '', '', '', NULL),
('995', 'v', 'Serial Enumeration / chronology', 'Serial Enumeration / chronology', 0, 0, 'items.enumchron', 10, '', '', '', 0, -1, '', '', '', NULL);
-
+
-- *******************************************************
diff --git a/installer/data/mysql/en/marcflavour/unimarc/mandatory/unimarc_framework_DEFAULT.txt b/installer/data/mysql/en/marcflavour/unimarc/default/unimarc_framework_DEFAULT.txt
similarity index 100%
rename from installer/data/mysql/en/marcflavour/unimarc/mandatory/unimarc_framework_DEFAULT.txt
rename to installer/data/mysql/en/marcflavour/unimarc/default/unimarc_framework_DEFAULT.txt
diff --git a/installer/data/mysql/en/marcflavour/unimarc/mandatory/authorities_normal_unimarc.txt b/installer/data/mysql/en/marcflavour/unimarc/mandatory/authorities_normal_unimarc.txt
deleted file mode 100644
index 6fba0ac..0000000
--- a/installer/data/mysql/en/marcflavour/unimarc/mandatory/authorities_normal_unimarc.txt
+++ /dev/null
@@ -1 +0,0 @@
-Authority structure for UNIMARC in English.
diff --git a/installer/data/mysql/en/optional/patron_categories.sql b/installer/data/mysql/en/optional/patron_categories.sql
index 56439b4..57a00da 100644
--- a/installer/data/mysql/en/optional/patron_categories.sql
+++ b/installer/data/mysql/en/optional/patron_categories.sql
@@ -1,4 +1,4 @@
-INSERT INTO `categories` (`categorycode`, `description`, `enrolmentperiod`, `upperagelimit`, `dateofbirthrequired`, `finetype`, `bulk`, `enrolmentfee`, `overduenoticerequired`, `issuelimit`, `reservefee`, `category_type`) VALUES
+INSERT INTO `categories` (`categorycode`, `description`, `enrolmentperiod`, `upperagelimit`, `dateofbirthrequired`, `finetype`, `bulk`, `enrolmentfee`, `overduenoticerequired`, `issuelimit`, `reservefee`, `category_type`) VALUES
-- Adult Patrons
('PT','Patron',99,999,18,NULL,NULL,'0.000000',1,NULL,'0.000000','A'),
diff --git a/installer/data/mysql/en/optional/patron_categories.txt b/installer/data/mysql/en/optional/patron_categories.txt
index b94941a..45102b3 100644
--- a/installer/data/mysql/en/optional/patron_categories.txt
+++ b/installer/data/mysql/en/optional/patron_categories.txt
@@ -1,6 +1,4 @@
-Sample patron types and categories:
-
-Type: Categories:
+Sample patron types and categories. Types are currently hardcoded but you can manage categories after installation from the administration module.
Adult patron - default patron type
PT - Patron
@@ -21,5 +19,3 @@ Professional - a member of an organization (organization is guarantor)
T - Teacher
S - Staff
B - Board
-
-Types are currently hardcoded, but you can add/edit/delete categories after installation from the administration module.
diff --git a/installer/data/mysql/en/optional/sample_holidays.txt b/installer/data/mysql/en/optional/sample_holidays.txt
index a2d2de9..2f478e1 100644
--- a/installer/data/mysql/en/optional/sample_holidays.txt
+++ b/installer/data/mysql/en/optional/sample_holidays.txt
@@ -1,4 +1 @@
-Sample holidays:
- Sundays
- Christmas
- New Year's
+Sample holidays: Sunday, Christmas, New Year's
diff --git a/installer/data/mysql/en/optional/sample_libraries.txt b/installer/data/mysql/en/optional/sample_libraries.txt
index cbaf05c..2a1bd9a 100644
--- a/installer/data/mysql/en/optional/sample_libraries.txt
+++ b/installer/data/mysql/en/optional/sample_libraries.txt
@@ -1 +1 @@
-A few sample libraries.
+Sample libraries.
diff --git a/installer/data/mysql/en/optional/sample_z3950_servers.txt b/installer/data/mysql/en/optional/sample_z3950_servers.txt
index a0bab98..b7a48c0 100644
--- a/installer/data/mysql/en/optional/sample_z3950_servers.txt
+++ b/installer/data/mysql/en/optional/sample_z3950_servers.txt
@@ -1,3 +1,4 @@
+Allow access to the following servers to search and download record information:
LIBRARY OF CONGRESS
LIBRARY OF CONGRESS NAMES (authority records)
LIBRARY OF CONGRESS SUBJECTS (authority records)
diff --git a/installer/install.pl b/installer/install.pl
index 512ca3c..800e867 100755
--- a/installer/install.pl
+++ b/installer/install.pl
@@ -1,5 +1,22 @@
#!/usr/bin/perl
+# This file is part of Koha.
+# #
+# # Copyright (C) YEAR YOURNAME-OR-YOUREMPLOYER
+# #
+# # Koha is free software; you can redistribute it and/or modify it
+# # under the terms of the GNU General Public License as published by
+# # the Free Software Foundation; either version 3 of the License, or
+# # (at your option) any later version.
+# #
+# # Koha is distributed in the hope that it will be useful, but
+# # WITHOUT ANY WARRANTY; without even the implied warranty of
+# # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# # GNU General Public License for more details.
+# #
+# # You should have received a copy of the GNU General Public License
+# # along with Koha; if not, see .
+
use strict;
use warnings;
use diagnostics;
@@ -199,6 +216,7 @@ elsif ( $step && $step == 3 ) {
# The installer will have to relogin since we do not pass cookie to redirection.
$template->param( "$op" => 1 );
}
+
elsif ( $op && $op eq 'addframeworks' ) {
#
# 1ST install, 3rd sub-step : insert the SQL files the user has selected
@@ -250,6 +268,10 @@ elsif ( $step && $step == 3 ) {
$template->param( "en_sample_data" => $sample_defaulted_to_en);
$template->param( "levelloop" => $levellist );
$template->param( "$op" => 1 );
+
+ my $setup = $query->param('setup');
+ $template->param( "setup"=> $setup );
+
}
elsif ( $op && $op eq 'choosemarc' ) {
#
@@ -270,6 +292,7 @@ elsif ( $step && $step == 3 ) {
# But could also be useful to have some Authorised values data set prepared here.
# Marcflavour Selection is achieved through radiobuttons.
my $langchoice = $query->param('fwklanguage');
+
$langchoice = $query->cookie('KohaOpacLanguage') unless ($langchoice);
$langchoice =~ s/[^a-zA-Z_-]*//g;
my $dir =
diff --git a/installer/onboarding.pl b/installer/onboarding.pl
new file mode 100755
index 0000000..081f2fc
--- /dev/null
+++ b/installer/onboarding.pl
@@ -0,0 +1,593 @@
+#!/usr/bin/perl
+#Recommended pragmas
+
+# This file is part of Koha.
+# #
+# # Copyright (C) YEAR YOURNAME-OR-YOUREMPLOYER
+# #
+# # Koha is free software; you can redistribute it and/or modify it
+# # under the terms of the GNU General Public License as published by
+# # the Free Software Foundation; either version 3 of the License, or
+# # (at your option) any later version.
+# #
+# # Koha is distributed in the hope that it will be useful, but
+# # WITHOUT ANY WARRANTY; without even the implied warranty of
+# # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# # GNU General Public License for more details.
+# #
+# # You should have received a copy of the GNU General Public License
+# # along with Koha; if not, see .
+
+use strict;
+use warnings;
+use diagnostics;
+
+use Modern::Perl;
+use C4::InstallAuth;
+use CGI qw ( -utf8 );
+use List::MoreUtils qw/uniq/;
+use Digest::MD5 qw(md5_base64);
+use Encode qw( encode );
+use C4::Koha;
+use C4::Auth;
+use C4::Context;
+use C4::Output;
+use C4::Form::MessagingPreferences;
+use C4::Members;
+use C4::Members::Attributes;
+use C4::Members::AttributeTypes;
+use C4::Log;
+use C4::Letters;
+use C4::Form::MessagingPreferences;
+use Koha::AuthorisedValues;
+use Koha::Patron::Debarments;
+use Koha::Cities;
+use Koha::Patrons;
+use Koha::Items;
+use Koha::Libraries;
+use Koha::LibraryCategories;
+use Koha::Database;
+use Koha::DateUtils;
+use Koha::Patron::Categories;
+use Koha::Patron::HouseboundRole;
+use Koha::Patron::HouseboundRoles;
+use Koha::Token;
+use Email::Valid;
+use Module::Load;
+use Koha::ItemTypes;
+use Koha::IssuingRule;
+use Koha::IssuingRules;
+
+#Setting variables
+my $input = new CGI;
+my $query = new CGI;
+my $step = $query->param('step');
+
+#Getting the appropriate template to display to the user
+my ( $template, $loggedinuser, $cookie) = C4::InstallAuth::get_template_and_user(
+ {
+ template_name => "/onboarding/onboardingstep" . ( $step ? $step : 0 ) . ".tt",
+ query => $query,
+ type => "intranet",
+ authnotrequired => 0,
+ debug => 1,
+ }
+);
+
+#Check database connection
+my %info;
+$info{'dbname'} = C4::Context->config("database");
+$info{'dbms'} =
+( C4::Context->config("db_scheme")
+ ? C4::Context->config("db_scheme")
+ : "mysql" );
+
+$info{'hostname'} = C4::Context->config("hostname");
+$info{'port'} = C4::Context->config("port");
+$info{'user'} = C4::Context->config("user");
+$info{'password'} = C4::Context->config("pass");
+my $dbh = DBI->connect(
+ "DBI:$info{dbms}:dbname=$info{dbname};host=$info{hostname}"
+ . ( $info{port} ? ";port=$info{port}" : "" ),
+ $info{'user'}, $info{'password'}
+);
+
+
+#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.
+my $op = $query->param('op');
+$template->param('op'=>$op);
+if ( $op && $op eq 'finish' ) { #If the value of $op equals 'finish' then redirect user to /cgi-bin/koha/mainpage.pl
+ print $query->redirect("/cgi-bin/koha/mainpage.pl");
+ exit;
+}
+
+
+#Store the value of the template input name='start' in the variable $start so we can check if the user has pressed this button and started the onboarding tool process
+my $start = $query->param('start');
+$template->param('start'=>$start);
+
+if ( $start && $start eq 'Start setting up my Koha' ){
+ my $libraries = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, );
+ $template->param(libraries => $libraries,
+ group_types => [
+ { categorytype => 'searchdomain',
+ categories => [ Koha::LibraryCategories->search( { categorytype => 'searchdomain' } ) ],
+ },
+ { categorytype => 'properties',
+ categories => [ Koha::LibraryCategories->search( { categorytype => 'properties' } ) ],
+ },
+ ]
+ );
+
+
+}elsif ( $start && $start eq 'Add a patron category' ){
+#Select all the patron category records in the categories database table and give them to the template
+ my $categories = Koha::Patron::Categories->search();
+ $template->param(
+ categories => $categories,
+ );
+
+
+#Check if the $step variable equals 1 i.e. the user has clicked to create a library in the create library screen 1
+}elsif ( $step && $step == 1 ) {
+ my $createlibrary = $query->param('createlibrary'); #Store the inputted library branch code and name in $createlibrary variable
+ $template->param('createlibrary'=>$createlibrary); # Hand the library values back to the template in the createlibrary variable
+
+ #store inputted parameters in variables
+ my $branchcode = $input->param('branchcode');
+ $branchcode = uc($branchcode);
+ my $categorycode = $input->param('categorycode');
+ my $op = $input->param('op') || 'list';
+ my $message;
+ my $library;
+
+ #Take the text 'branchname' and store it in the @fields array
+ my @fields = qw(
+ branchname
+ );
+
+ $template->param('branchcode'=>$branchcode);
+ $branchcode =~ s|\s||g; # Use a regular expression to check the value of the inputted branchcode
+
+ #Create a new library object and store the branchcode and @fields array values in this new library object
+ my $library = Koha::Library->new(
+ { branchcode => $branchcode,
+ ( map { $_ => scalar $input->param($_) || undef } @fields )
+ }
+ );
+
+ eval { $library->store; }; #Use the eval{} function to store the library object
+ if($library){
+ $message = 'success_on_insert';
+ }else{
+ $message = 'error_on_insert';
+ }
+
+ $template->param('message' => $message);
+
+
+#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
+}elsif ( $step && $step == 2 ){
+ my $createcat = $query->param('createcat'); #Store the inputted category code and name in $createcat
+ $template->param('createcat'=>$createcat);
+
+ #Initialising values
+ my $searchfield = $input->param('description') // q||;
+ my $categorycode = $input->param('categorycode');
+ my $op = $input->param('op') // 'list';
+ my $message;
+ my $category;
+ $template->param('categorycode' =>$categorycode);
+
+ my ( $template, $loggedinuser, $cookie ) = C4::InstallAuth::get_template_and_user(
+ {
+ template_name => "/onboarding/onboardingstep2.tt",
+ query => $input,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => { parameters => 'parameters_remaining_permissions' },
+ debug => 1,
+ }
+ );
+
+ #Once the user submits the page, this code validates the input and adds it
+ #to the database as a new patron category
+ $categorycode = $input->param('categorycode');
+ my $description = $input->param('description');
+ my $overduenoticerequired = $input->param('overduenoticerequired');
+ my $category_type = $input->param('category_type');
+ my $default_privacy = $input->param('default_privacy');
+ my $enrolmentperiod = $input->param('enrolmentperiod');
+ my $enrolmentperioddate = $input->param('enrolmentperioddate') || undef;
+
+ #Converts the string into a date format
+ if ( $enrolmentperioddate) {
+ $enrolmentperioddate = output_pref(
+ {
+ dt => dt_from_string($enrolmentperioddate),
+ dateformat => 'iso',
+ dateonly => 1,
+ }
+ );
+ }
+
+#Adds a new patron category to the database
+ $category = Koha::Patron::Category->new({
+ categorycode=> $categorycode,
+ description => $description,
+ overduenoticerequired => $overduenoticerequired,
+ category_type=> $category_type,
+ default_privacy => $default_privacy,
+ enrolmentperiod => $enrolmentperiod,
+ enrolmentperioddate => $enrolmentperioddate,
+ });
+
+ eval {
+ $category->store;
+ };
+
+#Error messages
+ if($category){
+ $message = 'success_on_insert';
+ }else{
+ $message = 'error_on_insert';
+ }
+
+ $template->param('message' => $message);
+
+#Create a patron
+}elsif ( $step && $step == 3 ){
+ my $firstpassword = $input->param('password');
+ my $secondpassword = $input->param('password2');
+
+#Find all library records in the database and hand them to the template to display in the library dropdown box
+ my $libraries = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, );
+ $template->param(libraries => $libraries,
+ group_types => [
+ { categorytype => 'searchdomain',
+ categories => [ Koha::LibraryCategories->search( { categorytype => 'searchdomain' } ) ],
+ },
+ { categorytype => 'properties',
+ categories => [ Koha::LibraryCategories->search( { categorytype => 'properties' } ) ],
+ },
+ ]
+ );
+
+#Find all patron categories in the database and hand them to the template to display in the patron category dropdown box
+ my $categories= Koha::Patron::Categories->search();
+ $template->param(
+ categories => $categories,
+ );
+
+#Incrementing the highest existing patron cardnumber to prevent duplicate cardnumber entry
+ my $exisiting_cardnumber = my $sth_search = $dbh->prepare("SELECT MAX(cardnumber) FROM borrowers");
+ my $new_cardnumber = $exisiting_cardnumber + 1;
+ warn $new_cardnumber;
+ $template->param("newcardnumber" => $new_cardnumber);
+
+
+
+ my $op = $input->param('op') // 'list';
+ my $minpw = C4::Context->preference("minPasswordLength");
+ $template->param("minPasswordLength" => $minpw);
+
+ my @messages;
+ my @errors;
+ my $nok = $input->param('nok');
+ my $firstpassword = $input->param('password');
+ my $secondpassword = $input->param('password2');
+ my $cardnumber= $input->param('cardnumber');
+ my $borrowernumber= $input->param('borrowernumber');
+ my $userid=$input->param('userid');
+
+#If the entered cardnumber causes an error hand this error to the @errors array
+ if(my $error_code = checkcardnumber($cardnumber, $borrowernumber)){
+ push @errors, $error_code == 1
+ ? 'ERROR_cardnumber_already_exists'
+ :$error_code == 2
+ ? 'ERROR_cardnumber_length'
+ :()
+ }
+
+#If the entered password causes an error hand this error to the @errors array
+ push @errors, "ERROR_password_mismatch" if $firstpassword ne $secondpassword;
+ push @errors, "ERROR_short_password" if ($firstpassword && $minpw && $firstpassword ne '****' && (length($firstpassword) < $minpw));
+
+
+#Passing errors to template
+ $nok = $nok || scalar(@errors);
+
+#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
+ if($nok){
+ foreach my $error (@errors){
+ if ($error eq 'ERROR_password_mismatch'){
+ $template->param(errorpasswordmismatch => 1);
+ }
+ if ($error eq 'ERROR_login_exist'){
+ $template->param(errorloginexists =>1);
+ }
+ if ($error eq 'ERROR_cardnumber_already_exists'){
+ $template->param(errorcardnumberexists => 1);
+ }
+ if ($error eq 'ERROR_cardnumber_length'){
+ $template->param(errorcardnumberlength => 1);
+ }
+ if ($error eq 'ERROR_short_password'){
+ $template->param(errorshortpassword => 1);
+ }
+ }
+ $template->param('nok' => 1);
+
+#Else if no errors have been caused by the users inputted card number or password then insert the patron into the borrowers table
+ }else{
+ my ($template, $loggedinuser, $cookie)= C4::InstallAuth::get_template_and_user({
+ template_name => "/onboarding/onboardingstep3.tt",
+ query => $input,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => {borrowers => 1},
+ debug => 1,
+ });
+
+ if($op eq 'add_validate'){
+ my %newdata;
+
+#Store the template form values in the newdata hash
+ $newdata{borrowernumber} = $input->param('borrowernumber');
+ $newdata{surname} = $input->param('surname');
+ $newdata{firstname} = $input->param('firstname');
+ $newdata{cardnumber} = $input->param('cardnumber');
+ $newdata{branchcode} = $input->param('libraries');
+ $newdata{categorycode} = $input->param('categorycode_entry');
+ $newdata{userid} = $input->param('userid');
+ $newdata{password} = $input->param('password');
+ $newdata{password2} = $input->param('password2');
+ $newdata{dateexpiry} = '12/10/2016';
+ $newdata{privacy} = "default";
+
+
+#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
+ my $borrowernumber = &AddMember(%newdata);
+
+#Create a hash named member2 and fill it with the borrowernumber of the borrower that has just been created
+ my %member2;
+ $member2{'borrowernumber'}=$borrowernumber;
+
+#Perform data validation on the flag that has been handed to onboarding.pl by the template
+ my $flag = $input->param('flag');
+ if ($input->param('newflags')) {
+ my $dbh=C4::Context->dbh();
+ my @perms = $input->multi_param('flag');
+ my %all_module_perms = ();
+ my %sub_perms = ();
+ foreach my $perm (@perms) {
+ if ($perm !~ /:/) {
+ $all_module_perms{$perm} = 1;
+ } else {
+ my ($module, $sub_perm) = split /:/, $perm, 2;
+ push @{ $sub_perms{$module} }, $sub_perm;
+ }
+ }
+
+ # construct flags
+ my $module_flags = 0;
+ my $sth=$dbh->prepare("SELECT bit,flag FROM userflags ORDER BY bit");
+ $sth->execute();
+ while (my ($bit, $flag) = $sth->fetchrow_array) {
+ if (exists $all_module_perms{$flag}) {
+ $module_flags += 2**$bit;
+ }
+ }
+
+#Set the superlibrarian permission of the newly created patron to superlibrarian
+ $sth = $dbh->prepare("UPDATE borrowers SET flags=? WHERE borrowernumber=?");
+ $sth->execute($module_flags, $borrowernumber);
+
+
+ #Error handling checking if the patron was created successfully
+ if(!$borrowernumber){
+ push @messages, {type=> 'error', code => 'error_on_insert'};
+ }else{
+ push @messages, {type=> 'message', code => 'success_on_insert'};
+ }
+ }
+ }
+ }
+
+ }elsif ( $step && $step == 4){
+ my $createitemtype = $input->param('createitemtype');
+ $template->param('createitemtype'=> $createitemtype );
+
+
+ my( $template, $borrowernumber, $cookie) = C4::InstallAuth::get_template_and_user(
+ { template_name => "/onboarding/onboardingstep4.tt",
+ query => $input,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => { parameters => 'parameters_remaining_permissions'},
+ debug => 1,
+ }
+ );
+
+ if($op eq 'add_validate'){
+ my $description = $input->param('description');
+ my $itemtype_code = $input->param('itemtype');
+ $itemtype_code = uc($itemtype_code);
+ #Create a new itemtype object using the user inputted itemtype and description
+ my $itemtype= Koha::ItemType->new(
+ { itemtype => $itemtype_code,
+ description => $description,
+ }
+ );
+
+ eval{ $itemtype->store; };
+
+ my $message;
+
+#Fill the $message variable with an error if the item type object was not successfully created and inserted into the itemtypes table
+ if($itemtype){
+ $message = 'success_on_insert';
+ }else{
+ $message = 'error_on_insert';
+ }
+
+ $template->param('message' => $message);
+ }
+}elsif ( $step && $step == 5){
+
+ #Find all the existing categories to display in a dropdown box in the template
+ my $categories;
+ $categories= Koha::Patron::Categories->search();
+ $template->param(
+ categories => $categories,
+ );
+
+ #Find all the exisiting item types to display in a dropdown box in the template
+ my $itemtypes;
+ $itemtypes= Koha::ItemTypes->search();
+ $template->param(
+ itemtypes => $itemtypes,
+ );
+
+ #Find all the exisiting libraries to display in a dropdown box in the template
+ my $libraries = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, );
+ $template->param(libraries => $libraries,
+ group_types => [
+ { categorytype => 'searchdomain',
+ categories => [ Koha::LibraryCategories->search( { categorytype => 'searchdomain' } ) ],
+ },
+ { categorytype => 'properties',
+ categories => [ Koha::LibraryCategories->search( { categorytype => 'properties' } ) ],
+ },
+ ]
+ );
+
+ my $input = CGI->new;
+ my $dbh = C4::Context->dbh;
+
+ my ($template, $loggedinuser, $cookie) = C4::InstallAuth::get_template_and_user({template_name => "/onboarding/onboardingstep5.tt",
+ query => $input,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => {parameters => 'manage_circ_rules'},
+ debug => 1,
+ });
+
+#If no libraries exist then set the $branch value to *
+ my $branch = $input->param('branch');
+ unless ( $branch ) {
+ if ( C4::Context->preference('DefaultToLoggedInLibraryCircRules') ) {
+ $branch = Koha::Libraries->search->count() == 1 ? undef : C4::Context::mybranch();
+ }
+ else {
+ $branch = C4::Context::only_my_library() ? ( C4::Context::mybranch() || '*' ) : '*';
+ }
+ }
+ $branch = '*' if $branch eq 'NO_LIBRARY_SET';
+ my $op = $input->param('op') || q{};
+
+ if($op eq 'add_validate'){
+ my $type = $input->param('type');
+ my $br = $input->param('branch');
+ my $bor = $input->param('categorycode');
+ my $itemtype = $input->param('itemtype');
+ my $maxissueqty = $input->param('maxissueqty');
+ my $issuelength = $input->param('issuelength');
+ my $lengthunit = $input->param('lengthunit');
+ my $renewalsallowed = $input->param('renewalsallowed');
+ my $renewalperiod = $input->param('renewalperiod');
+ my $onshelfholds = $input->param('onshelfholds') || 0;
+ $maxissueqty =~ s/\s//g;
+ $maxissueqty = undef if $maxissueqty !~ /^\d+/;
+ $issuelength = $issuelength eq q{} ? undef : $issuelength;
+
+ my $params ={
+ branchcode => $br,
+ categorycode => $bor,
+ itemtype => $itemtype,
+ maxissueqty => $maxissueqty,
+ renewalsallowed => $renewalsallowed,
+ renewalperiod => $renewalperiod,
+ issuelength => $issuelength,
+ lengthunit => $lengthunit,
+ onshelfholds => $onshelfholds,
+ };
+
+ my @messages;
+
+#New code from smart-rules.tt starts here. Needs to be added to library
+#Allows for the 'All' option to work when selecting all libraries for a circulation rule to apply to.
+ if ($branch eq "*") {
+ my $sth_search = $dbh->prepare("SELECT count(*) AS total
+ FROM default_circ_rules");
+ my $sth_insert = $dbh->prepare("INSERT INTO default_circ_rules
+ (maxissueqty, onshelfholds)
+ VALUES (?, ?)");
+ my $sth_update = $dbh->prepare("UPDATE default_circ_rules
+ SET maxissueqty = ?, onshelfholds = ?");
+
+ $sth_search->execute();
+ my $res = $sth_search->fetchrow_hashref();
+ if ($res->{total}) {
+ $sth_update->execute($maxissueqty, $onshelfholds);
+ } else {
+ $sth_insert->execute($maxissueqty, $onshelfholds);
+ }
+ }
+
+
+#Allows for the 'All' option to work when selecting all patron categories for a circulation rule to apply to.
+ if ($bor eq "*") {
+ my $sth_search = $dbh->prepare("SELECT count(*) AS total
+ FROM default_circ_rules");
+ my $sth_insert = $dbh->prepare(q|
+ INSERT INTO default_circ_rules
+ (maxissueqty)
+ VALUES (?)
+ |);
+ my $sth_update = $dbh->prepare(q|
+ UPDATE default_circ_rules
+ SET maxissueqty = ?
+ |);
+
+ $sth_search->execute();
+ my $res = $sth_search->fetchrow_hashref();
+ if ($res->{total}) {
+ $sth_update->execute($maxissueqty);
+ } else {
+ $sth_insert->execute($maxissueqty);
+ }
+ }
+#Allows for the 'All' option to work when selecting all itemtypes for a circulation rule to apply to
+ if ($itemtype eq "*") {
+ my $sth_search = $dbh->prepare("SELECT count(*) AS total
+ FROM default_branch_circ_rules
+ WHERE branchcode = ?");
+ my $sth_insert = $dbh->prepare("INSERT INTO default_branch_circ_rules
+ (branchcode, onshelfholds)
+ VALUES (?, ?)");
+ my $sth_update = $dbh->prepare("UPDATE default_branch_circ_rules
+ SET onshelfholds = ?
+ WHERE branchcode = ?");
+ $sth_search->execute($branch);
+ my $res = $sth_search->fetchrow_hashref();
+ if ($res->{total}) {
+ $sth_update->execute($onshelfholds, $branch);
+ } else {
+ $sth_insert->execute($branch, $onshelfholds);
+ }
+ }
+#End new code
+
+ my $issuingrule = Koha::IssuingRules->find({categorycode => $bor, itemtype => $itemtype, branchcode => $br });
+ if($issuingrule){
+ $issuingrule->set($params)->store();
+ push @messages, {type=> 'error', code => 'error_on_insert'};#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.
+
+ }else{
+ Koha::IssuingRule->new()->set($params)->store();
+ }
+ }
+}
+
+output_html_with_http_headers $input, $cookie, $template->output;
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc
index f6d9e9b..a4bbe62 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc
@@ -6,7 +6,7 @@ var debug = "[% debug %]";
var dformat = "[% dateformat %]";
var sentmsg = 0;
if (debug > 1) {alert("dateformat: " + dformat + "\ndebug is on (level " + debug + ")");}
-var MSG_PLEASE_ENTER_A_VALID_DATE = _("Please enter a valid date (should match %s).");
+var MSG_PLEASE_ENTER_A_VALID_DATE = (_("Please enter a valid date (should match %s)."));
function is_valid_date(date) {
// An empty string is considered as a valid date for convenient reasons.
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc
index 193bcc1..9e56f71 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc
@@ -42,6 +42,8 @@