[Koha-cvs] CVS: koha/updater updatedatabase,1.90,1.91
Paul POULAIN
tipaul at users.sourceforge.net
Thu Jul 15 11:52:30 CEST 2004
Update of /cvsroot/koha/koha/updater
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31172/updater
Modified Files:
updatedatabase
Log Message:
Acquisition & Suggestion :
* acquisition rewritte : create a aqbasket table to deal with "bookseller order header".
* add "close basket" feature : a closed basket can't be modified
* suggestion feature : manage suggestions in acquisition (after suggestion filled in OPAC)
Index: updatedatabase
===================================================================
RCS file: /cvsroot/koha/koha/updater/updatedatabase,v
retrieving revision 1.90
retrieving revision 1.91
diff -C2 -r1.90 -r1.91
*** updatedatabase 6 Jul 2004 08:24:18 -0000 1.90
--- updatedatabase 15 Jul 2004 09:52:28 -0000 1.91
***************
*** 287,291 ****
)",
suggestions => "(
! suggestionnumber int(8) NOT NULL auto_increment,
suggestedby int(11) NOT NULL default '0',
managedby int(11) default NULL,
--- 287,291 ----
)",
suggestions => "(
! suggestionid int(8) NOT NULL auto_increment,
suggestedby int(11) NOT NULL default '0',
managedby int(11) default NULL,
***************
*** 297,300 ****
--- 297,304 ----
publishercode varchar(255) default NULL,
date timestamp(8) NOT NULL,
+ volumedesc char(255) default NULL,
+ publicationyear smallint(6) default NULL,
+ place char(255) default NULL,
+ isbn char(10) default NULL,
mailoverseeing smallint(1) default 0,
PRIMARY KEY (suggestionnumber),
***************
*** 302,305 ****
--- 306,317 ----
KEY managedby (managedby)
)",
+ aqbasket => "(basketno int(11) NOT NULL auto_increment,
+ creationdate date,
+ closedate date,
+ booksellerid varchar(10),
+ authorisedby varchar(10),
+ booksellerinvoicenumber text,
+ PRIMARY KEY (basketno)
+ )",
);
***************
*** 370,373 ****
--- 382,393 ----
);
+ my %uselessfields = (
+ aqorders => "requisitionedby,authorisedby,booksellerid,
+ deliverydays,followupdays,
+ numberfollowupsallowed,numberfollowupssent,
+ dateprinted,sourced,quantityreceiveddamaged,
+ subscriptionfrom,subscriptionto
+ "
+ );
# the other hash contains other actions that can't be done elsewhere. they are done
# either BEFORE of AFTER everything else, depending on "when" entry (default => AFTER)
***************
*** 1201,1204 ****
--- 1221,1244 ----
# Populate tables with required data
+ # fill aqbasket if it's empty and aqorder is not
+ # => it means it has just been created & must be filled
+ $sth = $dbh->prepare("select count(*) from aqbasket");
+ $sth->execute;
+ if ($sth->fetchrow == 0) {
+ $sth = $dbh->prepare("select count(*) from aqorders");
+ $sth->execute;
+ if ($sth->fetchrow >0) {
+ print "Populating new table aqbasket\n";
+ print "IMPORTANT NOTE: error message \"Duplicate entry 'X' for key 1\" may appear. it should not be a real trouble\n";
+ $sth=$dbh->prepare("select distinct basketno,booksellerid,authorisedby,entrydate,booksellerinvoicenumber from aqorders");
+ $sth->execute;
+ my ($basketno,$booksellerid,$authorisedby,$entrydate,$booksellerinvoicenumber);
+ my $sth2 = $dbh->prepare("insert into aqbasket (basketno,creationdate,booksellerid,authorisedby,booksellerinvoicenumber) values (?,?,?,?,?)");
+ while (($basketno,$booksellerid,$authorisedby,$entrydate,$booksellerinvoicenumber) = $sth->fetchrow) {
+ print "$basketno,$entrydate,$booksellerid,$authorisedby,$booksellerinvoicenumber\n";
+ $sth2->execute($basketno,$entrydate,$booksellerid,$authorisedby,$booksellerinvoicenumber);
+ }
+ }
+ }
foreach my $table ( keys %tabledata ) {
print "Checking for data required in table $table...\n" unless $silent;
***************
*** 1245,1248 ****
--- 1285,1305 ----
}
+ # at last, remove useless fields
+ foreach $table ( keys %uselessfields ) {
+ my @fields = split /,/,$uselessfields{$table};
+ foreach my $fieldtodrop (@fields) {
+ $fieldtodrop =~ s/\t//g;
+ $fieldtodrop =~ s/\n//g;
+ print "deleting $fieldtodrop field in $table...\n" unless $silent;
+ my $sth = $dbh->prepare("alter table $table drop $fieldtodrop");
+ $sth->execute;
+ if ( $sth->err ) {
+ print "Error : $sth->errstr \n";
+ $sth->finish;
+ } # if error
+ }
+ } # foreach
+
+
$sth->finish;
***************
*** 1250,1253 ****
--- 1307,1316 ----
# $Log$
+ # Revision 1.91 2004/07/15 09:52:28 tipaul
+ # Acquisition & Suggestion :
+ # * acquisition rewritte : create a aqbasket table to deal with "bookseller order header".
+ # * add "close basket" feature : a closed basket can't be modified
+ # * suggestion feature : manage suggestions in acquisition (after suggestion filled in OPAC)
+ #
# Revision 1.90 2004/07/06 08:24:18 tipaul
# adding 2 free fields that can be used for sorting purposes
More information about the Koha-cvs
mailing list