From 6692a81b2b0d0a8167743d91b0d388e66afd6387 Mon Sep 17 00:00:00 2001 From: tonnesen Date: Tue, 25 Jun 2002 16:11:33 +0000 Subject: [PATCH] Added section to add a branch and printer in installer.pl. This isn't strictly a bug fix, but it is causing a lot of problems on new installs, so I think it should go in. --- installer.pl | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/installer.pl b/installer.pl index 6b8e3b2f65..7766e91d91 100644 --- a/installer.pl +++ b/installer.pl @@ -498,7 +498,8 @@ CREATING DATABASE |; my $result=system("$mysqldir/bin/mysqladmin -u$mysqluser -p$mysqlpass create $dbname"); if ($result) { - print "\nCouldn't connect to the MySQL server for the reason given above."; + print "\nCouldn't connect to the MySQL server for the reason given above.\n"; + print "This is a serious problem, the database will not get installed.\n"; print "Press to continue..."; ; print "\n"; @@ -509,6 +510,54 @@ if ($result) { system("$mysqldir/bin/mysqladmin -u$mysqluser -p$mysqlpass reload"); system ("perl -I $kohadir/modules scripts/updater/updatedatabase"); + + + + + print "\n\nWould you like to add a branch and printer? [Y]/N: "; + chomp($input = ); + + + unless ($input =~/^n/i) { + my $branch='Main Library'; + print "Enter a name for the library branch [$branch]: "; + chomp($input = ); + if ($input) { + $branch=$input; + } + $branch=~s/[^A-Za-z0-9\s]//g; + my $branchcode=$branch; + $branchcode=~s/[^A-Za-z0-9]//g; + $branchcode=uc($branchcode); + $branchcode=substr($branchcode,0,4); + print "Enter a four letter code for your branch [$branchcode]: "; + chomp($input = ); + if ($input) { + $branchcode=$input; + } + $branchcode=~s/[^A-Z]//g; + $branchcode=uc($branchcode); + $branchcode=substr($branchcode,0,4); + print "Adding branch '$branch' with code '$branchcode'.\n"; + system("$mysqldir/bin/mysql -u$mysqluser -p$mysqlpass Koha -e \"insert into branches (branchcode,branchname,issuing) values ('$branchcode', '$branch', 1)\""); + my $printername='Library Printer'; + print "Enter a name for the printer [$printername]: "; + chomp($input = ); + if ($input) { + $printername=$input; + } + $printername=~s/[^A-Za-z0-9\s]//g; + my $printerqueue='lp'; + print "Enter the queue for the printer [$printerqueue]: "; + chomp($input = ); + if ($input) { + $printerqueue=$input; + } + $printerqueue=~s/[^A-Za-z0-9]//g; + system("$mysqldir/bin/mysql -u$mysqluser -p$mysqlpass Koha -e \"insert into printers (printername,printqueue,printtype) values ('$printername', '$printerqueue', '')\""); + } + + } -- 2.39.5