I have been working on a small improvement to biblio (which I will submit for consideration as soon as I am done testing it) that in addition to allowing "In Press" allows "Submitted". We need this because we have our scientists track papers that have been submitted for review but have not been accepted for publication. While working on this, I wanted to allow people to enter "In Press" or "Submitted" in the publication_year input box. However, this box is limited to 4 characters. After going through the code, i THINK this limitation gets put into place in the biblio.install file where I see the initial population of the table for biblio fields. In there is a line for the pub_year and there are two values of "4" in there... one is length and one is max_length. My question is, how can I change that? Is it simply a mysql query? What is the proper incantation? Are there bad side effects from doing that? I would want to make it 9 characters to accommodate "Submitted".

Comments

rjerome’s picture

If you enter a date of 9999, it will show in the listing as "In Press" and when sorted by date (decending), the "In Press" items will be listed first.

Ron.

schultz’s picture

Actually, in practice and according to the code, you use "0" to get "In Press". (In fact, according to the code, you should not be able to enter any year AFTER the current year.) But I have added code to use "1" as a "submitted" entry (which is distinct from "in press"). But I want to accomodate out human factors folks who think it would be a better interface to actually type "in press" or "submitted." So my question remains...

After going through the code, i THINK this limitation gets put into place in the biblio.install file where I see the initial population of the table for biblio fields. In there is a line for the pub_year and there are two values of "4" in there... one is length and one is max_length. My question is, how can I change that? Is it simply a mysql query? What is the proper incantation? Are there bad side effects from doing that? I would want to make it 9 characters to accommodate "Submitted".

rjerome’s picture

I forgot that the "9999" change is still in the -dev tree and not in the -1.9 release.

In the database the year is stored as an integer so what you are proposing would not work. There is however another option. We could allow the users to enter "In Press" or "Submitted" and then change that to an integer when it's being validated. In fact that's what's being done now if you enter "In Press", but what is restricting the field width to 4 characters is a setting in the biblio_fields table. if you edit that table and change the value for "size" and "maxsize" of the biblio_year field from 4 to 9 then it should work for "In Press". If you look in the biblio.module file in the biblio_validate function, you will see where this value of "In Press" is getting changed to an integer and you could make a similar change for "Submitted" and use a different integer. As I mentioned earlier, the In Press value is changing to 9999 so you might want to use 9998 for submitted.

I will make all of these changes to the dev version and you can test it if you wish.

Ron.

schultz’s picture

I think we are having a communication problem!

In the database the year is stored as an integer so what you are proposing would not work. There is however another option. We could allow the users to enter "In Press" or "Submitted" and then change that to an integer when it's being validated. In fact that's what's being done now if you enter "In Press", but what is restricting the field width to 4 characters is a setting in the biblio_fields table.

That is exactly what I was saying and suggesting. I have gone through the code in detail.

If you look in the biblio.module file in the biblio_validate function, you will see where this value of "In Press" is getting changed to an integer and you could make a similar change for "Submitted" and use a different integer.

I already did this! In fact, as I said before, I already made the code changes and if you are interested can give you the diffs that allow for "submitted."

if you edit that table and change the value for "size" and "maxsize" of the biblio_year field from 4 to 9 then it should work for "In Press".

And that gets to the exact question I asked. While I am comfortable with editing the PHP, I am NOT comfortable making direct changes to the mysql table... and the code with "size" and "maxsize" is is the install code. So my question is, can you tell me the exact incantation to use to change this in the tables. I assume that changing the install code values for "size" and "maxsize" in the biblio.install will not change anything unless I reinstall it, which I do not want to do. And my followup question is, are there any problems changing those table values?

Do you want the diffs that show the changes I made for adding "submitted"? It should be in the new release.

Thanks for the help!

rjerome’s picture

Sorry, it's been a long day and I didn't read your post throughly. I can make this happen in the module "update" code. If you post the diff for the "submitted" changes, I'll roll it into the main code, create an update that will modify the database tables and make it (5.x-1.10) available tomorrow.

Ron.

schultz’s picture

Excellent. I will put a diff together and submit it in a few moments. Remember, this diff is to the 1.9 version!!

schultz’s picture

Status: Active » Reviewed & tested by the community

Attached are the diffs to add "submitted". Note that this is based on 1.9 and so its still 0 for in press and 1 for submitted. I tested this as did two other people so I think its all good. Also included are the changes needed in the style files. Of note, this is my first contribution to Drupal. The biblio module is important to me and I will probably be adding more in the future. Is there a summary of what else has changed in in the new release?

Also, if its not too late, another needed change is to allow the bibtag in exports... so for example, have an input field for the bibtag, store it in the database, and export it in bibtex export (and the others as appropriate). Your export format for bibtex already has a comma with nothing before it as the first field.

Hope this helps...

alan

schultz’s picture

Just thought of another small change useful thing... I want users to be able to add entries using "import" and have given this permission to them in their role, however, these users do NOT have admin permissions in general, so they do not see the import page and can't get to it via the admin pages. Can the import be offered from create biblio page?

rjerome’s picture

Maybe I'm blind, but I don't see any attachments. I can always do it myself, but getting patches does speed things up a bit.

Ron.

schultz’s picture

Very weird. I did an attacha nd a post. Hmmm. Let me try again. Give me a minute to fire up my other computer where they are located. And one warning... being new to this I did not read the proper way to do patches. There were done with the "c" option (context diff) and from different directories, so a straight "patch" will not work... but then again, you will need to add them manually since its based on the 1.9 version anyway. Okay. coming at you in about 5 minutes.

schultz’s picture

Okay, just attached them again and saving the post. Hope they show up this time.

rjerome’s picture

This still needs a little work as it seems you can't alter the node values in the validate function. I'll work on this later.

Ron.

schultz’s picture

I am not sure what you mean, and want to understand so I make proper edits and contributions in the future. What exactly did my code do wrong, or what did I miss fixing?

rjerome’s picture

It wasn't anything you did. This only came to light when trying to use two different values (0,1) or in my case (9999,9998). As it turns out, the code I had in there never did anything, but it wasn't apparent since the database table had a default value (0). It does show up when you try to set the value to something else like 1. This is documented here... http://api.drupal.org/api/function/hook_validate/5, so it looks like the code which changes from "In Press" or "Submitted" to an integer should live in the submit function.

Ron.

schultz’s picture

Oh, ok. So this only effects my original request -- to be able to type "submitted" or "in press" as the date... not the code I sent to you for adding a "submitted" type of paper. So I will wait for you to make that other change... and hopefully you found my code useful and that will make it in the next release too. Thank you for the help... and I expect I will be contributing other enhancements to biblio. Is there somewhere where I can easily find what new features are in the next release?

rjerome’s picture

Hi Alan,

I try to keep the release notes for the -dev version (http://drupal.org/node/104711) reasonably up to date, or if you are really bored, you can wade through all the CVS messages here... http://drupal.org/project/cvs/69435. This list includes all versions, so if your only interested in the 5.x version you need to look for the messages the look like this...
Bibliography Module: /modules/biblio/biblio.module 1.36.2.131 @ DRUPAL-5 (Note the @ DRUPAL-5, which is the CVS tag for the 5.x-dev branch.) Entries with no "@ " are the head branch which will eventually turn into the 6.x version.

Ron.

Cantalamessa’s picture

Hello Ron, maybe you want to modify the legend under the "Year of publication" input field, such way that the authors know they have the chance to choose between 'yyyy', 'In press', and 'Submitted'.

rjerome’s picture

Good point...

It's done now.

Ron.

Cantalamessa’s picture

It is good as it is now. I've just a consideration on the proper order to display "In press" and "Submitted" items. If we consider the publishing process, "Submitted" should be at the top, since these papers have yet to receive an acceptance decision, whereas "In Press" items are all OK, accepted, only not yet published. What do you think?

rjerome’s picture

A valid point, which I should have thought of, but lately I'm only getting fleeting moments to work on this project, so regretably not a lot of thought is going in :-)

I'll switch the order around.

Ron.

catdevrandom’s picture

Status: Reviewed & tested by the community » Closed (fixed)