Bug with inserting new material type after you converted openbiblio.de-version 0.5 to 0.7.1 (and solution)

Issue #83 new
Marcus Bautze created an issue

Hi, a user found a bug after he converted openbiblio 0.5g (from openbiblio.de) to 0.7.1 After he tried to add a new material type he got the error "Column count doesn't match value count"

I searched for the error and found out, that after the conversion from openbiblio.de 0.5 there are two obsolete coloumns in table material_type_dm and so the insert-command failed.

I searched for a fix, where i don't have to convert this table again and which is working with converted tables from openbiblio.de and non converted tables and so i modified function 'insert' in classes/DmQuery.php to:

function insert($table, $dm) { $places = ""; if ($table == "material_type_dm") {$places = "(code,description,default_flg,image_file)";} $sql = $this->mkSQL("insert into %I %i values ", $table, $places); if ($table == "collection_dm" or $table == "material_type_dm" or $table == "mbr_classify_dm") { $sql .= '(null, '; } else { $sql .= $this->mkSQL('(%Q, ', $dm->getCode()); } $sql .= $this->mkSQL("%Q, 'N' ", $dm->getDescription()); if ($table == "collection_dm") { $sql .= $this->mkSQL(", %N, %N)", $dm->getDaysDueBack(), $dm->getDailyLateFee()); } elseif ($table == "material_type_dm") { $sql .= $this->mkSQL(", %Q)", $dm->getImageFile()); } elseif ($table == "mbr_classify_dm") { $sql .= $this->mkSQL(", %N)", $dm->getMaxFines()); } else { $sql .= ")"; }



in openbiblio.de i will include this patch

Comments (1)

  1. Hans van der Weij

    It turns out that...

    • The renewal patch implemented in openbiblio.de differs from renewal as was implemented in OpenBiblio 0.5.2
    • Deleting the obsolete columns was not included in the patch that converts the database from openbiblio.de back to the main version.

    Both German and English versions of openbiblio.de have the now obsolete columns (adult_renewal_limit and juvenile_renewal_limit). After converting to 0.7.1, these columns are still present and this results in the error when adding a new material type.

    How and when will a fix be implemented in a new OpenBiblio release?

    I think I will simply ignore the data from the obsolete columns and remove those. Currently I do not know when I can find the time to implement this. Until then, users of English openbiblio.de versions that converted to 0.7.1 can try Marcus' fix for function 'insert' in classes/DmQuery.php

  2. Log in to comment