[Koha-patches] [PATCH] Bug 6516 - Make borrowernumber of staff user configurable in koha-create

Robin Sheat robin at catalyst.net.nz
Fri Sep 2 05:38:02 CEST 2011


From: Magnus Enger <magnus at enger.priv.no>

Sets the default borrowernumber of staff user to 1 and makes it possible
to override this with ADMINUSER in /etc/koha/koha-sites.conf or with the
--adminuser and -a command line options.

Remember to update the wiki if this gets pushed!

Signed-off-by: Robin Sheat <robin at catalyst.net.nz>
---
 debian/scripts/koha-create |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/debian/scripts/koha-create b/debian/scripts/koha-create
index 018cae5..fee39b7 100755
--- a/debian/scripts/koha-create
+++ b/debian/scripts/koha-create
@@ -23,7 +23,7 @@ usage="Usage: $0 [--create-db|--request-db|--populate-db] \
     [--marcflavor marc21|normarc|unimarc] \
     [--zebralang en|nb|fr] \
     [--defaultsql /path/to/some.sql] \
-    [--configfile /path/to/config] instancename"
+    [--configfile /path/to/config] [--adminuser n] instancename"
 
 die() {
     echo "$@" 1>&2
@@ -79,14 +79,15 @@ INTRASUFFIX=""
 DEFAULTSQL=""
 ZEBRA_MARC_FORMAT="marc21"
 ZEBRA_LANGUAGE="en"
+ADMINUSER="1"
 if [ -e /etc/koha/koha-sites.conf ]
 then
     . /etc/koha/koha-sites.conf
 fi
 
-[ $# -ge 2 ] && [ $# -le 10 ] || die $usage
+[ $# -ge 2 ] && [ $# -le 12 ] || die $usage
 
-TEMP=`getopt -o crpm:l:d:f: -l create-db,request-db,populate-db,marcflavor:,zebralang:,defaultsql:,configfile: \
+TEMP=`getopt -o crpm:l:d:f:a: -l create-db,request-db,populate-db,marcflavor:,zebralang:,defaultsql:,configfile:,adminuser: \
      -n "$0" -- "$@"`
 
 # Note the quotes around `$TEMP': they are essential!
@@ -96,6 +97,7 @@ eval set -- "$TEMP"
 CLO_ZEBRA_MARC_FORMAT=""
 CLO_ZEBRA_LANGUAGE=""
 CLO_DEFAULTSQL=""
+CLO_ADMINUSER=""
 
 while true ; do
 	case "$1" in
@@ -106,6 +108,7 @@ while true ; do
 		-l|--zebralang) CLO_ZEBRA_LANGUAGE="$2" ; shift 2 ;;
 		-d|--defaultsql) CLO_DEFAULTSQL="$2" ; shift 2 ;;
 		-f|--configfile) configfile="$2" ; shift 2 ;;
+		-a|--adminuser) CLO_ADMINUSER="$2" ; shift 2 ;;
 		--) shift ; break ;;
 		*) die "Internal error processing command line arguments" ;;
 	esac
@@ -135,6 +138,10 @@ if [ "$CLO_DEFAULTSQL" != "" ]
 then
     DEFAULTSQL="$CLO_DEFAULTSQL"
 fi
+if [ "$CLO_ADMINUSER" != "" ]
+then
+    ADMINUSER="$CLO_ADMINUSER"
+fi
 
 name="$1"
 
@@ -264,7 +271,7 @@ then
 USE \`$mysqldb\`;
 UPDATE borrowers 
 SET password = '$staffdigest' 
-WHERE borrowernumber = 3;
+WHERE borrowernumber = $ADMINUSER;
 eof
         #`
         echo "staff user password is '$staffpass' but keep that secret"
-- 
1.7.4.1



More information about the Koha-patches mailing list