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

(-)a/installer/onboarding.pl (-58 / +29 lines)
Lines 2-8 Link Here
2
2
3
# This file is part of Koha.
3
# This file is part of Koha.
4
#
4
#
5
# Copyright (C) YEAR  YOURNAME-OR-YOUREMPLOYER
5
# Copyright (C) YEAR  Alex Buckley CatalystIT
6
#
6
#
7
# Koha is free software; you can redistribute it and/or modify it
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
8
# under the terms of the GNU General Public License as published by
Lines 22-56 use Modern::Perl; Link Here
22
use diagnostics;
22
use diagnostics;
23
use C4::InstallAuth;
23
use C4::InstallAuth;
24
use CGI qw ( -utf8 );
24
use CGI qw ( -utf8 );
25
use List::MoreUtils qw/uniq/;
26
use Digest::MD5 qw(md5_base64);
25
use Digest::MD5 qw(md5_base64);
27
use Encode qw( encode );
26
use Encode qw( encode );
28
use C4::Koha;
27
use C4::Koha;
29
use C4::Context;
30
use C4::Output;
28
use C4::Output;
31
use C4::Form::MessagingPreferences;
32
use C4::Members;
29
use C4::Members;
33
use C4::Members::Attributes;
30
use C4::Members::Attributes;
34
use C4::Members::AttributeTypes;
31
use C4::Members::AttributeTypes;
35
use C4::Log;
32
use C4::Log;
36
use C4::Letters;
37
use C4::Form::MessagingPreferences;
38
use Koha::AuthorisedValues;
33
use Koha::AuthorisedValues;
39
use Koha::Patron::Debarments;
34
use Koha::Patron::Debarments;
40
use Koha::Cities;
41
use Koha::Patrons;
35
use Koha::Patrons;
42
use Koha::Items;
36
use Koha::Items;
43
use Koha::Libraries;
37
use Koha::Libraries;
44
use Koha::LibraryCategories;
45
use Koha::Database;
38
use Koha::Database;
46
use Koha::DateUtils;
39
use Koha::DateUtils;
47
use Koha::Patron::Categories;
40
use Koha::Patron::Categories;
48
use Koha::Patron::Category;
49
use Koha::Patron::HouseboundRole;
41
use Koha::Patron::HouseboundRole;
50
use Koha::Patron::HouseboundRoles;
42
use Koha::Patron::HouseboundRoles;
51
use Koha::Token;
52
use Email::Valid;
53
use Module::Load;
54
use Koha::ItemTypes;
43
use Koha::ItemTypes;
55
use Koha::IssuingRule;
44
use Koha::IssuingRule;
56
use Koha::IssuingRules;
45
use Koha::IssuingRules;
Lines 92-100 my $dbh = DBI->connect( Link Here
92
);
81
);
93
82
94
#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.
83
#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.
95
my $op = $input->param('op') || "";
84
my $op = $input->param('op');
96
$template->param( 'op' => $op );
85
$template->param( 'op' => $op );
97
86
87
my $schema = Koha::Database->new()->schema();
88
98
if ( $op && $op eq 'Finish' )
89
if ( $op && $op eq 'Finish' )
99
{ #If the value of $op equals 'finish' then redirect user to /cgi-bin/koha/mainpage.pl
90
{ #If the value of $op equals 'finish' then redirect user to /cgi-bin/koha/mainpage.pl
100
    print $input->redirect("/cgi-bin/koha/mainpage.pl");
91
    print $input->redirect("/cgi-bin/koha/mainpage.pl");
Lines 129-143 $template->param( Link Here
129
    my $categories = Koha::Patron::Categories->search();
120
    my $categories = Koha::Patron::Categories->search();
130
    $template->param( 'categories' => $categories, );
121
    $template->param( 'categories' => $categories, );
131
122
132
#Select all the itemtype records in the itemtypes database table and give them to the template
123
#Select all ItemType records in the itemtype table and give them to the template
133
    my $itemtypes = Koha::ItemTypes->search();
124
    my $itemtypes = Koha::ItemTypes->search();
134
    $template->param( 'itemtypes' => $itemtypes, );
125
    $template->param( 'itemtypes' => $itemtypes, );
135
126
127
136
#Select all the ztarget records in the z3950server table and give them to the template
128
#Select all the ztarget records in the z3950server table and give them to the template
137
    my $existingztargets = $schema->Resultset('Z3950server')->count;
129
    my $existingztargets = $schema->resultset('Z3950server')->count;
138
    $template->param(existingztargets => $existingztargets);
130
    $template->param(existingztargets => $existingztargets);
139
131
140
141
if ( $step && $step == 1 ) {
132
if ( $step && $step == 1 ) {
142
    #store inputted parameters in variables
133
    #store inputted parameters in variables
143
    my $branchcode = $input->param('branchcode');
134
    my $branchcode = $input->param('branchcode');
Lines 247-254 elsif ( $step && $step == 2 ) { Link Here
247
    #Create a patron
238
    #Create a patron
248
}
239
}
249
elsif ( $step && $step == 3 ) {
240
elsif ( $step && $step == 3 ) {
250
    my $firstpassword  = $input->param('password') || '';
241
    my $firstpassword  = $input->param('password');
251
    my $secondpassword = $input->param('password2') || '';
242
    my $secondpassword = $input->param('password2');
252
243
253
244
254
    #Find all patron records in the database and hand them to the template
245
    #Find all patron records in the database and hand them to the template
Lines 286-294 elsif ( $step && $step == 3 ) { Link Here
286
    my $categories = Koha::Patron::Categories->search();
277
    my $categories = Koha::Patron::Categories->search();
287
    $template->param( 'categories' => $categories, );
278
    $template->param( 'categories' => $categories, );
288
279
289
290
291
292
#Incrementing the highest existing patron cardnumber to prevent duplicate cardnumber entry
280
#Incrementing the highest existing patron cardnumber to prevent duplicate cardnumber entry
293
    my $exisiting_cardnumber = my $sth_search =
281
    my $exisiting_cardnumber = my $sth_search =
294
      $dbh->prepare("SELECT MAX(cardnumber) FROM borrowers");
282
      $dbh->prepare("SELECT MAX(cardnumber) FROM borrowers");
Lines 387-399 elsif ( $step && $step == 3 ) { Link Here
387
            $newdata{userid}         = $input->param('userid');
375
            $newdata{userid}         = $input->param('userid');
388
            $newdata{password}       = $input->param('password');
376
            $newdata{password}       = $input->param('password');
389
            $newdata{password2}      = $input->param('password2');
377
            $newdata{password2}      = $input->param('password2');
378
            $newdata{dateexpiry}     = '12/10/2016';
390
            $newdata{privacy}        = "default";
379
            $newdata{privacy}        = "default";
391
            $newdata{address}        = "";
392
            $newdata{city}           = "";
393
394
#Determine the dateexpiry of the patron based on the patron category it is created from
395
            my $patron_category = Koha::Patron::Categories->find( $newdata{categorycode} );
396
            $newdata{dateexpiry} = $patron_category->get_expiry_date( $newdata{dateenrolled} );
397
380
398
#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
381
#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
399
            my $borrowernumber = &AddMember(%newdata);
382
            my $borrowernumber = &AddMember(%newdata);
Lines 420-439 elsif ( $step && $step == 3 ) { Link Here
420
                }
403
                }
421
404
422
                # construct flags
405
                # construct flags
423
                my $module_flags = 0;
406
                my @userflags = $schema->resultset('Userflag')->search({}, {
424
                my $sth =
407
                        order_by => { -asc => 'bit'},
425
                  $dbh->prepare("SELECT bit,flag FROM userflags ORDER BY bit");
408
                        }
426
                $sth->execute();
409
                );
427
                while ( my ( $bit, $flag ) = $sth->fetchrow_array ) {
428
                    if ( exists $all_module_perms{$flag} ) {
429
                        $module_flags += 2**$bit;
430
                    }
431
                }
432
410
433
#Set the superlibrarian permission of the newly created patron to superlibrarian
411
                #Setting superlibrarian permissions for new patron
434
                $sth = $dbh->prepare(
412
                my $flags = Koha::Patrons->find($borrowernumber)->set({flags=>01})->store;
435
                    "UPDATE borrowers SET flags=? WHERE borrowernumber=?");
436
                $sth->execute( $module_flags, $borrowernumber );
437
413
438
                #Error handling checking if the patron was created successfully
414
                #Error handling checking if the patron was created successfully
439
                if ( !$borrowernumber ) {
415
                if ( !$borrowernumber ) {
Lines 586-592 elsif ( $step && $step == 5 ) { Link Here
586
562
587
        my @messages;
563
        my @messages;
588
564
589
#New code from smart-rules.tt starts here. Needs to be added to library
590
#Allows for the 'All' option to work when selecting all libraries for a circulation rule to apply to.
565
#Allows for the 'All' option to work when selecting all libraries for a circulation rule to apply to.
591
        if ( $branch eq "*" ) {
566
        if ( $branch eq "*" ) {
592
            my $sth_search = $dbh->prepare(
567
            my $sth_search = $dbh->prepare(
Lines 689-712 elsif ( $step && $step == 5 ) { Link Here
689
    }
664
    }
690
}
665
}
691
elsif ( $step && $step == 6 ){
666
elsif ( $step && $step == 6 ){
692
      my ( $template, $loggedinuser, $cookie ) =
667
    my $service = $input->param('service');
693
          C4::InstallAuth::get_template_and_user(
668
    $template->param( service => $service );
694
            {
695
                  template_name   => "/onboarding/onboardingstep6.tt",
696
                  query           => $input,
697
                  type            => "intranet",
698
                  authnotrequired => 0,
699
                  flagsrequired   => { parameters => 'manage_circ_rules' },
700
                  debug           => 1,
701
            }
702
          );
703
669
704
      my $existingztargets = $schema->Resultset('Z3950server')->count;
670
    my ( $template, $loggedinuser, $cookie ) =
705
      $template->param(existingztargets => $existingztargets);
671
            C4::InstallAuth::get_template_and_user(
706
672
                    {
707
      my $service = $input->param('service');
673
                    template_name   => "/onboarding/onboardingstep6.tt",
708
      $template->param( service => $service );
674
                    query           => $input,
675
                    type            => "intranet",
676
                    authnotrequired => 0,
677
                    flagsrequired   => { parameters => 'manage_circ_rules' },
678
                    debug           => 1,
679
                    }
680
            );
709
}
681
}
710
682
711
712
output_html_with_http_headers $input, $cookie, $template->output;
683
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/onboarding/onboardingstep6.tt (-14 / +36 lines)
Lines 16-51 Link Here
16
            <input type="radio" name="service" value="LDAP"> LDAP <br>
16
            <input type="radio" name="service" value="LDAP"> LDAP <br>
17
            <input type="radio" name="service" value="SIP"> SIP  <br>
17
            <input type="radio" name="service" value="SIP"> SIP  <br>
18
        </div>
18
        </div>
19
        <input type="submit" class="action" value="submit">
19
        <input type="submit" class="action" value="Submit">
20
    </form>
20
    </form>
21
[% END %]
21
[% END %]
22
22
[% IF (op == "learnservice") && (service == "LDAP") %]
23
[% IF (op == "learnservice") && (service == "LDAP") %]
23
24
24
       <h1 align="left"> Important information regarding setting up LDAP service </h1>
25
       <h1 align="left"> Important information regarding setting up LDAP service </h1>
25
       <h2 align="left"> What is LDAP? </h2>
26
       <h2 align="left"> What is LDAP? </h2>
26
       LDAP is a service that provides another way for users (both staff and patrons) to log into Koha by integrating in your institutions current authentication system with yourt Koha instance. LDAP can be used to log into both the Koha staff interface and OPAC.
27
       LDAP (Lightweight Directory Access Protocol) ican be used as a method to authenticate users. Effectively it can be used to send users inputted credentials to a database where they are compared against all user records and if theres a match the user if successfully logged in.
28
       <br>
29
       If your organisation has an existing database of user records that are used for authentication then setting up the LDAP service with Koha is a good idea because all user records would be stored in a single central location.<br>
30
       LDAP can be used to log into both the Koha staff interface and OPAC.<<br>
27
31
28
       <h2 align="left">What are the benefits of setting up LDAP on my Koha instance</h2>
29
       If your institution has a central database of users which it uses for authentication then by setting up LDAP in your Koha instance your users will be able to log into Koha with their existing account credentials, therefore saving users from having to create another username and password to remember.
30
       <h2> Learn how to set up LDAP at:</h2>
32
       <h2> Learn how to set up LDAP at:</h2>
31
       <a href="https://perldoc.koha-community.org/C4/Auth_with_ldap.html">LDAP in the manual</a>
33
       <a href="https://perldoc.koha-community.org/C4/Auth_with_ldap.html" target="_target">LDAP in the manual</a>
32
34
33
[% ELSIF (op == "learnservice") && (service == "SIP") %]
35
[% ELSIF (op == "learnservice") && (service == "SIP") %]
34
       <h2 align="left"> Important information regarding setting up SIP server</h2>
36
       <h2 align="left"> Important information regarding setting up SIP server</h2>
35
       SIP is a service where you can type commands into the
37
       SIP (Session Initiation Protocol) is a communication protocol used between ACS (Automated Circulation System in this case the Koha server) and SC (Self Checkout machines). By setting up SIP with Koha you will be able to utilise your existing library infrastructure with the Koha ILS.
38
       If you installed Koha using debain packages then setting up SIP is easy, simply follow these steps:
39
       1. In your Linux terminal (in the Koha root directory) write in:
40
       <i>sudo koha-enable-sip <instancename></i><br><br>
41
       2. Edit your SIPconfig.xml file.<br>
42
       2.1. Edit the port value in the service sections at the top of the SIPconfig.xml file, making sure that the two port values have the same IP address but different port numbers.<br>
43
       2.2. Enter an account. This  account must have the same username and password as an account you have created in the Koha staff interface. Also make sure that the account is set to having 'circulate' permissions only.<br>
44
       2.3. Enter an institution . As with acount this institution's ID must match the branchcode of a library created in the Koha staff interface<br><br>
45
       3. In your Linux terminal start SIP by writing in:<br>
46
       <i>sudo koha-start-sip <instancename></i><br><br>
36
47
48
       <h2> Learn how to test SIP at:<h2>
49
       <a href="https://wiki.evergreen-ils.org/doku.php?id=evergreen-admin:sip_support#patron_information" target="_target"> Evergreen SIP support</a><br><br>
37
       <h2> Important security notice about using SIP </h2>
50
       <h2> Important security notice about using SIP </h2>
38
       To ensure your SIP traffic (the request and response messages sent between you and the SIP server) are secure you must use a stunnel or VPN.
51
       To ensure your SIP traffic (the request and response messages sent between you and the SIP server) are secure you must use a stunnel or VPN.
39
52
40
[% END %]
53
[% END %]
41
54
42
55
43
[% IF existingztargets < 0 %]
56
[% IF (existingztargets > 1) %]
44
<h1> Configure any z-targets you know you might want </h1>
57
    <h1> Configure the z39.50 servers you installed in the web installer</h1>
45
z-targets are simply the servers you will query when looking for a sepcific MARC record (bibliographic record). Often these are set to the z39.50 servers run by the Library of Congress. 
58
    z-targets are simply the servers you will query when looking for a specific MARC record (bibliographic record). These servers are run by other libraries and institutions around the world, for example the Library of Congress.
46
Click here:<br>
59
    Click here:<br>
47
<input type="submit" value="finish"> Visit the z-target configuration page</input
60
    <input type="submit" value="Finish"> Visit the z-target configuration page</input>
48
[% END %]
61
[% ELSE %]
49
62
    <h1> Create z-targets</h1>
63
    <b>What are z-targets?</b><br>
64
    Z-targets are simply the servers you can choose to query when looking for a specific MARC record (bibliographic record). These servers are run by other libraries and institutions around the world, for example the Library of Congress.<br><br>
65
    The benefit of setting up z-targets is that when cataloging a new bibliographic item you will be able to search and import the bibliographic information for that bibliographic record from the z39.50 servers (if the item exists in their database) thereby speeding up the cataloging process.
66
    <br><br>
67
    <b>To create a z-target go to:</b><br>
68
    Administration -> Z39.50/SRU servers -> New Z39.50 server<br>
50
69
70
    To learn what z-target servers are avaliable for you to use in your Koha instance go to:<br>
71
    <a href="http://irspy.indexdata.com/find.html" target="_target"> IRSpy Z39.50 target directory </a><br><br>
72
    By using this site you can simply copy the server name, hostname, port number and database name across to the Koha administrative form to create a z-target. 
73
[% END %]
51
74
52
- 

Return to bug 17956