6 # This script checks for required updates to the database.
8 # Part of the Koha Library Software www.koha.org
9 # Licensed under the GPL.
12 # - Would also be a good idea to offer to do a backup at this time...
14 # NOTE: If you do something more than once in here, make it table driven.
26 # FIXME - The user might be installing a new database, so can't rely
27 # on /etc/koha.conf anyway.
34 %existingtables, # tables already in database
38 $type, $null, $key, $default, $extra,
39 $prefitem, # preference item in systempreferences table
46 my $dbh = C4::Context->dbh;
47 print "connected to your DB. Checking & modifying it\n" unless $silent;
48 $|=1; # flushes output
53 # Tables to add if they don't exist
55 categorytable => "(categorycode char(5) NOT NULL default '',
56 description text default '',
57 itemtypecodes text default '',
58 PRIMARY KEY (categorycode)
60 subcategorytable => "(subcategorycode char(5) NOT NULL default '',
61 description text default '',
62 itemtypecodes text default '',
63 PRIMARY KEY (subcategorycode)
65 mediatypetable => "(mediatypecode char(5) NOT NULL default '',
66 description text default '',
67 itemtypecodes text default '',
68 PRIMARY KEY (mediatypecode)
71 `timestamp` TIMESTAMP NOT NULL ,
72 `user` INT( 11 ) NOT NULL ,
73 `module` TEXT default '',
74 `action` TEXT default '' ,
75 `object` INT(11) default '' ,
76 `info` TEXT default '' ,
77 PRIMARY KEY ( `timestamp` , `user` )
80 module varchar(20) NOT NULL default '',
81 code varchar(20) NOT NULL default '',
82 name varchar(100) NOT NULL default '',
83 title varchar(200) NOT NULL default '',
85 PRIMARY KEY (module,code)
88 alertid int(11) NOT NULL auto_increment,
89 borrowernumber int(11) NOT NULL default '0',
90 type varchar(10) NOT NULL default '',
91 externalid varchar(20) NOT NULL default '',
92 PRIMARY KEY (alertid),
93 KEY borrowernumber (borrowernumber),
94 KEY type (type,externalid)
100 subscription => { 'letter' => 'char(20) NULL', 'distributedto' => 'text NULL'},
101 itemtypes => { 'imageurl' => 'char(200) NULL'},
102 # tablename => { 'field' => 'fieldtype' },
105 my %dropable_table = (
106 # tablename => 'tablename',
109 my %uselessfields = (
110 # tablename => "field1,field2",
112 # the other hash contains other actions that can't be done elsewhere. they are done
113 # either BEFORE of AFTER everything else, depending on "when" entry (default => AFTER)
115 # The tabledata hash contains data that should be in the tables.
116 # The uniquefieldrequired hash entry is used to determine which (if any) fields
117 # must not exist in the table for this row to be inserted. If the
118 # uniquefieldrequired entry is already in the table, the existing data is not
119 # modified, unless the forceupdate hash entry is also set. Fields in the
120 # anonymous "forceupdate" hash will be forced to be updated to the default
121 # values given in the %tabledata hash.
125 # { uniquefielrequired => 'fieldname', # the primary key in the table
126 # fieldname => fieldvalue,
127 # fieldname2 => fieldvalue2,
130 systempreferences => [
132 uniquefieldrequired => 'variable',
133 variable => 'Activate_Log',
135 forceupdate => { 'explanation' => 1,
137 explanation => 'Turn Log Actions on DB On an Off',
141 uniquefieldrequired => 'variable',
142 variable => 'IndependantBranches',
144 forceupdate => { 'explanation' => 1,
146 explanation => 'Turn Branch independancy management On an Off',
150 uniquefieldrequired => 'variable',
151 variable => 'ReturnBeforeExpiry',
153 forceupdate => { 'explanation' => 1,
155 explanation => 'If Yes, Returndate on issuing can\'t be after borrower card expiry',
159 uniquefieldrequired => 'variable',
160 variable => 'opacstylesheet',
162 forceupdate => { 'explanation' => 1,
164 explanation => 'Enter a complete URL to use an alternate stylesheet in OPAC',
168 uniquefieldrequired => 'variable',
169 variable => 'opacsmallimage',
171 forceupdate => { 'explanation' => 1,
173 explanation => 'Enter a complete URL to an image, will be on top/left instead of the Koha logo',
177 uniquefieldrequired => 'variable',
178 variable => 'opaclargeimage',
180 forceupdate => { 'explanation' => 1,
182 explanation => 'Enter a complete URL to an image, will be on the main page, instead of the Koha logo',
186 uniquefieldrequired => 'variable',
187 variable => 'delimiter',
189 forceupdate => { 'explanation' => 1,
191 explanation => 'separator for reports exported to spreadsheet',
195 uniquefieldrequired => 'variable',
197 value => 'OPENOFFICE.ORG',
198 forceupdate => { 'explanation' => 1,
201 explanation => 'Define the default application for report exportations into files',
203 options => 'EXCEL|OPENOFFICE.ORG'
206 uniquefieldrequired => 'variable',
207 variable => 'Delimiter',
209 forceupdate => { 'explanation' => 1,
212 explanation => 'Define the default separator character for report exportations into files',
214 options => ';|tabulation|,|/|\|#'
217 uniquefieldrequired => 'variable',
218 variable => 'SubscriptionHistory',
220 forceupdate => { 'explanation' => 1,
223 explanation => 'Define the information level for serials history in OPAC',
225 options => 'simplified|full'
228 uniquefieldrequired => 'variable',
229 variable => 'hidelostitems',
231 forceupdate => { 'explanation' => 1,
233 explanation => 'show or hide "lost" items in OPAC.',
237 uniquefieldrequired => 'variable',
238 variable => 'IndependantBranches',
240 forceupdate => { 'explanation' => 1,
242 explanation => 'Turn Branch independancy management On an Off',
246 uniquefieldrequired => 'variable',
247 variable => 'ReturnBeforeExpiry',
249 forceupdate => { 'explanation' => 1,
251 explanation => 'If Yes, Returndate on issuing can\'t be after borrower card expiry',
255 uniquefieldrequired => 'variable',
256 variable => 'Disable_Dictionary',
258 forceupdate => { 'explanation' => 1,
260 explanation => 'Disables Dictionary buttons if set to yes',
264 uniquefieldrequired => 'variable',
265 variable => 'hide_marc',
267 forceupdate => { 'explanation' => 1,
269 explanation => 'hide marc specific datas like subfield code & indicators to library',
273 uniquefieldrequired => 'variable',
274 variable => 'NotifyBorrowerDeparture',
276 forceupdate => { 'explanation' => 1,
278 explanation => 'Delay before expiry where a notice is sent when issuing',
282 uniquefieldrequired => 'variable',
283 variable => 'OpacPasswordChange',
285 forceupdate => { 'explanation' => 1,
287 explanation => 'Enable/Disable password change in OPAC (disable it when using LDAP auth)',
294 my %fielddefinitions = (
296 # { field => 'fieldname',
297 # type => 'fieldtype',
320 # Get version of MySQL database engine.
321 my $mysqlversion = `mysqld --version`;
322 $mysqlversion =~ /Ver (\S*) /;
324 if ( $mysqlversion ge '3.23' ) {
325 print "Could convert to MyISAM database tables...\n" unless $silent;
328 #---------------------------------
331 # Collect all tables into a list
332 $sth = $dbh->prepare("show tables");
334 while ( my ($table) = $sth->fetchrow ) {
335 $existingtables{$table} = 1;
339 # Now add any missing tables
340 foreach $table ( keys %requiretables ) {
341 unless ( $existingtables{$table} ) {
342 print "Adding $table table...\n" unless $silent;
343 my $sth = $dbh->prepare("create table $table $requiretables{$table}");
346 print "Error : $sth->errstr \n";
352 # now drop useless tables
353 foreach $table ( keys %dropable_table ) {
354 if ( $existingtables{$table} ) {
355 print "Dropping unused table $table\n" if $debug and not $silent;
356 $dbh->do("drop table $table");
358 print "Error : $dbh->errstr \n";
363 #---------------------------------
366 foreach $table ( keys %requirefields ) {
367 print "Check table $table\n" if $debug and not $silent;
368 $sth = $dbh->prepare("show columns from $table");
371 while ( ( $column, $type, $null, $key, $default, $extra ) = $sth->fetchrow )
373 $types{$column} = $type;
375 foreach $column ( keys %{ $requirefields{$table} } ) {
376 print " Check column $column [$types{$column}]\n" if $debug and not $silent;
377 if ( !$types{$column} ) {
379 # column doesn't exist
380 print "Adding $column field to $table table...\n" unless $silent;
381 $query = "alter table $table
382 add column $column " . $requirefields{$table}->{$column};
383 print "Execute: $query\n" if $debug;
384 my $sti = $dbh->prepare($query);
387 print "**Error : $sti->errstr \n";
394 foreach $table ( keys %fielddefinitions ) {
395 print "Check table $table\n" if $debug;
396 $sth = $dbh->prepare("show columns from $table");
399 while ( ( $column, $type, $null, $key, $default, $extra ) = $sth->fetchrow )
401 $definitions->{$column}->{type} = $type;
402 $definitions->{$column}->{null} = $null;
403 $definitions->{$column}->{null} = 'NULL' if $null eq 'YES';
404 $definitions->{$column}->{key} = $key;
405 $definitions->{$column}->{default} = $default;
406 $definitions->{$column}->{extra} = $extra;
408 my $fieldrow = $fielddefinitions{$table};
409 foreach my $row (@$fieldrow) {
410 my $field = $row->{field};
411 my $type = $row->{type};
412 my $null = $row->{null};
413 # $null = 'YES' if $row->{null} eq 'NULL';
414 my $key = $row->{key};
415 my $default = $row->{default};
416 my $null = $row->{null};
417 # $default="''" unless $default;
418 my $extra = $row->{extra};
419 my $def = $definitions->{$field};
421 unless ( $type eq $def->{type}
422 && $null eq $def->{null}
423 && $key eq $def->{key}
424 && $extra eq $def->{extra} )
429 if ( $key eq 'PRI' ) {
430 $key = 'PRIMARY KEY';
432 unless ( $extra eq 'auto_increment' ) {
436 # if it's a new column use "add", if it's an old one, use "change".
438 if ($definitions->{$field}->{type}) {
439 $action="change $field"
443 # if it's a primary key, drop the previous pk, before altering the table
445 if ($key ne 'PRIMARY KEY') {
446 $sth =$dbh->prepare("alter table $table $action $field $type $null $key $extra default ?");
448 $sth =$dbh->prepare("alter table $table drop primary key, $action $field $type $null $key $extra default ?");
450 $sth->execute($default);
451 print " Alter $field in $table\n" unless $silent;
457 # Populate tables with required data
460 # synch table and deletedtable.
461 foreach my $table (('borrowers','items','biblio','biblioitems')) {
462 my %deletedborrowers;
463 print "synch'ing $table\n";
464 $sth = $dbh->prepare("show columns from deleted$table");
466 while ( my ( $column, $type, $null, $key, $default, $extra ) = $sth->fetchrow ) {
467 $deletedborrowers{$column}=1;
469 $sth = $dbh->prepare("show columns from $table");
472 while ( my ( $column, $type, $null, $key, $default, $extra ) = $sth->fetchrow ) {
473 unless ($deletedborrowers{$column}) {
474 my $newcol="alter table deleted$table add $column $type";
475 if ($null eq 'YES') {
478 $newcol .= " NOT NULL ";
480 $newcol .= "default $default" if $default;
481 $newcol .= " after $previous" if $previous;
483 print "creating column $column\n";
489 foreach my $table ( keys %tabledata ) {
490 print "Checking for data required in table $table...\n" unless $silent;
491 my $tablerows = $tabledata{$table};
492 foreach my $row (@$tablerows) {
493 my $uniquefieldrequired = $row->{uniquefieldrequired};
494 my $uniquevalue = $row->{$uniquefieldrequired};
495 my $forceupdate = $row->{forceupdate};
498 "select $uniquefieldrequired from $table where $uniquefieldrequired=?"
500 $sth->execute($uniquevalue);
502 foreach my $field (keys %$forceupdate) {
503 if ($forceupdate->{$field}) {
504 my $sth=$dbh->prepare("update systempreferences set $field=? where $uniquefieldrequired=?");
505 $sth->execute($row->{$field}, $uniquevalue);
509 print "Adding row to $table: " unless $silent;
513 foreach my $field ( keys %$row ) {
514 next if $field eq 'uniquefieldrequired';
515 next if $field eq 'forceupdate';
516 my $value = $row->{$field};
517 push @values, $value;
518 print " $field => $value" unless $silent;
519 $fieldlist .= "$field,";
520 $placeholders .= "?,";
522 print "\n" unless $silent;
523 $fieldlist =~ s/,$//;
524 $placeholders =~ s/,$//;
527 "insert into $table ($fieldlist) values ($placeholders)");
528 $sth->execute(@values);
537 # create frameworkcode row in biblio table & fill it with marc_biblio.frameworkcode.
540 # 1st, get how many biblio we will have to do...
541 $sth = $dbh->prepare('select count(*) from marc_biblio');
543 my ($totaltodo) = $sth->fetchrow;
545 $sth = $dbh->prepare("show columns from biblio");
549 while ( ( $column, $type, $null, $key, $default, $extra ) = $sth->fetchrow ){
550 $bibliofwexist=1 if $column eq 'frameworkcode';
552 unless ($bibliofwexist) {
553 print "moving biblioframework to biblio table\n";
554 $dbh->do('ALTER TABLE `biblio` ADD `frameworkcode` VARCHAR( 4 ) NOT NULL AFTER `biblionumber`');
555 $sth = $dbh->prepare('select biblionumber,frameworkcode from marc_biblio');
557 my $sth_update = $dbh->prepare('update biblio set frameworkcode=? where biblionumber=?');
559 while (my ($biblionumber,$frameworkcode) = $sth->fetchrow) {
560 $sth_update->execute($frameworkcode,$biblionumber);
562 print "\r$totaldone / $totaltodo" unless ($totaldone % 100);
568 # moving MARC data from marc_subfield_table to biblioitems.marc
570 $sth = $dbh->prepare("show columns from biblioitems");
574 while ( ( $column, $type, $null, $key, $default, $extra ) = $sth->fetchrow ){
575 $marcdone=1 if ($type eq 'blob' && $column eq 'marc') ;
578 print "moving MARC record to biblioitems table\n";
579 # changing marc field type
580 $dbh->do('ALTER TABLE `biblioitems` CHANGE `marc` `marc` BLOB NULL DEFAULT NULL ');
581 # adding marc xml, just for convenience
582 $dbh->do('ALTER TABLE `biblioitems` ADD `marcxml` TEXT NOT NULL');
583 # moving data from marc_subfield_value to biblio
584 $sth = $dbh->prepare('select bibid,biblionumber from marc_biblio');
586 my $sth_update = $dbh->prepare('update biblioitems set marc=?, marcxml=? where biblionumber=?');
588 while (my ($bibid,$biblionumber) = $sth->fetchrow) {
589 my $record = MARCgetbiblio($dbh,$bibid);
590 $sth_update->execute($record->as_usmarc(),$record->as_xml(),$biblionumber);
592 print "\r$totaldone / $totaltodo" unless ($totaldone % 100);
597 # MOVE all tables TO UTF-8 and innoDB
598 $sth = $dbh->prepare("show table status");
600 while ( my $table = $sth->fetchrow_hashref ) {
601 if ($table->{Engine} ne 'InnoDB') {
602 $dbh->do("ALTER TABLE $table->{Name} TYPE = innodb");
603 print "moving $table->{Name} to InnoDB\n";
605 unless ($table->{Collation} =~ /^utf8/) {
606 $dbh->do("ALTER TABLE $table->{Name} DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci");
607 # FIXME : maybe a ALTER TABLE tbl_name CONVERT TO CHARACTER SET utf8 would be better, def char set seems to work fine. If any problem encountered, let's try with convert !
608 print "moving $table->{Name} to utf8\n";
613 # at last, remove useless fields
614 foreach $table ( keys %uselessfields ) {
615 my @fields = split /,/,$uselessfields{$table};
618 foreach my $fieldtodrop (@fields) {
619 $fieldtodrop =~ s/\t//g;
620 $fieldtodrop =~ s/\n//g;
622 $sth = $dbh->prepare("show columns from $table");
624 while ( my ( $column, $type, $null, $key, $default, $extra ) = $sth->fetchrow )
626 $exists =1 if ($column eq $fieldtodrop);
629 print "deleting $fieldtodrop field in $table...\n" unless $silent;
630 my $sth = $dbh->prepare("alter table $table drop $fieldtodrop");
640 # those 2 subs are a copy of Biblio.pm, version 2.2.4
641 # they are useful only once, for moving from 2.2 to 3.0
642 # the MARCgetbiblio & MARCgetitem subs in Biblio.pm
643 # are still here, but uses other tables
644 # (the ones that are filled by updatedatabase !)
648 # Returns MARC::Record of the biblio passed in parameter.
649 my ( $dbh, $bibid ) = @_;
650 my $record = MARC::Record->new();
655 "select bibid,subfieldid,tag,tagorder,tag_indicator,subfieldcode,subfieldorder,subfieldvalue,valuebloblink
656 from marc_subfield_table
657 where bibid=? order by tag,tagorder,subfieldorder
662 "select subfieldvalue from marc_blob_subfield where blobidlink=?");
663 $sth->execute($bibid);
664 my $prevtagorder = 1;
667 my $field; # for >=10 tags
668 my $prevvalue; # for <10 tags
669 while ( my $row = $sth->fetchrow_hashref ) {
671 if ( $row->{'valuebloblink'} ) { #---- search blob if there is one
672 $sth2->execute( $row->{'valuebloblink'} );
673 my $row2 = $sth2->fetchrow_hashref;
675 $row->{'subfieldvalue'} = $row2->{'subfieldvalue'};
677 if ( $row->{tagorder} ne $prevtagorder || $row->{tag} ne $prevtag ) {
678 $previndicator .= " ";
679 if ( $prevtag < 10 ) {
680 if ($prevtag ne '000') {
681 $record->add_fields( ( sprintf "%03s", $prevtag ), $prevvalue ) unless $prevtag eq "XXX"; # ignore the 1st loop
683 $record->leader(sprintf("%24s",$prevvalue));
687 $record->add_fields($field) unless $prevtag eq "XXX";
690 $prevtagorder = $row->{tagorder};
691 $prevtag = $row->{tag};
692 $previndicator = $row->{tag_indicator};
693 if ( $row->{tag} < 10 ) {
694 $prevvalue = $row->{subfieldvalue};
697 $field = MARC::Field->new(
698 ( sprintf "%03s", $prevtag ),
699 substr( $row->{tag_indicator} . ' ', 0, 1 ),
700 substr( $row->{tag_indicator} . ' ', 1, 1 ),
701 $row->{'subfieldcode'},
702 $row->{'subfieldvalue'}
707 if ( $row->{tag} < 10 ) {
708 $record->add_fields( ( sprintf "%03s", $row->{tag} ),
709 $row->{'subfieldvalue'} );
712 $field->add_subfields( $row->{'subfieldcode'},
713 $row->{'subfieldvalue'} );
715 $prevtag = $row->{tag};
716 $previndicator = $row->{tag_indicator};
720 # the last has not been included inside the loop... do it now !
721 if ( $prevtag ne "XXX" )
722 { # check that we have found something. Otherwise, prevtag is still XXX and we
723 # must return an empty record, not make MARC::Record fail because we try to
724 # create a record with XXX as field :-(
725 if ( $prevtag < 10 ) {
726 $record->add_fields( $prevtag, $prevvalue );
730 # my $field = MARC::Field->new( $prevtag, "", "", %subfieldlist);
731 $record->add_fields($field);
739 # Returns MARC::Record of the biblio passed in parameter.
740 my ( $dbh, $bibid, $itemnumber ) = @_;
741 my $record = MARC::Record->new();
743 # search MARC tagorder
746 "select tagorder from marc_subfield_table,marc_subfield_structure where marc_subfield_table.tag=marc_subfield_structure.tagfield and marc_subfield_table.subfieldcode=marc_subfield_structure.tagsubfield and bibid=? and kohafield='items.itemnumber' and subfieldvalue=?"
748 $sth2->execute( $bibid, $itemnumber );
749 my ($tagorder) = $sth2->fetchrow_array();
751 #---- TODO : the leader is missing
754 "select bibid,subfieldid,tag,tagorder,tag_indicator,subfieldcode,subfieldorder,subfieldvalue,valuebloblink
755 from marc_subfield_table
756 where bibid=? and tagorder=? order by subfieldcode,subfieldorder
761 "select subfieldvalue from marc_blob_subfield where blobidlink=?");
762 $sth->execute( $bibid, $tagorder );
763 while ( my $row = $sth->fetchrow_hashref ) {
764 if ( $row->{'valuebloblink'} ) { #---- search blob if there is one
765 $sth2->execute( $row->{'valuebloblink'} );
766 my $row2 = $sth2->fetchrow_hashref;
768 $row->{'subfieldvalue'} = $row2->{'subfieldvalue'};
770 if ( $record->field( $row->{'tag'} ) ) {
773 #--- this test must stay as this, because of strange behaviour of mySQL/Perl DBI with char var containing a number...
774 #--- sometimes, eliminates 0 at beginning, sometimes no ;-\\\
775 if ( length( $row->{'tag'} ) < 3 ) {
776 $row->{'tag'} = "0" . $row->{'tag'};
778 $field = $record->field( $row->{'tag'} );
781 $field->add_subfields( $row->{'subfieldcode'},
782 $row->{'subfieldvalue'} );
783 $record->delete_field($field);
784 $record->add_fields($field);
788 if ( length( $row->{'tag'} ) < 3 ) {
789 $row->{'tag'} = "0" . $row->{'tag'};
792 MARC::Field->new( $row->{'tag'}, " ", " ",
793 $row->{'subfieldcode'} => $row->{'subfieldvalue'} );
794 $record->add_fields($temp);
805 # Revision 1.126 2006/01/06 16:39:42 tipaul
806 # synch'ing head and rel_2_2 (from 2.2.5, including npl templates)
807 # Seems not to break too many things, but i'm probably wrong here.
808 # at least, new features/bugfixes from 2.2.5 are here (tested on some features on my head local copy)
810 # - removing useless directories (koha-html and koha-plucene)
812 # Revision 1.125 2006/01/04 15:54:55 tipaul
813 # utf8 is a : go for beta test in HEAD.
814 # some explanations :
815 # - updater/updatedatabase => will transform all tables in innoDB (not related to utf8, just to warn you) AND collate them in utf8 / utf8_general_ci. The SQL command is : ALTER TABLE tablename DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci.
816 # - *-top.inc will show the pages in utf8
817 # - THE HARD THING : for me, mysql-client and mysql-server were set up to communicate in iso8859-1, whatever the mysql collation ! Thus, pages were improperly shown, as datas were transmitted in iso8859-1 format ! After a full day of investigation, someone on usenet pointed "set NAMES 'utf8'" to explain that I wanted utf8. I could put this in my.cnf, but if I do that, ALL databases will "speak" in utf8, that's not what we want. Thus, I added a line in Context.pm : everytime a DB handle is opened, the communication is set to utf8.
818 # - using marcxml field and no more the iso2709 raw marc biblioitems.marc field.
820 # Revision 1.124 2005/10/27 12:09:05 tipaul
821 # new features for serial module :
822 # - the last 5 issues are now shown, and their status can be changed (but not reverted to "waited", as there can be only one "waited")
823 # - the library can create a "distribution list". this paper contains a list of borrowers (selected from the borrower list, or manually entered), and print it for a given issue. once printed, the sheet can be put on the issue and distributed to every reader on the list (one by one).
825 # Revision 1.123 2005/10/26 09:13:37 tipaul
826 # big commit, still breaking things...
828 # * synch with rel_2_2. Probably the last non manual synch, as rel_2_2 should not be modified deeply.
829 # * code cleaning (cleaning warnings from perl -w) continued
831 # Revision 1.122 2005/09/02 14:18:38 tipaul
832 # new feature : image for itemtypes.
834 # * run updater/updatedatabase to create imageurl field in itemtypes.
835 # * go to Koha >> parameters >> itemtypes >> modify (or add) an itemtype. You will see around 20 nice images to choose between (thanks to owen). If you prefer your own image, you also can type a complete url (http://www.myserver.lib/path/to/my/image.gif)
836 # * go to OPAC, and search something. In the result list, you now have the picture instead of the text itemtype.
838 # Revision 1.121 2005/08/24 08:49:03 hdl
839 # Adding a note field in serial table.
840 # This will allow librarian to mention a note on a peculiar waiting serial number.
842 # Revision 1.120 2005/08/09 14:10:32 tipaul
843 # 1st commit to go to zebra.
844 # don't update your cvs if you want to have a working head...
846 # this commit contains :
847 # * updater/updatedatabase : get rid with marc_* tables, but DON'T remove them. As a lot of things uses them, it would not be a good idea for instance to drop them. If you really want to play, you can rename them to test head without them but being still able to reintroduce them...
848 # * Biblio.pm : modify MARCgetbiblio to find the raw marc record in biblioitems.marc field, not from marc_subfield_table, modify MARCfindframeworkcode to find frameworkcode in biblio.frameworkcode, modify some other subs to use biblio.biblionumber & get rid of bibid.
849 # * other files : get rid of bibid and use biblionumber instead.
852 # * does not do anything on zebra yet.
853 # * if you rename marc_subfield_table, you can't search anymore.
854 # * you can view a biblio & bibliodetails, go to MARC editor, but NOT save any modif.
855 # * don't try to add a biblio, it would add data poorly... (don't try to delete either, it may work, but that would be a surprise ;-) )
857 # IMPORTANT NOTE : you need MARC::XML package (http://search.cpan.org/~esummers/MARC-XML-0.7/lib/MARC/File/XML.pm), that requires a recent version of MARC::Record
858 # Updatedatabase stores the iso2709 data in biblioitems.marc field & an xml version in biblioitems.marcxml Not sure we will keep it when releasing the stable version, but I think it's a good idea to have something readable in sql, at least for development stage.
860 # Revision 1.119 2005/08/04 16:07:58 tipaul
861 # Synch really broke this script...
863 # Revision 1.118 2005/08/04 16:02:55 tipaul
864 # oops... error in synch between 2.2 and head
866 # Revision 1.117 2005/08/04 14:24:39 tipaul
867 # synch'ing 2.2 and head
869 # Revision 1.116 2005/08/04 08:55:54 tipaul
870 # Letters / alert system, continuing...
872 # * adding a package Letters.pm, that manages Letters & alerts.
873 # * adding feature : it's now possible to define a "letter" for any subscription created. If a letter is defined, users in OPAC can put an alert on the subscription. When an issue is marked "arrived", all users in the alert will recieve a mail (as defined in the "letter"). This last part (= send the mail) is not yet developped. (Should be done this week)
874 # * adding feature : it's now possible to "put to an alert" in OPAC, for any serial subscription. The alert is stored in a new table, called alert. An alert can be put only if the librarian has activated them in subscription (and they activate it just by choosing a "letter" to sent to borrowers on new issues)
875 # * adding feature : librarian can see in borrower detail which alerts they have put, and a user can see in opac-detail which alert they have put too.
877 # Note that the system should be generic enough to manage any type of alert.
878 # I plan to extend it soon to virtual shelves : a borrower will be able to put an alert on a virtual shelf, to be warned when something is changed in the virtual shelf (mail being sent once a day by cron, or manually by the shelf owner. Anyway, a mail won't be sent on every change, users would be spammed by Koha ;-) )
880 # Revision 1.115 2005/08/02 16:15:34 tipaul
881 # adding 2 fields to letter system :
882 # * module (acquisition, catalogue...) : it will be usefull to show the librarian only letters he may be interested by.
883 # * title, that will be used as mail subject.
885 # Revision 1.114 2005/07/28 15:10:13 tipaul
886 # Introducing new "Letters" system : Letters will be used everytime you want to sent something to someone (through mail or paper). For example, sending a mail for overdues use letter that you can put as parameters. Sending a mail to a borrower when a suggestion is validated uses a letter too.
887 # the letter table contains 3 fields :
888 # * code => the code of the letter
889 # * name => the complete name of the letter
890 # * content => the complete text. It's a TEXT field type, so has no limits.
892 # My next goal now is to work on point 2-I "serial issue alert"
893 # With this feature, in serials, a user can subscribe the "issue alert". For every issue arrived/missing, a mail is sent to all subscribers of this list. The mail warns the user that the issue is arrive or missing. Will be in head.
894 # (see mail on koha-devel, 2005/04/07)
896 # The "serial issue alert" will be the 1st to use this letter system that probably needs some tweaking ;-)
898 # Once it will be stabilised default letters (in any languages) could be added during installer to help the library begin with this new feature.
900 # Revision 1.113 2005/07/28 08:38:41 tipaul
901 # For instance, the return date does not rely on the borrower expiration date. A systempref will be added in Koha, to modify return date calculation schema :
902 # * ReturnBeforeExpiry = yes => return date can't be after expiry date
903 # * ReturnBeforeExpiry = no => return date can be after expiry date
905 # Revision 1.112 2005/07/26 08:19:47 hdl
906 # Adding IndependantBranches System preference variable in order to manage Branch independancy.
908 # Revision 1.111 2005/07/25 15:35:38 tipaul
909 # we have decided that moving to Koha 3.0 requires being already in Koha 2.2.x
910 # So, the updatedatabase script can highly be cleaned (90% removed).
911 # Let's play with the new Koha DB structure now ;-)