[Koha-cvs] CVS: koha installer.pl,1.2.2.25,1.2.2.26

Steve Tonnesen tonnesen at users.sourceforge.net
Tue Jun 25 18:11:36 CEST 2002


Update of /cvsroot/koha/koha
In directory usw-pr-cvs1:/tmp/cvs-serv21598

Modified Files:
      Tag: rel-1-2
	installer.pl 
Log Message:
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.


Index: installer.pl
===================================================================
RCS file: /cvsroot/koha/koha/installer.pl,v
retrieving revision 1.2.2.25
retrieving revision 1.2.2.26
diff -C2 -r1.2.2.25 -r1.2.2.26
*** installer.pl	24 Jun 2002 19:42:55 -0000	1.2.2.25
--- installer.pl	25 Jun 2002 16:11:33 -0000	1.2.2.26
***************
*** 499,503 ****
  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 "Press <ENTER> to continue...";
      <STDIN>;
--- 499,504 ----
  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.\n";
!     print "This is a serious problem, the database will not get installed.\n";
      print "Press <ENTER> to continue...";
      <STDIN>;
***************
*** 510,513 ****
--- 511,562 ----
  
      system ("perl -I $kohadir/modules scripts/updater/updatedatabase");
+ 
+ 
+ 
+ 
+     print "\n\nWould you like to add a branch and printer? [Y]/N: ";
+     chomp($input = <STDIN>);
+ 
+ 
+     unless ($input =~/^n/i) {
+ 	my $branch='Main Library';
+ 	print "Enter a name for the library branch [$branch]: ";
+ 	chomp($input = <STDIN>);
+ 	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 = <STDIN>);
+ 	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 = <STDIN>);
+ 	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 = <STDIN>);
+ 	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', '')\"");
+     }
+ 
+ 
  }
  





More information about the Koha-cvs mailing list