Bug 14510

Summary: Allow column visibility in additem.pl to be customized
Product: Koha Reporter: Jesse Weaver <jweaver>
Component: CatalogingAssignee: Jesse Weaver <jweaver>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: jonathan.druart, jschmidt, m.de.rooy, nengard, nicole, tomascohen, veron
Version: master   
Hardware: All   
OS: All   
Change sponsored?: Sponsored Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 14510: Allow column visibility in additem.pl to be customized
Bug 14510: Allow column visibility in additem.pl to be customized
Bug 14510: (QA followup) remove extraneous whitespace
Bug 14510: (QA followup) Add more columns, resort
Bug 14510: (QA followup) Fix bug with unmapped columns
Bug 14510: Redirect to the items' fields mapped
Bug 14510: (QA followup) fix columns settings in other pages
Bug 14510: Allow column visibility in additem.pl to be customized
Bug 14510: (QA followup) remove extraneous whitespace
Bug 14510: (QA followup) Add more columns, resort
Bug 14510: (QA followup) Fix bug with unmapped columns
Bug 14510: Redirect to the items' fields mapped
Bug 14510: (QA followup) fix columns settings in other pages

Description Jesse Weaver 2015-07-09 03:14:48 UTC
It should be possible to customize column visibility in the items table in additem.pl through the columns configuration tool.
Comment 1 Jesse Weaver 2015-07-13 21:06:12 UTC Comment hidden (obsolete)
Comment 2 Marc Véron 2015-07-30 08:46:49 UTC
Sorry, QA tools found some forbidden tab chars:

cataloguing/additem.pl
		forbidden pattern: tab char (line 807)

koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc
		forbidden pattern: tab char (line 13)
		forbidden pattern: tab char (line 12)

koha-tmpl/intranet-tmpl/prog/en/modules/admin/columns_settings.tt
		forbidden pattern: tab char (line 15)
		forbidden pattern: tab char (line 22)
		forbidden pattern: tab char (line 17)
		forbidden pattern: tab char (line 16)

koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt
		forbidden pattern: tab char (line 41)
		forbidden pattern: tab char (line 40)
Comment 3 Jesse Weaver 2015-08-06 18:48:52 UTC Comment hidden (obsolete)
Comment 4 Jesse Weaver 2015-08-06 18:49:05 UTC Comment hidden (obsolete)
Comment 5 Jonathan Druart 2015-08-19 08:41:38 UTC
Jesse,
This works quite well!
How did you choose the order of the fields on the column settings configuration page?
What about the stocknumber and statisticvalue fields, for instance?
Comment 6 Jesse Weaver 2015-08-20 15:17:21 UTC
(In reply to Jonathan Druart from comment #5)
> Jesse,
> This works quite well!
> How did you choose the order of the fields on the column settings
> configuration page?
> What about the stocknumber and statisticvalue fields, for instance?

The order and selection of the columns in question is based on which columns are mapped to subfields in the MARC21 framework. These are the only columns that can appear in the table.

Are there any such fields that are mapped in UNIMARC but not MARC21?
Comment 7 Jonathan Druart 2015-08-21 11:22:27 UTC
 Joubu: pianohacker: for instance stocknumber is not mapped by default, but can be mapped
 pianohacker: hrm, decent point. 
 pianohacker: Joubu: based on my patch, and your work with the datatables stuff, even if I throw in all those columns it will only show the ones that are actually visible in the "show/hide columns" menu, and in the correct order, right?
 Joubu: I think so, yes
 matts est désormais connu sous le nom de matts_away
 Joubu: that's the point, I think it's better to show all columns
 pianohacker: agreed
 nengard est désormais connu sous le nom de nengard_webinar
 Joubu: and display them either the order on admin/koha2marclinks.pl either the DB order
 edveal-afk est désormais connu sous le nom de edveal
 Joubu: DB order ie. kohastructure.sql
 pianohacker: yeah, to be consistent with something
 pianohacker: Joubu: all right, have that on my todo list.
Comment 8 Jesse Weaver 2015-08-21 20:08:08 UTC Comment hidden (obsolete)
Comment 9 Jonathan Druart 2015-08-25 12:04:15 UTC
Jesse,

This does not work (even without the last patch).
To reproduce: hide the first column by default (barcode), save and refresh the add item page.
The first column is hidden (in my case 'damaged').

You will have to change the way the feature works. The way it works currently is based on the order of the columns, not the names.

Marked as Failed QA.
Comment 10 Jesse Weaver 2015-08-27 19:32:37 UTC
(In reply to Jonathan Druart from comment #9)
> Jesse,
> 
> This does not work (even without the last patch).
> To reproduce: hide the first column by default (barcode), save and refresh
> the add item page.
> The first column is hidden (in my case 'damaged').
> 
> You will have to change the way the feature works. The way it works
> currently is based on the order of the columns, not the names.
> 
> Marked as Failed QA.

Was this on a UNIMARC system? If so, is there any chance you could post a sandbox link that I could look at? I thought I'd made it possible for it to work based on name.
Comment 11 Jonathan Druart 2015-08-28 08:33:37 UTC
Yes it was a UNIMARC install.

But same on a MARC21 fresh install.

Check "cn_source is hidden by default".
Refresh cataloguing/additem.pl?biblionumber=109

The third column is hidden (damaged status).
Comment 12 Jesse Weaver 2015-08-31 23:52:40 UTC
(In reply to Jonathan Druart from comment #11)
> Yes it was a UNIMARC install.
> 
> But same on a MARC21 fresh install.
> 
> Check "cn_source is hidden by default".
> Refresh cataloguing/additem.pl?biblionumber=109
> 
> The third column is hidden (damaged status).

This is very bizarre; I can't duplicate this issue. Could I ask you to post a link to a sandbox where this issue occurs, so I can poke around?
Comment 13 Jonathan Druart 2015-09-01 08:32:02 UTC
On sandbox 13 (reminder: the DB is erased every day).

http://pro.test13.biblibre.com/cgi-bin/koha/admin/columns_settings.pl :
barcode, dateaccessioned and homebranch are hidden by default.

http://pro.test13.biblibre.com/cgi-bin/koha/cataloguing/additem.pl?biblionumber=9
"Propriétaire", "Dépositaire" and "Code barres" are hidden

Propriétaire: homebranch
Dépositaire: holdingbranch
Code barres: barcode
Comment 14 Jonathan Druart 2015-09-01 08:34:27 UTC
Ok, I found why it does not work: dateaccessioned is not mapped.

Same with my previous example, barcode is not mapped on my local install.
Comment 15 Jesse Weaver 2015-09-03 19:57:56 UTC Comment hidden (obsolete)
Comment 16 Jonathan Druart 2015-09-04 08:15:44 UTC Comment hidden (obsolete)
Comment 17 Jonathan Druart 2015-09-04 08:16:52 UTC
Jesse,
Great, it works perfectly, for the items editor table...
Not the others :)
Try the late orders table for instance, the ft is broken on it.
Comment 18 Jesse Weaver 2015-09-16 23:24:09 UTC Comment hidden (obsolete)
Comment 19 Jonathan Druart 2015-09-17 07:12:00 UTC
Created attachment 42628 [details] [review]
Bug 14510: Allow column visibility in additem.pl to be customized

This patch adds the table of items on additem.pl to the columns
customizer.

Test plan:
  1. Open item editor on a record, and verify that all columns are visible.
  2. Apply patch.
  3. Reload editor, and verify that column visibility hasn't changed.
  4. Open "Hide/show columns," and verify that you can add and remove
     columns.
  5. Change the visibility and togglability of some columns in
     columns_settings.pl, and verify that these correctly apply to
     additem.pl.

NOTE: The columns that are configurable are selected from the non-hidden
columns that have mappings to MARC subfields in the default MARC21
framework (and can thus be displayed in the item editor).

Signed-off-by: Jenny Schmidt <jschmidt@switchinc.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 20 Jonathan Druart 2015-09-17 07:12:03 UTC
Created attachment 42629 [details] [review]
Bug 14510: (QA followup) remove extraneous whitespace

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 21 Jonathan Druart 2015-09-17 07:12:06 UTC
Created attachment 42630 [details] [review]
Bug 14510: (QA followup) Add more columns, resort

Per a conversation with Jonathan Druart, add all columns that could be
reasonably mapped, and order them the same as in kohastructure.sql.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 22 Jonathan Druart 2015-09-17 07:12:09 UTC
Created attachment 42631 [details] [review]
Bug 14510: (QA followup) Fix bug with unmapped columns

Fall back more smoothly when items subfields are not mapped to a
kohafield. Note, however, that this development does not allow applying
default settings to subfields that aren't mapped. A note has been added
to the columns settings page, as there is no known workaround for this.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 23 Jonathan Druart 2015-09-17 07:12:13 UTC
Created attachment 42632 [details] [review]
Bug 14510: Redirect to the items' fields mapped

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 24 Jonathan Druart 2015-09-17 07:12:16 UTC
Created attachment 42633 [details] [review]
Bug 14510: (QA followup) fix columns settings in other pages

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 25 Tomás Cohen Arazi 2015-09-18 15:10:03 UTC
Patches pushed to master.

Thanks Jesse!