2.2+ Editing MARC Fixed Fields jumps cursor to marc record

Bug #1053074 reported by Steve Callender
32
This bug affects 6 people
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Medium
Unassigned
2.2
Fix Released
Medium
Unassigned
2.3
Fix Released
Medium
Unassigned
2.4
Fix Released
Medium
Unassigned

Bug Description

In 2.2+, it looks like when editing the fixed fields in the MARC editor, once you reach the maximum allowed characters for a fixed fields, the cursor jumps straight down to the MARC record. (Probably the last field edited).

This causes a problem in workflow when entering in fixed field data, as you constantly need to select the next fixed field you want to edit with the mouse rather than just being able to edit, tab, edit, tab.

It looks like at some point the code was changed to save the fixed field data after it's been entered completely for a field, rather than updating it one character at a time. This may be the culprit here. It looks like when it's saving the field, we want to retain the cursor on the fixed field that was being saved.

Tags: pullrequest
Revision history for this message
Steve Callender (stevecallender) wrote :

I also noticed an issue when changing the record type. (Right click the record type and select a new one). After changing it, you seem to start losing fixed fields rows and there's no way to get them back without reloading the screen.

Changed in evergreen:
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Simon Mai (simonmai) wrote :

Our libs got this issue when entering fields in workflow.
"Jumping cursor to marc record" issue has been caused by loadRecord() function whenever you filled in a fixed filed (with enough length of characters). The loadRecord() will "refresh" the below record table with the new value you just put in, and yes, after that, keep the cursor on the MARC record table. So, we want to put the cursor back to the current field we're editing, right?
Here is solution -> insert once more code line in this file: /openils.var/web/xul/rel_2_3.1/server/cat/marcedit.js
(rel_2_x.y is depending on your version)
Search this function "updateFixedFields (line 816):
   function updateFixedFields (element) {
       var grid = document.getElementById('leaderGrid');
       var recGrid = document.getElementById('recGrid');
       var new_value = element.value;
      // Don't take focus away/adjust the record on partial changes
      var length = element.getAttribute('maxlength');
      if(new_value.length < length) return true;

      var marc_rec = new MARC.Record ({ delimiter : '$', marcxml : xml_record.toXMLString() });
      marc_rec.setFixedField(element.getAttribute('name'), new_value);

      var xml_string = marc_rec.toXmlString();
      xml_record = new XML( xml_string );
      if (xml_record..record[0]) xml_record = xml_record..record[0];
      loadRecord(); //line 830

      document.getElementById(element.getAttribute('id')).select(); <== Insert this code

Save changed.
Clear cache of client, close the current client window, open the new one, and you're good to go with what you want ^^

Revision history for this message
Simon Mai (simonmai) wrote :

Here is the patch if someone need it.
I gonna fix another issue relate to this MARC editor also.
Here it is: "the fixed field editor in MARC edit will not allow a field that had data in it to be edited to have no information. Spaces must be added to take up that space-otherwise, it retains the old data."
Should I open another bug?
Simon

Revision history for this message
Jason Stephenson (jstephenson) wrote :

Simon, thank you for your patch and your interest in Evergreen.

Before we can include your code in Evergreen, we need you to add a Developer's Certificate of Origin to this bug to indicate that you did indeed write the code and that you have permission to share it with us:

http://evergreen-ils.org/dokuwiki/doku.php?id=contributing#developer_s_certificate_of_origin

If you plan to make regular or even irregular contributions to Evergreen, it would be best if you learn to use the git distributed version control software and that you request access to the working evergreen git repository. More information on how we use git and how to request access to the working repository is here: http://evergreen-ils.org/dokuwiki/doku.php?id=dev:git

> I gonna fix another issue relate to this MARC editor also.
> Here it is: "the fixed field editor in MARC edit will not allow a field that had data in it to be edited to have no information. >Spaces must be added to take up that space-otherwise, it retains the old data."
> Should I open another bug?

Yes, you should open another bug. We like to keep the bug reports limited to a single problem when possible.

Thanks again,
Jason S.

Revision history for this message
Simon Mai (simonmai) wrote :

Hi Jason,
I'm glad to be able to contribute back to Evergreen.
About putting mine to the working evergreen git repository, I think I have access already. But I didn't push any into Evergreen working repositories yet. Maybe I'll try to push this now. If something is in wrong format, please check and let me know what I need to fix. (Yes, I am still a newbie in GIT "world" though ^^)
I have a staff meeting now. I will try to create a branch and push it into Evergreen soon.
Thank your for your info, Jason.
Simon.

Revision history for this message
Simon Mai (simonmai) wrote :
Simon Mai (simonmai)
tags: added: pullrequest
description: updated
Revision history for this message
Simon Mai (simonmai) wrote :

For those concerning about cataloging and this marc editor issue, you may want to fix the issue in this bug 1152235 also.
Simon.

Ben Shum (bshum)
Changed in evergreen:
milestone: none → 2.4.0-rc
Ben Shum (bshum)
Changed in evergreen:
milestone: 2.4.0-rc → none
Ben Shum (bshum)
Changed in evergreen:
milestone: none → 2.5.0-m1
Revision history for this message
Dan Wells (dbw2) wrote :

Hello Simon,

Thanks for this fix! I've tested it, and it works as intended. However, it had me scratching my head for a bit. Is there a reason why your fix is:

document.getElementById(element.getAttribute('id')).select();

rather than simply:

element.select();

?

There could certainly be a reason (which is why I ask), but in quick testing, the simpler element.select() also got the job done.

If you agree, please update your branch, and I can get this in right away.

Thanks,
Dan

Dan Wells (dbw2)
Changed in evergreen:
status: Confirmed → Incomplete
Revision history for this message
Simon Mai (simonmai) wrote :

Yeah, you're right, Dan.
Here is the new branch with your suggestion:
http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/simonmai/fix_jump_cursor_marc_editor
Thank you,
Simon.

Revision history for this message
Dan Wells (dbw2) wrote :

Looks good, pushed to all targeted branches.

Thanks, Simon!

Changed in evergreen:
status: Incomplete → Fix Committed
Ben Shum (bshum)
Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.