Wierd bug in addbiblio.pl
We're doing our own bug hunting session. We found a bug in the addbiblio.pl, this bug appears only in fields with authorized values lists. When you click in the + sign to duplicate a field it duplicates AND FILLS with the same value the field. What's more if yu have an empty subfield with the same authorized value list it also does the same behaviour. Since we have been hacking koha, I thougth that was something we broke, but I've found the same behaviour on the demo site of koha france. We tested this with the 041 field (language) y think that in koha france in 106 or something like that (know very little UNIMARC). We've doing all kind of tests and found that this bugs is related to the scrolling_list method of the CGI library, this somewhat caches previous calls to the function. Any help will be appreciated Andres
Tarallo, Andres a écrit :
We're doing our own bug hunting session. We found a bug in the addbiblio.pl, this bug appears only in fields with authorized values lists.
When you click in the + sign to duplicate a field it duplicates AND FILLS with the same value the field. What's more if yu have an empty subfield with the same authorized value list it also does the same behaviour.
Known bug, it's at the beginning of 2.2.3 release notes.
We've doing all kind of tests and found that this bugs is related to the scrolling_list method of the CGI library, this somewhat caches previous calls to the function.
I had the same conclusion, but still don't know how to fix it. Probably by creating scrolling list ourself in addbiblio. -- Paul POULAIN Consultant indépendant en logiciels libres responsable francophone de koha (SIGB libre http://www.koha-fr.org)
Hi Paul, last night I was thinking the solution is then one you proposed. If we (Andres and I) build a new function to substitute CGI::scrolling_list, must we reproduce it exactly (same parameters) or just make a similar one that fills our needs? What do you want? ;) I'm asking this because our librarians are very "nervous" about it so we need to solve it this week (today or tomorrow). Ah, I forgot, in which module do we include the function? Koha.pm perhaps? Best regards, Ernesto. Paul POULAIN wrote:
Tarallo, Andres a écrit :
We're doing our own bug hunting session. We found a bug in the addbiblio.pl, this bug appears only in fields with authorized values lists.
When you click in the + sign to duplicate a field it duplicates AND FILLS with the same value the field. What's more if yu have an empty subfield with the same authorized value list it also does the same behaviour.
Known bug, it's at the beginning of 2.2.3 release notes.
We've doing all kind of tests and found that this bugs is related to the scrolling_list method of the CGI library, this somewhat caches previous calls to the function.
I had the same conclusion, but still don't know how to fix it. Probably by creating scrolling list ourself in addbiblio.
Silva, Ernesto - Webmaster a écrit :
Hi Paul, last night I was thinking the solution is then one you proposed. If we (Andres and I) build a new function to substitute CGI::scrolling_list, must we reproduce it exactly (same parameters) or just make a similar one that fills our needs?
What do you want? ;)
the best would be to reproduce it exactly, with the same parameters. And maybe send a bugreport or query to CGI packager.
I'm asking this because our librarians are very "nervous" about it so we need to solve it this week (today or tomorrow).
Ah, I forgot, in which module do we include the function? Koha.pm perhaps?
C4/Interface/CGI/Output.pm is probably the best place. -- Paul POULAIN Consultant indépendant en logiciels libres responsable francophone de koha (SIGB libre http://www.koha-fr.org)
Hi Paul, I've solved the problem (I think), I haven't wrote a new function, instead I added one extra parameter to the scrolling_list call in add_biblio.pl. It was: $output = CGI::scrolling_list( -name => 'field_value', -values => \@authorised_values, -labels => \%authorised_lib, -size => 1, -multiple => 0 ); Now is: $output = CGI::scrolling_list( -name => 'field_value', -values => \@authorised_values, -labels => \%authorised_lib, -override => 1, -size => 1, -multiple => 0 ); WATCH THE "-override => 1," PARAMETER!!!! NOTE: scrolling_list is called twice, don't forget to change both of them. I'm not sending you the diff result because we've made other modifications. And from the 'man CGI': ---------------------------------------------------------------- CREATING FILL-OUT FORMS: General note The various form-creating methods all return strings to the caller, containing the tag or tags that will create the requested form element. You are responsible for actually printing out these strings. It's set up this way so that you can place formatting tags around the form elements. Another note The default values that you specify for the forms are only used the first time the script is invoked (when there is no query string). On subsequent invocations of the script (when there is a query string), the former values are used even if they are blank. If you want to change the value of a field from its previous value, you have two choices: (1) call the param() method to set it. (2) use the -override (alias -force) parameter (a new feature in ver- sion 2.15). This forces the default value to be used, regardless of the previous value: print $query->textfield(-name=>'field_name', -default=>'starting value', -override=>1, -size=>50, -maxlength=>80); ---------------------------------------------------------------- Finally, there are a lot of other scripts that call CGI::scrolling_list, I'll take a look at them (additem.pl?) but I probably won't send the patches to the list since as I said before, we've made many modifications, so the diff output is more dirty than needed. Regards, Ernesto. Paul POULAIN wrote:
Silva, Ernesto - Webmaster a écrit :
Hi Paul, last night I was thinking the solution is then one you proposed. If we (Andres and I) build a new function to substitute CGI::scrolling_list, must we reproduce it exactly (same parameters) or just make a similar one that fills our needs?
What do you want? ;)
the best would be to reproduce it exactly, with the same parameters. And maybe send a bugreport or query to CGI packager.
I'm asking this because our librarians are very "nervous" about it so we need to solve it this week (today or tomorrow).
Ah, I forgot, in which module do we include the function? Koha.pm perhaps?
C4/Interface/CGI/Output.pm is probably the best place.
MY MISTAKE, the scrolling_list function is called only ONCE in addbiblio.pl, the other call was for debugging. regards ernesto. Silva, Ernesto - Webmaster wrote:
Hi Paul,
I've solved the problem (I think), I haven't wrote a new function, instead I added one extra parameter to the scrolling_list call in add_biblio.pl.
It was: $output = CGI::scrolling_list( -name => 'field_value', -values => \@authorised_values, -labels => \%authorised_lib, -size => 1, -multiple => 0 );
Now is: $output = CGI::scrolling_list( -name => 'field_value', -values => \@authorised_values, -labels => \%authorised_lib, -override => 1, -size => 1, -multiple => 0 );
WATCH THE "-override => 1," PARAMETER!!!!
NOTE: scrolling_list is called twice, don't forget to change both of them.
I'm not sending you the diff result because we've made other modifications.
And from the 'man CGI':
---------------------------------------------------------------- CREATING FILL-OUT FORMS: General note The various form-creating methods all return strings to the caller, containing the tag or tags that will create the requested form element. You are responsible for actually printing out these strings. It's set up this way so that you can place formatting tags around the form elements.
Another note The default values that you specify for the forms are only used the first time the script is invoked (when there is no query string). On subsequent invocations of the script (when there is a query string), the former values are used even if they are blank.
If you want to change the value of a field from its previous value, you have two choices:
(1) call the param() method to set it.
(2) use the -override (alias -force) parameter (a new feature in ver- sion 2.15). This forces the default value to be used, regardless of the previous value:
print $query->textfield(-name=>'field_name', -default=>'starting value', -override=>1, -size=>50, -maxlength=>80);
----------------------------------------------------------------
Finally, there are a lot of other scripts that call CGI::scrolling_list, I'll take a look at them (additem.pl?) but I probably won't send the patches to the list since as I said before, we've made many modifications, so the diff output is more dirty than needed.
Regards, Ernesto.
Paul POULAIN wrote:
Silva, Ernesto - Webmaster a écrit :
Hi Paul, last night I was thinking the solution is then one you proposed. If we (Andres and I) build a new function to substitute CGI::scrolling_list, must we reproduce it exactly (same parameters) or just make a similar one that fills our needs?
What do you want? ;)
the best would be to reproduce it exactly, with the same parameters. And maybe send a bugreport or query to CGI packager.
I'm asking this because our librarians are very "nervous" about it so we need to solve it this week (today or tomorrow).
Ah, I forgot, in which module do we include the function? Koha.pm perhaps?
C4/Interface/CGI/Output.pm is probably the best place.
Silva, Ernesto - Webmaster a écrit :
MY MISTAKE, the scrolling_list function is called only ONCE in addbiblio.pl, the other call was for debugging.
Ernesto, you rock. (unlike the CGI doc ;-) ) -- Paul POULAIN Consultant indépendant en logiciels libres responsable francophone de koha (SIGB libre http://www.koha-fr.org)
Guys, Andres will be working with the addbiblio and additem scripts and in full contact with our librarians. Apparently there are some other bugs when editing a biblio or an item, we want to get rid of them as soon as possible. Any suggestions or open bugs? Regards, Ernesto. Paul POULAIN wrote:
Silva, Ernesto - Webmaster a écrit :
MY MISTAKE, the scrolling_list function is called only ONCE in addbiblio.pl, the other call was for debugging.
Ernesto, you rock.
(unlike the CGI doc ;-) )
Silva, Ernesto - Webmaster a écrit :
Guys, Andres will be working with the addbiblio and additem scripts and in full contact with our librarians.
Apparently there are some other bugs when editing a biblio or an item, we want to get rid of them as soon as possible.
Any suggestions or open bugs? none that i'm thinking of at the moment. Did you check bugs.koha.org ?
good bughunting anyway ;-) -- Paul POULAIN Consultant indépendant en logiciels libres responsable francophone de koha (SIGB libre http://www.koha-fr.org)
I'm reading it right now. We'll let you know if we modify anything else. Paul POULAIN wrote:
Silva, Ernesto - Webmaster a écrit :
Guys, Andres will be working with the addbiblio and additem scripts and in full contact with our librarians.
Apparently there are some other bugs when editing a biblio or an item, we want to get rid of them as soon as possible.
Any suggestions or open bugs?
none that i'm thinking of at the moment. Did you check bugs.koha.org ?
good bughunting anyway ;-)
I arrived today after a few days ill (influenza). Ernesto also changed the calls to scrolling_list function in additem.pl, it should be modified in the same way. I will be working in an other bug (or misfeature) our librarians found; but this will be tomorrow, now i have a date with the doctor. Andres Paul POULAIN wrote:
Silva, Ernesto - Webmaster a écrit :
Guys, Andres will be working with the addbiblio and additem scripts and in full contact with our librarians.
Apparently there are some other bugs when editing a biblio or an item, we want to get rid of them as soon as possible.
Any suggestions or open bugs?
none that i'm thinking of at the moment. Did you check bugs.koha.org ?
good bughunting anyway ;-)
participants (3)
-
Paul POULAIN -
Silva, Ernesto - Webmaster -
Tarallo, Andres