@@ -, +, @@ database agnosticism MariaDB apparently will not fudge when one attempts to insert a null value into a NOT NULL field with no default defined. This probably should have been fixed in any case, but must be fixed if Koha is to run over MariaDB. This patch simple supplies a single blank space as the value passed in on the initial insert. --- C4/ImportBatch.pm | 12 ++++-------- tools/stage-marc-import.pl | 9 ++++++++- 2 files changed, 12 insertions(+), 9 deletions(-) --- a/C4/ImportBatch.pm +++ a/C4/ImportBatch.pm @@ -1128,13 +1128,11 @@ sub SetImportRecordMatches { sub _create_import_record { my ($batch_id, $record_sequence, $marc_record, $record_type, $encoding, $z3950random) = @_; - + my $marcxml_old = " "; # placeholder because import_records.marcxml_old is NOT NULL with no DEFAULT set my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare("INSERT INTO import_records (import_batch_id, record_sequence, marc, marcxml, - record_type, encoding, z3950random) - VALUES (?, ?, ?, ?, ?, ?, ?)"); - $sth->execute($batch_id, $record_sequence, $marc_record->as_usmarc(), $marc_record->as_xml(), - $record_type, $encoding, $z3950random); + my $sth = $dbh->prepare("INSERT INTO import_records (import_batch_id, record_sequence, marc, marcxml, marcxml_old, record_type, encoding, z3950random) + VALUES (?, ?, ?, ?, ?, ?, ?, ?)"); + $sth->execute($batch_id, $record_sequence, $marc_record->as_usmarc(), $marc_record->as_xml(), $marcxml_old, $record_type, $encoding, $z3950random); my $import_record_id = $dbh->{'mysql_insertid'}; $sth->finish(); return $import_record_id; @@ -1152,7 +1150,6 @@ sub _update_import_record_marc { sub _add_biblio_fields { my ($import_record_id, $marc_record) = @_; - my ($title, $author, $isbn, $issn) = _parse_biblio_fields($marc_record); my $dbh = C4::Context->dbh; # FIXME no controlnumber, originalsource @@ -1160,7 +1157,6 @@ sub _add_biblio_fields { my $sth = $dbh->prepare("INSERT INTO import_biblios (import_record_id, title, author, isbn, issn) VALUES (?, ?, ?, ?, ?)"); $sth->execute($import_record_id, $title, $author, $isbn, $issn); $sth->finish(); - } sub _update_biblio_fields { --- a/tools/stage-marc-import.pl +++ a/tools/stage-marc-import.pl @@ -25,7 +25,12 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. use strict; -#use warnings; FIXME - Bug 2505 +use warnings; + +#use Sys::Syslog; #XXX +#openlog('Koha_Import','' ,'LOCAL0'); + +#syslog('debug|local0', "Starting up tools/stage-marc-import.pl"); #XXX # standard or CPAN modules used use CGI; @@ -129,6 +134,8 @@ if ($completedJobID) { } + # open STDERR, '>', "/home/koha/koha.git/var/log/koha-import.log"; # uncomment to log errors from child process; fix path for your install; logfile must be owned by apache user + # FIXME branch code my ($batch_id, $num_valid, $num_items, @import_errors) = BatchStageMarcRecords($syntax, $marcrecord, $filename, $comments, '', $parse_items, 0, --