[Koha-cvs] CVS: koha/updater updatedatabase,1.4.2.18,1.4.2.19
Steve Tonnesen
tonnesen at users.sourceforge.net
Fri Jul 26 20:23:56 CEST 2002
- Previous message: [Koha-cvs] CVS: koha Install.pm,1.1.2.6,1.1.2.7 detail.pl,1.3.2.3,1.3.2.4 koha.upgrade,1.1.2.15,1.1.2.16 search.pl,1.6.2.10,1.6.2.11 subjectsearch.pl,1.1.1.1.2.1,1.1.1.1.2.2
- Next message: [Koha-cvs] CVS: koha member-password.pl,1.1.2.1,1.1.2.2 member.pl,1.1.1.1.2.1,1.1.1.1.2.2 memberentry.pl,1.6.2.3,1.6.2.4 members-home.pl,1.1.2.1,1.1.2.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/koha/koha/updater
In directory usw-pr-cvs1:/tmp/cvs-serv9695/updater
Modified Files:
Tag: rel-1-2
updatedatabase
Log Message:
Added flags to borrowers table and userflags table. Also, OPAC scripts now
check for the existence of a file named 'opac' in the directory they are run
from and set the $type variable to 'opac' if it exists. No longer have to
"trust" that the type query parameter is correct.
Index: updatedatabase
===================================================================
RCS file: /cvsroot/koha/koha/updater/updatedatabase,v
retrieving revision 1.4.2.18
retrieving revision 1.4.2.19
diff -C2 -r1.4.2.18 -r1.4.2.19
*** updatedatabase 20 Jul 2002 22:28:13 -0000 1.4.2.18
--- updatedatabase 26 Jul 2002 18:23:54 -0000 1.4.2.19
***************
*** 22,26 ****
use C4::Database;
! my $debug=0;
my (
--- 22,26 ----
use C4::Database;
! my $debug=1;
my (
***************
*** 43,46 ****
--- 43,51 ----
itemnumber int not null,
flags int)",
+ userflags=>"( bit int not null,
+ flag char(30),
+ flagdesc char(255),
+ defaulton int
+ )",
bookshelf=>"( shelfnumber int auto_increment primary key,
shelfname char(255))",
***************
*** 110,114 ****
'nocalc' => 'int(11)'},
borrowers=>{'userid' => 'char(30)',
! 'password' => 'char(30)',},
aqorders=>{'budgetdate' => 'date'},
);
--- 115,120 ----
'nocalc' => 'int(11)'},
borrowers=>{'userid' => 'char(30)',
! 'password' => 'char(30)',
! 'flags' => 'int',},
aqorders=>{'budgetdate' => 'date'},
);
***************
*** 120,123 ****
--- 126,156 ----
);
+
+
+
+ # The uniquefieldrequired hash entry is used to determine which (if any) fields
+ # must not exist in the table for this row to be inserted.
+
+ my %tabledata=(
+ userflags => [
+ { uniquefieldrequired => 'bit', bit => 0, flag => 'superlibrarian', flagdesc => 'Access to all librarian functions', defaulton => 0 },
+ { uniquefieldrequired => 'bit', bit => 1, flag => 'circulate', flagdesc => 'Circulate books', defaulton => 0 },
+ { uniquefieldrequired => 'bit', bit => 2, flag => 'catalogue', flagdesc => 'Catalogue books', defaulton => 0 },
+ { uniquefieldrequired => 'bit', bit => 3, flag => 'parameters', flagdesc => 'Set Koha system paramters', defaulton => 0 },
+ { uniquefieldrequired => 'bit', bit => 4, flag => 'borrowers', flagdesc => 'Add or modify borrowers', defaulton => 0 },
+ { uniquefieldrequired => 'bit', bit => 5, flag => 'permissions', flagdesc => 'Set user permissions', defaulton => 0 },
+ { uniquefieldrequired => 'bit', bit => 6, flag => 'reserveforothers', flagdesc => 'Reserve books for patrons', defaulton => 0 },
+ { uniquefieldrequired => 'bit', bit => 7, flag => 'borrow', flagdesc => 'Borrow books', defaulton => 1 },
+ { uniquefieldrequired => 'bit', bit => 8, flag => 'reserveforself', flagdesc => 'Reserve books for self', defaulton => 0 },
+ ],
+ systempreferences => [
+ { uniquefieldrequired => 'variable', variable => 'autoMemberNum', value => '1' },
+ { uniquefieldrequired => 'variable', variable => 'acquisitions', value => 'simple' },
+ ],
+
+ );
+
+
+
#-------------------
# Initialize
***************
*** 282,302 ****
! # Populate systempreferences if it is empty
!
! foreach $prefitem ( keys %defaultprefs ) {
! $sth=$dbh->prepare("select value
! from systempreferences
! where variable=?");
! $sth->execute($prefitem);
! unless ($sth->rows) {
! print "Adding system preference item $prefitem with value " .
! $defaultprefs{$prefitem} ."\n";
! $sti=$dbh->prepare("
! insert into systempreferences (variable, value)
! values (?,?)");
! $sti->execute($prefitem,$defaultprefs{$prefitem});
! } # unless
! } # foreach
!
$sth->finish;
--- 315,349 ----
! # Populate tables with required data
!
! foreach my $table (keys %tabledata) {
! print "Checking for data required in table $table...\n";
! my $tablerows=$tabledata{$table};
! foreach my $row (@$tablerows) {
! my $uniquefieldrequired=$row->{uniquefieldrequired};
! my $uniquevalue=$row->{$uniquefieldrequired};
! my $sth=$dbh->prepare("select $uniquefieldrequired from $table where $uniquefieldrequired=?");
! $sth->execute($uniquevalue);
! unless ($sth->rows) {
! print "Adding row to $table: ";
! my @values;
! my $fieldlist;
! my $placeholders;
! foreach my $field (keys %$row) {
! (next) if ($field eq 'uniquefieldrequired');
! my $value=$row->{$field};
! push @values, $value;
! print " $field => $value";
! $fieldlist.="$field,";
! $placeholders.="?,";
! }
! print "\n";
! $fieldlist=~s/,$//;
! $placeholders=~s/,$//;
! my $sth=$dbh->prepare("insert into $table ($fieldlist) values ($placeholders)");
! $sth->execute(@values);
! }
! }
! }
$sth->finish;
***************
*** 306,309 ****
--- 353,362 ----
# $Log$
+ # Revision 1.4.2.19 2002/07/26 18:23:54 tonnesen
+ # Added flags to borrowers table and userflags table. Also, OPAC scripts now
+ # check for the existence of a file named 'opac' in the directory they are run
+ # from and set the $type variable to 'opac' if it exists. No longer have to
+ # "trust" that the type query parameter is correct.
+ #
# Revision 1.4.2.18 2002/07/20 22:28:13 rangi
# Fixing missing column (budgetdate) in aqorders
- Previous message: [Koha-cvs] CVS: koha Install.pm,1.1.2.6,1.1.2.7 detail.pl,1.3.2.3,1.3.2.4 koha.upgrade,1.1.2.15,1.1.2.16 search.pl,1.6.2.10,1.6.2.11 subjectsearch.pl,1.1.1.1.2.1,1.1.1.1.2.2
- Next message: [Koha-cvs] CVS: koha member-password.pl,1.1.2.1,1.1.2.2 member.pl,1.1.1.1.2.1,1.1.1.1.2.2 memberentry.pl,1.6.2.3,1.6.2.4 members-home.pl,1.1.2.1,1.1.2.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Koha-cvs
mailing list