To recreate: - Go to Home › Tools › Patron card creator › Templates - New > Card template - Save - Edit - Save => Can't bless non-reference value at /home/vagrant/kohaclone/C4/Creators/Profile.pm line 89 C4::Creators::Profile::retrieve('C4::Patroncards::Profile', 'profile_id', 22, 'creator', 'Patroncards') called at /home/vagrant/kohaclone/C4/Patroncards/Profile.pm line 29 C4::Patroncards::Profile::retrieve('profile_id', 22, 'creator', 'Patroncards') called at /home/vagrant/kohaclone/patroncards/edit-template.pl line 78
This is even worst with strict_sql_modes turned on, the creation of a new template is impossible: DBD::mysql::st execute failed: Incorrect integer value: '' for column 'profile_id' at row 1 [for Statement "INSERT INTO creator_templates (`creator`, `label_height`, `top_margin`, `units`, `col_gap`, `row_gap`, `left_text_margin`, `rows`, `page_height`, `template_code`, `top_text_margin`, `label_width`, `left_margin`, `cols`, `profile_id`, `page_width`, `template_desc`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);" with ParamValues: 0='Patroncards', 1="0", 2="0", 3="POINT", 4="0", 5="0", 6=0, 7="0", 8="0", 9="DEFAULT TEMPLATE", 10=0, 11="0", 12="0", 13="0", 14='', 15="0", 16="Default description"] at /kohadevbox/koha/C4/Creators/Template.pm line 199. Database returned the following error: Incorrect integer value: '' for column 'profile_id' at row 1 at /kohadevbox/koha/C4/Creators/Template.pm line 201. There is a logic issue in the controller, the printer profile list is not passed to the template (only passed when editing).
(In reply to Jonathan Druart from comment #1) > This is even worst with strict_sql_modes turned on, the creation of a new > template is impossible: > > DBD::mysql::st execute failed: Incorrect integer value: '' for column > 'profile_id' ... at > /kohadevbox/koha/C4/Creators/Template.pm line 199. > Database returned the following error: Incorrect integer value: '' for > column 'profile_id' at row 1 at /kohadevbox/koha/C4/Creators/Template.pm > line 201. > > There is a logic issue in the controller, the printer profile list is not > passed to the template (only passed when editing). The default profile_id should be 0: http://tinyurl.com/smoh5g6 Which is overwritten here: http://tinyurl.com/s2pj4cs Probably changing profile_id => scalar $cgi->param('profile_id'), to profile_id => scalar $cgi->param('profile_id') || 0, would fix the acute pain. I suspect that there are many such issues lurking in the label/patroncard code unfortunately.
There is not printers_profile.profile_id in DB, so I am expecting an error as well. Is there a good reason to not display the list of available profiles on adding?
There is no printers_profile.profile_id == 0 in DB, so I am expecting an error as well. Is there a good reason to not display the list of available profiles on adding?
(In reply to Jonathan Druart from comment #4) > There is no printers_profile.profile_id == 0 in DB, so I am expecting an > error as well. > > Is there a good reason to not display the list of available profiles on > adding? It should: http://tinyurl.com/rkfw9fx And on further review of that code block, the profile_id should be set to 0 there. Something else must be failing along the way. Maybe in your instance its never dropping into that else block? If that's the case, I wonder where it goes? What is $op in your instance?
(In reply to Chris Nighswonger from comment #5) > (In reply to Jonathan Druart from comment #4) > > There is no printers_profile.profile_id == 0 in DB, so I am expecting an > > error as well. > > > > Is there a good reason to not display the list of available profiles on > > adding? > > It should: http://tinyurl.com/rkfw9fx > > And on further review of that code block, the profile_id should be set to 0 > there. > > Something else must be failing along the way. Maybe in your instance its > never dropping into that else block? If that's the case, I wonder where it > goes? What is $op in your instance? Better yet, what is the value of $template_id in your instance? Maybe there is some corrupted data that the script is choking on?
(In reply to Chris Nighswonger from comment #5) > (In reply to Jonathan Druart from comment #4) > > There is no printers_profile.profile_id == 0 in DB, so I am expecting an > > error as well. > > > > Is there a good reason to not display the list of available profiles on > > adding? > > It should: http://tinyurl.com/rkfw9fx We are in patroncards/edit-profile.pl, which does not have this else{} part.
(In reply to Jonathan Druart from comment #7) > (In reply to Chris Nighswonger from comment #5) > > (In reply to Jonathan Druart from comment #4) > > > There is no printers_profile.profile_id == 0 in DB, so I am expecting an > > > error as well. > > > > > > Is there a good reason to not display the list of available profiles on > > > adding? > > > > It should: http://tinyurl.com/rkfw9fx > > We are in patroncards/edit-profile.pl, which does not have this else{} part. edit-profile.pl or edit-template.pl? > This is even worst with strict_sql_modes turned on, the creation of a new > template is impossible: ... > There is a logic issue in the controller, the printer profile list is not > passed to the template (only passed when editing). http://tinyurl.com/t9zksc2
edit-template, sorry! So basically, /cgi-bin/koha/patroncards/edit-template.pl?op=new displays: https://snipboard.io/HCSgBE.jpg See the "Click here to define a printer profile", even if printer profiles exist (this is IMO a bug). Then save => It's not saved and we get the SQL error. Given the code you pointed it to me, a profile is created if none is passed. Are we expecting it to be created with a profile_id=0? What on the second template we will add? We created another profile_id=0?
(In reply to Jonathan Druart from comment #9) > edit-template, sorry! > > So basically, /cgi-bin/koha/patroncards/edit-template.pl?op=new > displays: > https://snipboard.io/HCSgBE.jpg > > See the "Click here to define a printer profile", even if printer profiles > exist (this is IMO a bug). I tend to agree. > > Then save => It's not saved and we get the SQL error. > > Given the code you pointed it to me, a profile is created if none is passed. > Are we expecting it to be created with a profile_id=0? > What on the second template we will add? We created another profile_id=0? No. When a new template is created with no profile_id passed along, the profile_id is set to 0: http://tinyurl.com/smoh5g6 Ah ha! Here is the offending line: http://tinyurl.com/qurdjnc It should be thus: my @params = ( profile_id => scalar $cgi->param('profile_id') || 0, Only we need to be sure that the value of profile_id is truly numeric and not just null. Perhaps it may need to be quoted. Field constraints disallow null values and '' is just that, of course.
I would guess the same issue exists in labels: http://tinyurl.com/s2pj4cs
(In reply to Jonathan Druart from comment #9) > edit-template, sorry! > > So basically, /cgi-bin/koha/patroncards/edit-template.pl?op=new > displays: > https://snipboard.io/HCSgBE.jpg > > See the "Click here to define a printer profile", even if printer profiles > exist (this is IMO a bug). This could probably be fixed by doing something similar to this: http://tinyurl.com/rmhmmw8 in here: http://tinyurl.com/tshysa5 Adjusting the code for the fact that there is not yet a template_id, of course. I'll be away for a few hours now.
(In reply to Jonathan Druart from comment #0) > To recreate: > - Go to Home › Tools › Patron card creator › Templates > - New > Card template > - Save > - Edit > - Save > > => > Can't bless non-reference value at > /home/vagrant/kohaclone/C4/Creators/Profile.pm line 89 > C4::Creators::Profile::retrieve('C4::Patroncards::Profile', > 'profile_id', 22, 'creator', 'Patroncards') called at > /home/vagrant/kohaclone/C4/Patroncards/Profile.pm line 29 > C4::Patroncards::Profile::retrieve('profile_id', 22, 'creator', > 'Patroncards') called at > /home/vagrant/kohaclone/patroncards/edit-template.pl line 78 Just reading back over this: Does your installation have a profile with a profile_id == 22? It seems that the problem described in the first comment could be different from the one described in the second second.
It has a printers_profile.profile_id = 22, but I think here we are talking about creator_templates.profile_id MySQL [koha_kohadev]> select template_id, profile_id from creator_templates; +-------------+------------+ | template_id | profile_id | +-------------+------------+ | 22 | 0 | | 24 | 0 | | 1 | 1 | | 7 | 13 | | 12 | 14 | | 23 | 16 | +-------------+------------+
(In reply to Jonathan Druart from comment #14) > It has a printers_profile.profile_id = 22, but I think here we are talking > about creator_templates.profile_id > > MySQL [koha_kohadev]> select template_id, profile_id from creator_templates; The error occurs on attempting to execute the following on your system in the script: SELECT * FROM printers_profile WHERE profile_id = 22 AND creator = 'Patroncards'; What does that say in the client?
Just to be clear: I think we are encountering different issues in the description and comment #1.
(In reply to Chris Nighswonger from comment #16) > Just to be clear: I think we are encountering different issues in the > description and comment #1. Yes of course, it is what I said in comment #1. If you have the strict_sql_modes turned on it explodes on creating the template. (In reply to Chris Nighswonger from comment #15) > (In reply to Jonathan Druart from comment #14) > > It has a printers_profile.profile_id = 22, but I think here we are talking > > about creator_templates.profile_id > > > > MySQL [koha_kohadev]> select template_id, profile_id from creator_templates; > > The error occurs on attempting to execute the following on your system in > the script: > > SELECT * FROM printers_profile WHERE profile_id = 22 AND creator = > 'Patroncards'; > > What does that say in the client? 0. I am using the fresh install, with all the sample data. 1. Turning off strict_sql_modes 2. Go to Home › Tools › Patron card creator › Templates 3. New > Card template 4. Save 5. Edit 6. Save Can't bless non-reference value at /kohadevbox/koha/C4/Creators/Profile.pm line 89 C4::Creators::Profile::retrieve('C4::Patroncards::Profile', 'profile_id', 22, 'creator', 'Patroncards') called at /kohadevbox/koha/C4/Patroncards/Profile.pm line 29 C4::Patroncards::Profile::retrieve('profile_id', 22, 'creator', 'Patroncards') called at /kohadevbox/koha/patroncards/edit-template.pl line 78 eval {...} at /kohadevbox/koha/patroncards/edit-template.pl line 2 MariaDB [koha_kohadev]> SELECT * FROM printers_profile WHERE profile_id = 22 AND creator = 'Patroncards'; Empty set (0.00 sec)
On "Edit" I am on /patroncards/edit-template.pl?op=edit&element_id=24 https://snipboard.io/Qhk87I.jpg "Library Laser/Tray 3" has a profile_id=22
(In reply to Jonathan Druart from comment #17) > (In reply to Chris Nighswonger from comment #16) > > Just to be clear: I think we are encountering different issues in the > > description and comment #1. > > Yes of course, it is what I said in comment #1. > > If you have the strict_sql_modes turned on it explodes on creating the > template. > Let's open a separate bug for the second issue you mention. The strict sql issue. > > (In reply to Chris Nighswonger from comment #15) > > (In reply to Jonathan Druart from comment #14) > > > It has a printers_profile.profile_id = 22, but I think here we are talking > > > about creator_templates.profile_id > > > > > > MySQL [koha_kohadev]> select template_id, profile_id from creator_templates; > > > > The error occurs on attempting to execute the following on your system in > > the script: > > > > SELECT * FROM printers_profile WHERE profile_id = 22 AND creator = > > 'Patroncards'; > > > > What does that say in the client? > > 0. I am using the fresh install, with all the sample data. > 1. Turning off strict_sql_modes > 2. Go to Home › Tools › Patron card creator › Templates > 3. New > Card template > 4. Save > 5. Edit > 6. Save > > Can't bless non-reference value at /kohadevbox/koha/C4/Creators/Profile.pm > line 89 > > C4::Creators::Profile::retrieve('C4::Patroncards::Profile', > 'profile_id', 22, 'creator', 'Patroncards') called at > /kohadevbox/koha/C4/Patroncards/Profile.pm line 29 > > C4::Patroncards::Profile::retrieve('profile_id', 22, 'creator', > 'Patroncards') called at /kohadevbox/koha/patroncards/edit-template.pl line > 78 > eval {...} at /kohadevbox/koha/patroncards/edit-template.pl line 2 > > > MariaDB [koha_kohadev]> SELECT * FROM printers_profile WHERE profile_id = 22 > AND creator = 'Patroncards'; > Empty set (0.00 sec) Forgive me as I do not have a test installation setup nor the time to get one up and running: What does 'SELECT template_id, profile_id, template_desc, creator FROM creator_templates;' say? I think I know what is causing this.
MariaDB [koha_kohadev]> SELECT template_id, profile_id, template_desc, creator FROM creator_templates; +-------------+------------+------------------------------------------------------------+-------------+ | template_id | profile_id | template_desc | creator | +-------------+------------+------------------------------------------------------------+-------------+ | 1 | 1 | 3 columns, 10 rows of labels | Labels | | 7 | 13 | 1" X 1.5" Spine Label | Setup for up to four lines of text | Labels | | 12 | 14 | 1" X 1.5" Spine Label | Setup for five lines of text | Labels | | 22 | 0 | Default description | Labels | | 23 | 16 | A template for home brewed patron card forms | Patroncards | | 24 | 0 | Default description | Patroncards | +-------------+------------+------------------------------------------------------------+-------------+ 6 rows in set (0.00 sec)
What language sample data are you using on this test set? Side note: The sample data for labels/patroncards among various languages appears to vary tremendously and probably erroneously.
(In reply to Chris Nighswonger from comment #21) > What language sample data are you using on this test set? > > Side note: The sample data for labels/patroncards among various languages > appears to vary tremendously and probably erroneously. I am using a 'classic' install, 'en'.
I'm working on using Bywater's sandbox script to set up a test bed. Once that's up and running, I'll work through this bug.
Created attachment 95981 [details] [review] Bug 24001: Cannot edit card template Change hardcoded default value of profile_id to 0 rather than null. Signed-off-by: Chris Nighswonger <cnighswonger@foundations.edu>
Test plan: 1. Using the fresh install, with all the sample data. 2. Go to Home › Tools › Patron card creator › Templates 3. New > Card template 4. Save 5. Edit 6. Save Note either of the two errors in the error log. Apply the attached patch. 1. Go to Home › Tools › Patron card creator › Templates 2. Select the previously created template 3. Delete it 4. New > Card template 5. Save 6. Edit 7. Save Note the absence of either of the two errors in error log.
This actually fixes both issues described in this bug. To test this, re-run the above procedure with strict_sql_modes set to the opposite value.
The patch fixes the creation with strict_sql_modes on (comment 1), but not the edition from comment 0 Can't bless non-reference value at /kohadevbox/koha/C4/Creators/Profile.pm line 89
Error when saving Patron card Template: Can't bless non-reference value at /home/vagrant/kohaclone/C4/Creators/Profile.pm line 89 Can be fixed by add this one line into /usr/share/koha/intranet/cgi-bin/patroncards/edit-template.pl 52 $profile_list = get_all_profiles({ fields => [ qw( profile_id printer_name paper_bin ) ], filters => {template_id => [ $template_id, '' ]} } ); +++ push @$profile_list, {paper_bin => 'N/A', profile_id => 0, printer_name => 'No Profile'};
(In reply to Rinrada Wongsaichua from comment #28) > Error when saving Patron card Template: > Can't bless non-reference value at > /home/vagrant/kohaclone/C4/Creators/Profile.pm line 89 > > Can be fixed by add this one line into > /usr/share/koha/intranet/cgi-bin/patroncards/edit-template.pl > > 52 $profile_list = get_all_profiles({ fields => [ qw( profile_id > printer_name paper_bin ) ], filters => {template_id => [ $template_id, '' ]} > } ); > +++ push @$profile_list, {paper_bin => 'N/A', profile_id => 0, > printer_name => 'No Profile'}; Can you please provide a patch?
(In reply to Jonathan Druart from comment #29) > (In reply to Rinrada Wongsaichua from comment #28) > > Error when saving Patron card Template: > > Can't bless non-reference value at > > /home/vagrant/kohaclone/C4/Creators/Profile.pm line 89 > > > > Can be fixed by add this one line into > > /usr/share/koha/intranet/cgi-bin/patroncards/edit-template.pl > > > > 52 $profile_list = get_all_profiles({ fields => [ qw( profile_id > > printer_name paper_bin ) ], filters => {template_id => [ $template_id, '' ]} > > } ); > > +++ push @$profile_list, {paper_bin => 'N/A', profile_id => 0, > > printer_name => 'No Profile'}; > > Can you please provide a patch? Sorry I'm new here(In reply to Jonathan Druart from comment #29) > (In reply to Rinrada Wongsaichua from comment #28) > > Error when saving Patron card Template: > > Can't bless non-reference value at > > /home/vagrant/kohaclone/C4/Creators/Profile.pm line 89 > > > > Can be fixed by add this one line into > > /usr/share/koha/intranet/cgi-bin/patroncards/edit-template.pl > > > > 52 $profile_list = get_all_profiles({ fields => [ qw( profile_id > > printer_name paper_bin ) ], filters => {template_id => [ $template_id, '' ]} > > } ); > > +++ push @$profile_list, {paper_bin => 'N/A', profile_id => 0, > > printer_name => 'No Profile'}; > > Can you please provide a patch? I'm sorry I'm new for this site, really don't know how to attach patch or create one Basically you just need to add this line into edit-template.pl then issue resolved You'll now able to save patron card template without any error --- /usr/share/koha/intranet/cgi-bin/patroncards/edit-template.pl on line 52 $profile_list = get_all_profiles({ fields => [ qw( profile_id printer_name paper_bin ) ], filters => {template_id => [ $template_id, '' ]} } ); ++++++++++ push @$profile_list, {paper_bin => 'N/A', profile_id => 0, printer_name => 'No Profile'};
Please do not change the status to "resolved". It is marked resolved once we have a patch pushed into master.
okay I don't know how it works But I just wanted to share solution that work for me I've tested on my server and issue has been resolved
Created attachment 98722 [details] [review] [PATCH] Bug 24001: Cannot edit card template
Created attachment 99164 [details] [review] Bug 24001: Fix patron card template edition Error when saving Patron card Template: Can't bless non-reference value at /home/vagrant/kohaclone/C4/Creators/Profile.pm line 89 Can be fixed by add this one line into /usr/share/koha/intranet/cgi-bin/patroncards/edit-template.pl
Hello Rinrada, I have attached a file that has the correct format (patch). However I am not sure this is the correct way to fix the issue. Chris, can we get your opinion on it?
(In reply to Jonathan Druart from comment #35) > Hello Rinrada, > > I have attached a file that has the correct format (patch). > However I am not sure this is the correct way to fix the issue. > > Chris, can we get your opinion on it? Hi Jonathan, every time I edit template of patroncards which has no profile_id attached to template Profile will display first printer name from the selector list even if profile_id==0 Tested edit on template of labels that has no profile_id attached (profile_id==0) It will display 'Profile: No Profile/N/A' and able to save successfully no error Checked label-edit-template.pl and found this line >> push @$profile_list, {paper_bin => 'N/A', profile_id => 0, printer_name => 'No Profile'}; which only exist in label-edit-template.pl but does not exist in edit-template.pl Checked database and noticed that both patroncards and labels stored Printer profiles in the same table (printers_profile table) and identify by creator field Hopefully my investigation will help you guys on this case come how
I tested the patchset and it works. When you edit a card template, there is no more error and the profile is set to No profile/NA. However, the drop-down menu for the profiles still gives me the possibility to choose a printer profile that is not part of the patron cards creator but the label creator. If I try to select that profile, it gives me an error, which is expected, but the choice should not be there in the first place. The drop down menu should be limited to printer profiles in the patron card creator (plus the No profile choice).
Created attachment 106434 [details] [review] Bug 24001: Fix patron card template edition Error when saving Patron card Template: Can't bless non-reference value at /home/vagrant/kohaclone/C4/Creators/Profile.pm line 89 This is caused by the profile dropdown offering invalid choices and is fixed by adding a filter to limit options to creator = 'Patroncards'. The UI already handles the case where no valid profile is avaiable.
Created attachment 109764 [details] [review] Bug 24001: Fix patron card template edition Error when saving Patron card Template: Can't bless non-reference value at /home/vagrant/kohaclone/C4/Creators/Profile.pm line 89 This is caused by the profile dropdown offering invalid choices and is fixed by adding a filter to limit options to creator = 'Patroncards'. The UI already handles the case where no valid profile is avaiable. Signed-off-by: Alexis Ripetti <alexis.ripetti@inLibro.com>
Apologies for the rather long comment, and for marking as "Failed QA". TLDR; - the patch works, however there is a problem with the printer profile drop down list - it takes you to the new printer profile page - you can't create a new printer profile (for both the patron card creator and the label creator tools) - this should possibly be another bug - it looks like this hasn't worked for several versions Before applying the patch ========================= The card template is not created and you are returned to the list of currently available templates. These error messages are generated in /var/log/koha/kohadev/plack-intranet-error.log: 1 [2020/10/03 06:08:27] [WARN] DBD::mysql::st execute failed: Incorrect integer value: '' for column 'profile_id' at row 1 [for Statem ent "INSERT INTO creator_templates (`template_code`, `label_width`, `top_margin`, `col_gap`, `template_desc`, `row_gap`, `rows`, `pa ge_width`, `cols`, `label_height`, `units`, `top_text_margin`, `left_margin`, `left_text_margin`, `profile_id`, `creator`, `page_hei ght`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);" with ParamValues: 0="A DEFAULT TEMPLATE", 1="0", 2="0", 3="0", 4="A Default descr iption", 5="0", 6="0", 7="0", 8="0", 9="0", 10="POINT", 11=0, 12="0", 13=0, 14='', 15='Patroncards', 16="0"] at /kohadevbox/koha/C4/ Creators/Template.pm line 199. 2 [2020/10/03 06:08:27] [WARN] Database returned the following error: Incorrect integer value: '' for column 'profile_id' at row 1 at /kohadevbox/koha/C4/Creators/Template.pm line 201. 3 [2020/10/03 06:08:28] [WARN] CGI::param called in list context from /kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/en/includes/patron cards-errors.inc line 57, this can lead to vulnerabilities. See the warning in "Fetching the value or values of a single named param eter" at /usr/share/perl5/CGI.pm line 412. If you try to create a printer profile (New > Printer profile) the printer profile is not created - you are returned to the list of current available templates. These error messages are generated in /var/log/koha/kohadev/plack-intranet-error.log: 4 [2020/10/03 06:10:57] [WARN] DBD::mysql::st execute failed: Incorrect integer value: '' for column 'template_id' at row 1 [for State ment "INSERT INTO printers_profile (creep_vert, offset_horz, units, printer_name, creator, template_id, offset_vert, paper_bin, cree p_horz) VALUES (?,?,?,?,?,?,?,?,?);" with ParamValues: 0="0", 1="0", 2="POINT", 3="ABC", 4='Patroncards', 5='', 6="0", 7="2", 8="0"] at /kohadevbox/koha/C4/Creators/Profile.pm line 162. 5 [2020/10/03 06:10:57] [WARN] Database returned the following error on attempted INSERT: Incorrect integer value: '' for column 'temp late_id' at row 1 at /kohadevbox/koha/C4/Creators/Profile.pm line 164. After applying the patch ======================== After applying the patch and adding a card template the card template is created, so that fixes that issue! However, there is this error message in /var/log/koha/kohadev/plack-intranet-error.log: [2020/10/03 06:15:59] [WARN] CGI::param called in list context from /kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/en/includes/patron cards-errors.inc line 57, this can lead to vulnerabilities. See the warning in "Fetching the value or values of a single named param eter" at /usr/share/perl5/CGI.pm line 412. On the create patron card template page if you click on "Click here to define a printer profile.", you are taken to the create printer profile screen. I'm not sure what is expected here, but I expect it should be a drop down list of printer profiles like for the label creator tool (as per Caroline's comment #37). If you try to create a printer profile you get the same behaviour as before the patch was applied. Other notes: - Tested using koha-testing-docker and started with ku. - Using the label creator tool, you get the same error message when you try to create a printer profile for the patron card creator. Error messages for Koha 20.05.x, Koha 19.11.x ============================================= You get these error messages in Koha 20.05.x, 19.11.x and 19.05.x Create a patron card template - error message in /var/log/koha/kohadev/plack-error.log: 7 DBD::mysql::st execute failed: Incorrect integer value: '' for column 'profile_id' at row 1 [for Statement "INSERT INTO creator_templates (`row_gap`, `units`, `temp late_code`, `page_height`, `left_text_margin`, `page_width`, `profile_id`, `top_text_margin`, `creator`, `label_width`, `template_desc`, `left_margin`, `rows`, `col s`, `top_margin`, `col_gap`, `label_height`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);" with ParamValues: 0="0", 1="POINT", 2="A DEFAULT TEMPLATE", 3="0", 4=0, 5= "0", 6='', 7=0, 8='Patroncards', 9="0", 10="A default description", 11="0", 12="0", 13="0", 14="0", 15="0", 16="0"] at /kohadevbox/koha/C4/Creators/Template.pm line 199. 8 Database returned the following error: Incorrect integer value: '' for column 'profile_id' at row 1 at /kohadevbox/koha/C4/Creators/Template.pm line 201. 9 CGI::param called in list context from /kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/en/includes/patroncards-errors.inc line 57, this can lead to vulnerabilities. S ee the warning in "Fetching the value or values of a single named parameter" at /usr/share/perl5/CGI.pm line 412. Create a printer profile - error message in /var/log/koha/kohadev/plack-error.log:: 10 DBD::mysql::st execute failed: Incorrect integer value: '' for column 'template_id' at row 1 [for Statement "INSERT INTO printers_profile (creator, template_id, off set_horz, units, printer_name, creep_horz, creep_vert, offset_vert, paper_bin) VALUES (?,?,?,?,?,?,?,?,?);" with ParamValues: 0='Patroncards', 1='', 2="0", 3="POINT ", 4="ABZ", 5="0", 6="0", 7="0", 8="9"] at /kohadevbox/koha/C4/Creators/Profile.pm line 162. 11 Database returned the following error on attempted INSERT: Incorrect integer value: '' for column 'template_id' at row 1 at /kohadevbox/koha/C4/Creators/Profile.pm line 164. Create a printer profile for the label creator tool - error message in /var/log/koha/kohadev/plack-error.log: 12 profile_id is currently undefined. at /kohadevbox/koha/C4/Creators/Profile.pm line 184. 13 DBD::mysql::st execute failed: Incorrect integer value: '' for column 'template_id' at row 1 [for Statement "INSERT INTO printers_profile (units, printer_name, temp late_id, creator, offset_horz, offset_vert, paper_bin, creep_horz, creep_vert) VALUES (?,?,?,?,?,?,?,?,?);" with ParamValues: 0="POINT", 1="ABZ", 2='', 3='Labels', 4=0, 5=0, 6="1", 7=0, 8=0] at /kohadevbox/koha/C4/Creators/Profile.pm line 162. 14 Database returned the following error on attempted INSERT: Incorrect integer value: '' for column 'template_id' at row 1 at /kohadevbox/koha/C4/Creators/Profile.pm line 164.
*** Bug 27517 has been marked as a duplicate of this bug. ***
Still able to work on this Blou?
I suppose we could extend the patch to catch all cases where profile_id is set to '' instead of 0 The errors comes from save(), which seems called by label-edit-template.pl and patroncards/edit-template.pl which are very loose with their assignments of profile_id. But beside that, you'll have to be specific. We coded (and use) this patch in its simplest form, to avoid the problems. But we're not rearchitecturing the underlying issues.
Hi. I have followed the steps of comment 40 and I can't reproduce the problem. Here is what i did: After applying the patch: I attempt to create a new card template. The card template is created. However, I don't see any errors in my plack-intranet-error.log file. I also checked other logs and no error are displayed. I also tried to create a printer profile, as mentioned in the comment. The profile is created and I still can't see any of the errors in the log files.
Created attachment 131381 [details] [review] Bug 24001: Fix Card template/rpinter profile creation and edit This patch adjusts the template/profiles to use the default of '0' This should probably be NULL, and the columns foreign keys, this code could use a further rewrite, but this should fix a long standing bug To test: 1 - Using the fresh install, with all the sample data. 2 - Go to Home › Tools › Patron card creator › Templates 3 - New > Card template 4 - Save 5 - Error: DBD::mysql::st execute failed: Incorrect integer value: '' for column 'profile_id' at row 1 6 - Edit an existing template 7 - Save 8 - Error: Can't bless non-reference value at /kohadevbox/koha/C4/Creators/Profile.pm line 89 9 - Create a new 'Printer profile' 10 - Save 11 - Error: DBD::mysql::st execute failed: Incorrect integer value: '' for column 'template_id' at row 1 12 - Apply the attached patch. 13 - Verify you can create a new 'Card template' and 'Printer profile' with no errors 14 - Verify you can edit and save both of the newly created objects above
Created attachment 131494 [details] [review] Bug 24001: Fix patron card template edition Error when saving Patron card Template: Can't bless non-reference value at /home/vagrant/kohaclone/C4/Creators/Profile.pm line 89 This is caused by the profile dropdown offering invalid choices and is fixed by adding a filter to limit options to creator = 'Patroncards'. The UI already handles the case where no valid profile is avaiable. Signed-off-by: Alexis Ripetti <alexis.ripetti@inLibro.com>
Created attachment 131495 [details] [review] Bug 24001: Fix Card template/rpinter profile creation and edit This patch adjusts the template/profiles to use the default of '0' This should probably be NULL, and the columns foreign keys, this code could use a further rewrite, but this should fix a long standing bug To test: 1 - Using the fresh install, with all the sample data. 2 - Go to Home › Tools › Patron card creator › Templates 3 - New > Card template 4 - Save 5 - Error: DBD::mysql::st execute failed: Incorrect integer value: '' for column 'profile_id' at row 1 6 - Edit an existing template 7 - Save 8 - Error: Can't bless non-reference value at /kohadevbox/koha/C4/Creators/Profile.pm line 89 9 - Create a new 'Printer profile' 10 - Save 11 - Error: DBD::mysql::st execute failed: Incorrect integer value: '' for column 'template_id' at row 1 12 - Apply the attached patch. 13 - Verify you can create a new 'Card template' and 'Printer profile' with no errors 14 - Verify you can edit and save both of the newly created objects above
Created attachment 134074 [details] [review] Bug 24001: Fix patron card template edition Error when saving Patron card Template: Can't bless non-reference value at /home/vagrant/kohaclone/C4/Creators/Profile.pm line 89 This is caused by the profile dropdown offering invalid choices and is fixed by adding a filter to limit options to creator = 'Patroncards'. The UI already handles the case where no valid profile is avaiable. Signed-off-by: Alexis Ripetti <alexis.ripetti@inLibro.com> Signed-off-by: David Nind <david@davidnind.com>
Created attachment 134075 [details] [review] Bug 24001: Fix Card template/rpinter profile creation and edit This patch adjusts the template/profiles to use the default of '0' This should probably be NULL, and the columns foreign keys, this code could use a further rewrite, but this should fix a long standing bug To test: 1 - Using the fresh install, with all the sample data. 2 - Go to Home › Tools › Patron card creator › Templates 3 - New > Card template 4 - Save 5 - Error: DBD::mysql::st execute failed: Incorrect integer value: '' for column 'profile_id' at row 1 6 - Edit an existing template 7 - Save 8 - Error: Can't bless non-reference value at /kohadevbox/koha/C4/Creators/Profile.pm line 89 9 - Create a new 'Printer profile' 10 - Save 11 - Error: DBD::mysql::st execute failed: Incorrect integer value: '' for column 'template_id' at row 1 12 - Apply the attached patch. 13 - Verify you can create a new 'Card template' and 'Printer profile' with no errors 14 - Verify you can edit and save both of the newly created objects above Signed-off-by: David Nind <david@davidnind.com>
Created attachment 134077 [details] [review] Bug 24001: Fix patron card template edition Error when saving Patron card Template: Can't bless non-reference value at /home/vagrant/kohaclone/C4/Creators/Profile.pm line 89 This is caused by the profile dropdown offering invalid choices and is fixed by adding a filter to limit options to creator = 'Patroncards'. The UI already handles the case where no valid profile is avaiable. Signed-off-by: Alexis Ripetti <alexis.ripetti@inLibro.com> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 134078 [details] [review] Bug 24001: Fix Card template/rpinter profile creation and edit This patch adjusts the template/profiles to use the default of '0' This should probably be NULL, and the columns foreign keys, this code could use a further rewrite, but this should fix a long standing bug To test: 1 - Using the fresh install, with all the sample data. 2 - Go to Home › Tools › Patron card creator › Templates 3 - New > Card template 4 - Save 5 - Error: DBD::mysql::st execute failed: Incorrect integer value: '' for column 'profile_id' at row 1 6 - Edit an existing template 7 - Save 8 - Error: Can't bless non-reference value at /kohadevbox/koha/C4/Creators/Profile.pm line 89 9 - Create a new 'Printer profile' 10 - Save 11 - Error: DBD::mysql::st execute failed: Incorrect integer value: '' for column 'template_id' at row 1 12 - Apply the attached patch. 13 - Verify you can create a new 'Card template' and 'Printer profile' with no errors 14 - Verify you can edit and save both of the newly created objects above Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Looking good and fixes the issue.. no QA script highlights so Passing QA
Created attachment 134080 [details] [review] Bug 24001: Fix patron card template edition Error when saving Patron card Template: Can't bless non-reference value at /home/vagrant/kohaclone/C4/Creators/Profile.pm line 89 This is caused by the profile dropdown offering invalid choices and is fixed by adding a filter to limit options to creator = 'Patroncards'. The UI already handles the case where no valid profile is avaiable. Signed-off-by: Alexis Ripetti <alexis.ripetti@inLibro.com> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> https://bugs.koha-community.org/show_bug.cgi?id=30373
Created attachment 134081 [details] [review] Bug 24001: Fix Card template/rpinter profile creation and edit This patch adjusts the template/profiles to use the default of '0' This should probably be NULL, and the columns foreign keys, this code could use a further rewrite, but this should fix a long standing bug To test: 1 - Using the fresh install, with all the sample data. 2 - Go to Home › Tools › Patron card creator › Templates 3 - New > Card template 4 - Save 5 - Error: DBD::mysql::st execute failed: Incorrect integer value: '' for column 'profile_id' at row 1 6 - Edit an existing template 7 - Save 8 - Error: Can't bless non-reference value at /kohadevbox/koha/C4/Creators/Profile.pm line 89 9 - Create a new 'Printer profile' 10 - Save 11 - Error: DBD::mysql::st execute failed: Incorrect integer value: '' for column 'template_id' at row 1 12 - Apply the attached patch. 13 - Verify you can create a new 'Card template' and 'Printer profile' with no errors 14 - Verify you can edit and save both of the newly created objects above Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> https://bugs.koha-community.org/show_bug.cgi?id=30373
Agreeing with Martin, sorry, we overlapped! I filed 2 new bugs: Bug 30629 - <span> in title of patron card creator template needs to be removed Bug 30631 - Show list of existing printer profiles when creating a new patron card template
Created attachment 134124 [details] [review] Bug 24001: Fix patron card template edition Error when saving Patron card Template: Can't bless non-reference value at /home/vagrant/kohaclone/C4/Creators/Profile.pm line 89 This is caused by the profile dropdown offering invalid choices and is fixed by adding a filter to limit options to creator = 'Patroncards'. The UI already handles the case where no valid profile is avaiable. Signed-off-by: Alexis Ripetti <alexis.ripetti@inLibro.com> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Created attachment 134125 [details] [review] Bug 24001: Fix Card template/rpinter profile creation and edit This patch adjusts the template/profiles to use the default of '0' This should probably be NULL, and the columns foreign keys, this code could use a further rewrite, but this should fix a long standing bug To test: 1 - Using the fresh install, with all the sample data. 2 - Go to Home › Tools › Patron card creator › Templates 3 - New > Card template 4 - Save 5 - Error: DBD::mysql::st execute failed: Incorrect integer value: '' for column 'profile_id' at row 1 6 - Edit an existing template 7 - Save 8 - Error: Can't bless non-reference value at /kohadevbox/koha/C4/Creators/Profile.pm line 89 9 - Create a new 'Printer profile' 10 - Save 11 - Error: DBD::mysql::st execute failed: Incorrect integer value: '' for column 'template_id' at row 1 12 - Apply the attached patch. 13 - Verify you can create a new 'Card template' and 'Printer profile' with no errors 14 - Verify you can edit and save both of the newly created objects above Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Pushed to master for 22.05, thanks to everybody involved [U+1F984]
Created attachment 134346 [details] [review] Bug 24001: (follow-up) Fix t_Profile.t
Test suite was failing, like : https://jenkins.koha-community.org/view/master/job/Koha_Master_D10/624/testReport/ Fixed by changing expected values.
Pushed to 21.11.x for 21.11.06
Backported: Pushed to 21.05.x branch for 21.05.16
Bugfix with not visual or workflow changes, no documentation updates required.