The new biblio module is really nice work, especially the contributors lists. This definitely solves the association problems of the 5.x version. Migrating from Drupal 5.14 to 6.8 I get long list of warnings (see attached biblio.update.txt)

biblio.module:
menu path: user/%user/$base instead of user/%user/biblio -- for consistency ;-)

biblio_form_submit has different interface in Drupal 6. Fixed interface, not yet function.

biblio_form: some code compression for better readability ;-)

biblio_form_validate: removed checks for required fields (already included in standard form validation, if #required field is set for a widget)

"Submitted" / "In press":
- introduced two new functions for conversion (_biblio_numeric_year, _biblio_text_year)
- fixed display, validation

new function _biblio_prepare_submit collects code common to insert and update

citekey-generation: It would be very useful to define its own code for citekey generation. Have some PHP code field in the biblio admin area, which is stored in the database? I added my own code.

biblio.pages.inc:
inline display should not use SESSION filters, applied patch from Frank Steiner
count successful author transfers.
(Drupal allows and performs module updates although the module is not yet enabled. This leads to some silent update failures currently, if the module is not enabled.)

biblio.contributors.inc:
splitted 'biblio_parse_save' / '_save_contributors' into 'biblio_parse_contributors' / 'biblio_save_contributors' for better modularity
added some proprietary code to handle "et al" occurence in contributor fields which is very useful for secondar / tertiary author fields (which used to map to series editor for example)

The old author types from version 5.x are not available right now (editor, series editor, etc.). Do you plan to integrate them again?

Comments

rhaschke’s picture

Title: several issues in rc2, especially upgrade issues from 5.x » update warnings from 5.x to rc2
Version: 6.x-1.0-rc2 » 6.x-1.x-dev
StatusFileSize
new26.08 KB

I have to apologize for the quality of the submitted patch. It was not fully tested and contained some errors. Here, I provide a new patch against the head of the DRUPAL-6--1 CVS branch. I figured out the reason for the update warnings which I get when updating from Drupal 5.

The biblio_update_6010 contains a lot of obsolete database patches when coming from Drupal 5, because the other update functions where adapted from revision 1.30.2.52 -> 1.30.2.53. In the patch, I simply commented them out. Probably one should support these updates for some beta testers, which have not yet updated... The best method I can imagine, is to execute those updates if "SHOW COLUMNS FROM biblio_contributor_type LIKE 'ctdid'" returns non-empty result.

rjerome’s picture

Hi Robert,

First let me say thank you for providing this detailed feedback. You have obviously spent some time going through the code, which I know is not always an easy thing to do when it's not your own. I haven't had a chance to go through all your proposed changes in detail yet, but I can see some good suggestions here. One thing that I did notice and wondered about was this...

@@ -842,15 +833,15 @@ function biblio_form($node, $form_state)
       '#maxlength' => 255,
       '#weight' => -4
         );
-        // Build the field array used to make the form
-        $result = db_query("SELECT * FROM {biblio_fields} b, {biblio_field_type} bt, {biblio_field_type_data} btd
-                        WHERE bt.fid=b.fid AND btd.ftdid=bt.ftdid
-                        AND bt.tid=$tid
-                        ORDER by bt.weight ASC ");
-        while ($row = db_fetch_array($result)) {
-          $fields[$row['name']] = $row;
-        }
-        $form['other_fields'] = array(
+    // Build the field array used to make the form
+    $result = db_query("SELECT * FROM biblio_fields b 
+    					INNER JOIN biblio_field_type bt ON b.fid = bt.fid 
+    					INNER JOIN biblio_field_type_data btd ON btd.ftdid=bt.ftdid 
+    					WHERE bt.tid=100 ORDER BY bt.weight ASC; ");
+    while ($row = db_fetch_array($result)) {
+      $fields[$row['name']] = $row;
+    }
+    $form['other_fields'] = array(
       '#type' => 'fieldset',
       '#collapsible' => TRUE,
       '#collapsed' => TRUE,

You are setting bt.tid=100 where it should be bt.tid=$tid.

It will probably be a few days before I get a chance to go through the second patch in detail. I will retest the 5.x to 6.x upgrade path, I have to admit that I probably didn't test this before releasing RC2.

Cheers,

Ron.

rhaschke’s picture

Status: Needs work » Needs review
StatusFileSize
new34.41 KB

Hi Ron,

I spent some more time to improve the code. Especially I added the proposed guards in biblio_update_6010 as well as an administrator variable "biblio_citekey_phpcode" which holds php code to generate the citekey. If empty, it falls back to the previous default.

Further I replaced the cross-product joins by appropriate inner joins, which are more efficient and more readable (see http://www.contentwithstyle.co.uk/content/quick-mysql-nice-to-know).

I reviewed all my changes once again and fixed some further bugs introduced by my proposed patches. Especially, I also found the bt.tid=100 thing and re-added the lost "Full Text" input field in the biblio form.

Hence, please consider the latest patch only.

Cheers and a Happy New Year,
Robert

rhaschke’s picture

Hi Ron,

I've seen that you already considered some of my proposed changes. Are you still working on the others? Besides code improvements (which are of course subjective) they contain some minor bug fixes. If you like, I could provide a separate (small) patch for those.

Cheers, Robert

rjerome’s picture

Yes I'm going through them and applying them in related groups. I know you made a lot of changes to the input form (which I'm sure will clean that code up) but I haven't had time to go through them yet, but I will. I was hesitant to apply the entire patch en mass since the potential for introducing new bugs increases exponentially with the number of changes made :-)

If you could break out the bug fixes that would be useful.

rhaschke’s picture

StatusFileSize
new3.17 KB

Attached you find the small bug fixes:

biblio.admin.inc:
- For custom field types you use values >=100 in the .csv files. In the code you started with 101...
- after editing authors you redirect to the author overview page (biblio/authors) which should be ($base/authors)

biblio.module
- user/%user/biblio path should be user/%user/$base for consistency

biblio.pages.inc
- if you follow an author link from "Publications" tab of user profile (user/%user/$base) the result is presented "inline".
Do you really need the path $base/author/%author/*inline*?

rjerome’s picture

That reminds me, there were a whole mess of bugs with that "inline" business. It's not something I use, consequently I always forget to test it :-(

rjerome’s picture

I've incorporated the first two, but the third is a bug of a different sort. It stems from the fact that I'm trying to use a single variable ($inline) for two purposes and it's coming back to bite me. I fixed it in biblio_show_results() and left the _biblio_author_link code as is.

The whole page building code section needs some serious revision :-(

rhaschke’s picture

Hi Ron,
Thanks for your offer to allow me CVS access to the biblio module. Because my trial to applicate for CVS access using your email address for confirmation purposes failed, I set up this issue which you should agree on.

rjerome’s picture

To the CVS admin...

I confirm that I would like to give Robert Haschke (A.K.A rhaschke) CVS access to assist in the development/maintenance of the biblio module, of which I am the primary maintainer.

AjK’s picture

CVS application approved.

rjerome’s picture

Thanks,

Ron

rjerome’s picture

Hi Robert,

I turns out that your "et al" patch introduced a couple of bugs...

      $author['name'] = preg_replace("/et\.?\s+al\.?/",'',$author['name'],-1,$count);
      // if "et al" was present, mark it as "to be added" in $etal array
      if ($count && $author['auth_type'] != 1) $etal[$author['auth_type']] = true;

1) preg_replace in PHP 4.x doesn't take a "count" argument so that breaks backward compatibility
2) if you have et al. as a primary author, a blank author is created.

Why are you not handling et al. in the primary author string? I wonder if the et al. handling would be better placed right in the biblio_parse_author() function?

Cheers,

Ron.

rhaschke’s picture

I fixed the preg_replace to be compatible to PHP 4.x (CVS HEAD). Further I fixed the bug, that single "et al" expressions generate a blank author.
In my original version I only considered "et al" expressions for non-primary authors, because I thought all primary authors should be given explicitly. But, you are right, the user should decide this...
The "et al" handling cannot be placed in biblio_parse_author, because I need access to the $authors array to add further "et al" authors.

Cheers, Robert

rjerome’s picture

Hi Robert,

I see your all setup CVS wise, good stuff.

Thanks for the preg_replace fix.

When I was suggesting putting the handling in biblio_parse_author() I guess I should have been a bit more specific... I was thinking that since you are just removing "et al." from author['name'], parsing the array and putting it back again, why not just check for it's existence in biblio_parse_author(), do the appropriate processing (copy to author['lastname']) and then skip the rest of the parsing process, thus eliminating the need for biblio_authors_add_etal() completely.

Cheers,

rhaschke’s picture

My code was intended to work with original author names of the form "Haschke et al", i.e. both a real author and "et al" specified at once. Such entries exist in our 5.x database. For this to work you need to process the real author and additionally add "et al" at the end of the autors_array. I guess your proposal work only if "et al" is specified as the only text in the author input line.

rjerome’s picture

Right, I see your point now.

rhaschke’s picture

Status: Needs review » Closed (fixed)

All these changes are in the CVS HEAD.