Bug 19263

Summary: Advanced Editor - Rancor - Add auto control number (001) widget
Product: Koha Reporter: Nick Clemens <nick>
Component: CatalogingAssignee: Cori Lynn Arnold <carnold>
Status: CLOSED FIXED QA Contact: Josef Moravec <josef.moravec>
Severity: enhancement    
Priority: P5 - low CC: carnold, jonathan.druart, josef.moravec, katrin.fischer, m.de.rooy, martin.renvoize
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 18823    
Attachments: Bug 19263: Rancor - Add auto-001 widget
Bug 19263: Rancor - Add auto-001 widget
Bug 19263: Rancor - Add auto-001 widget
Bug 19263 Advanced Editor - Rancor - Add auto control number (001) widget
Bug 19263: Rancor - Add auto control number (001) widget
Bug 19263: Rancor - Add auto control number (001) widget
Bug 19263: 001 widget only for configured client
Bug 19263: Rancor - Add auto-001 widget
Bug 19263: Advanced Editor - Rancor - Add auto control number (001) widget
Bug 19263: 001 widget only for configured client
Bug 19263: Changes to address QA issues
Bug 19263: Rancor - Add auto-001 widget
Bug 19263: Rancor - 001 widget - db update
Bug 19263: Rancor - 001 widdget only for configured client
Bug 19263: Rancor - 001 widget - changes to address QA issues

Description Nick Clemens 2017-09-06 14:42:49 UTC

    
Comment 1 Nick Clemens 2017-09-06 17:43:23 UTC Comment hidden (obsolete)
Comment 2 Nick Clemens 2018-07-11 14:59:46 UTC Comment hidden (obsolete)
Comment 3 Claire Gravely 2018-08-22 06:34:25 UTC
Created attachment 78085 [details] [review]
Bug 19263: Rancor - Add auto-001 widget

To test:

1 - Define a new authorised valued category "CONTROL_NUM_SEQUENCE"
2 - Add a value/sequence
    The authorised_value is the starting value - shoudl end in a number
    that can be incremented e.g. "control_sequence_001"
    The description field is the name for the seqeuence
    Opac description is unused
3 - Edit a record in rancor
4 - Note the new widget and option to increment or assign manually

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>
Comment 4 Katrin Fischer 2018-08-28 06:07:07 UTC
I think this is a nice addition, but some small things:

- Please add the new authorised value category to the default list and add a database update.
- The Plugin will show always now, there is no way to turn it off.  I think we shouldn't force it like that. As we can't delete authorised value categories at the moment, maybe the easiest would be to look for existing entries and decide on that if the feature should be active or not. It also wouldn't leave you with an empty/non-working widget so easily.
- The buttons are a little huge going over the lines... (not blocker, but having a look would be cool)
Comment 5 Cori Lynn Arnold 2018-10-08 16:03:49 UTC
Making changes based on feedback.
Comment 6 Cori Lynn Arnold 2018-10-08 16:29:03 UTC
Created attachment 80231 [details] [review]
Bug 19263 Advanced Editor - Rancor - Add auto control number (001)     widget

In advanced editor mode for cataloging, the 001 widget will
    automatically assign the next control number if a format is defined
    in  authorised_values table.

    To test you need access to the database.
    1) Verify that a new entry for CONTROL_NUM_SEQUENCE is added to
    table  authorised_value_categories
    2) Enter a new value for authorised_values with the authorised_value
    column ending in a number
    3) Edit a record using the advanced editor, specifically the 001
    field
    4) Note the new widget and option to increment or assign manually.

    The buttons fit within the widget now, and there's a database update
    to create the CONTROL_NUM_SEQUENCE.
Comment 7 Cori Lynn Arnold 2018-10-08 16:31:20 UTC
Bug 19263 Rancor - Add auto control number (001) widget

In advanced editor mode for cataloging, the 001 widget will
    automatically assign the next control number if a format is defined
    in  authorised_values table.

    To test you need access to the database.
    1) Verify that a new entry for CONTROL_NUM_SEQUENCE is added to
    table  authorised_value_categories
    2) Enter a new value for authorised_values with the authorised_value
    column ending in a number
    3) Edit a record using the advanced editor, specifically the 001
    field
    4) Note the new widget and option to increment or assign manually.

    The buttons fit within the widget now, and there's a database update
    to create the CONTROL_NUM_SEQUENCE.
Comment 8 Jonathan Druart 2018-10-08 19:08:23 UTC
Quick feedback on the second patch:
1. Commit message must start with "Bug 19263: ", not a big deal ;)
2. Changes in the atomic update files will affect existing installations only. Changes to installer/data/mysql/mandatory/auth_val_cat.sql must be provided for new installations.
3. At first glance the second remark from comment 4 has not been taken into account.
Comment 9 Cori Lynn Arnold 2018-10-08 20:51:44 UTC Comment hidden (obsolete)
Comment 10 Cori Lynn Arnold 2018-10-08 20:52:23 UTC
See Comment 9
Comment 11 Cori Lynn Arnold 2018-10-08 21:35:04 UTC Comment hidden (obsolete)
Comment 12 Cori Lynn Arnold 2018-10-09 12:32:05 UTC Comment hidden (obsolete)
Comment 13 Cori Lynn Arnold 2018-10-09 13:01:24 UTC
Created attachment 80257 [details] [review]
Bug 19263: 001 widget only for configured client

Tests:

1) Verify that a new entry for CONTROL_NUM_SEQUENCE is added to table
authorised_value_categories
2) Edit a bib record using advanced editor and note that 001 widget
isn't there when adding/editing 001 field
3) Add a new row into authorised_values table with:
    a) CONTROL_NUM_SEQUENCE in category column
    b) authorised_value column has a string ending with a number i.e.
    "faw0001"
    c) lib column has a short string indicating type of control number
    i.e. "FAW"
4) Edit a bib record using the advanced editor and note that the 001
widget is there when adding / editing 001 field
Comment 14 Nick Clemens 2018-10-09 19:19:23 UTC
Created attachment 80306 [details] [review]
Bug 19263: Rancor - Add auto-001 widget

To test:

1 - Define a new authorised valued category "CONTROL_NUM_SEQUENCE"
2 - Add a value/sequence
    The authorised_value is the starting value - shoudl end in a number
    that can be incremented e.g. "control_sequence_001"
    The description field is the name for the seqeuence
    Opac description is unused
3 - Edit a record in rancor
4 - Note the new widget and option to increment or assign manually

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>
Comment 15 Nick Clemens 2018-10-09 19:19:28 UTC
Created attachment 80307 [details] [review]
Bug 19263: Advanced Editor - Rancor - Add auto control number (001) widget

    In advanced editor mode for cataloging, the 001 widget will
    automatically assign the next control number if a format is defined
    in  authorised_values table.

    To test you need access to the database.
    1) Verify that a new entry for CONTROL_NUM_SEQUENCE is added to
    table  authorised_value_categories
    2) Enter a new value for authorised_values with the authorised_value
    column ending in a number
    3) Edit a record using the advanced editor, specifically the 001
    field
    4) Note the new widget and option to increment or assign manually.

    The buttons fit within the widget now, and there's a database update
    to create the CONTROL_NUM_SEQUENCE.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 16 Nick Clemens 2018-10-09 19:19:32 UTC
Created attachment 80308 [details] [review]
Bug 19263: 001 widget only for configured client

Tests:

1) Verify that a new entry for CONTROL_NUM_SEQUENCE is added to table
authorised_value_categories
2) Edit a bib record using advanced editor and note that 001 widget
isn't there when adding/editing 001 field
3) Add a new row into authorised_values table with:
    a) CONTROL_NUM_SEQUENCE in category column
    b) authorised_value column has a string ending with a number i.e.
    "faw0001"
    c) lib column has a short string indicating type of control number
    i.e. "FAW"
4) Edit a bib record using the advanced editor and note that the 001
widget is there when adding / editing 001 field

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 17 Josef Moravec 2018-10-12 10:24:32 UTC
Comment on attachment 80308 [details] [review]
Bug 19263: 001 widget only for configured client

Review of attachment 80308 [details] [review]:
-----------------------------------------------------------------

::: installer/data/mysql/mandatory/auth_val_cat.sql
@@ +44,4 @@
>      ('HINGS_C'),
>      ('HINGS_AS'),
>      ('HINGS_RD'),
> +    ('STACK')

There is missing colon

::: koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-widgets-marc21.inc
@@ +127,5 @@
> +                    + _("Control number: ")
> +                    + '<span class="control-number-widget-contents"></span>'
> +                    + '<button class="control-number-widget-assign">' + _("Assign next") + '</button>'
> +                    + '<select class="control-number-widget-sequence"></select>'
> +                    + '<button class="control-number-widget-override">Override</button>'

"Override" is not translatable

@@ +157,5 @@
> +
> +                        if ( result ) widget.setControlNumber( result );
> +                    } ).end();
> +
> +                var sequence_list = $.map( KohaBackend.GetAuthorisedValues( 'CONTROL_NUM_SEQUENCE' ), function( authval ) {

You don't need to fetch authorised values again - you have them in reg001 variable
Comment 18 Josef Moravec 2018-10-12 10:29:23 UTC
And I think it would make more sense to have number in lib and the type of control number in authorised_value - there is a precendence for this in stocknumberAV value builder.
Comment 19 Cori Lynn Arnold 2018-10-12 13:27:54 UTC
(In reply to Josef Moravec from comment #18)
> And I think it would make more sense to have number in lib and the type of
> control number in authorised_value - there is a precendence for this in
> stocknumberAV value builder.


I don't think so. The point of the lib is to hold the string indicating the type of control number, in our case at DGI, it's intended to hold the client name, like "Springfield Library." It seems like most of the strings in lib contain descriptions/types for the authorised_value.
Comment 20 Cori Lynn Arnold 2018-10-12 14:08:29 UTC
Created attachment 80500 [details] [review]
Bug 19263: Changes to address QA issues

Changes were made to address QA issues from Comment 17

Tests:

1) Verify that a new entry for CONTROL_NUM_SEQUENCE is added to table authorised_value_categories
2) Edit a bib record using advanced editor and note that the 001 widget isn't there when adding/editing 001 field
3) Add a new row into authorised_values table with:
     a) CONTROL_NUM_SEQUENCE in category column
     b) authorised_value column has a string ending with a number i.e. sprLib0001
     c) lib column has a short string indicating the type of control number i.e. "Springfield Library"
4) Edit a bib record using the advanced editor and note that the 001 widget is there when adding / editing 001 field
Comment 21 Cori Lynn Arnold 2018-10-12 14:09:46 UTC
Changes to address QA issues in Comment 17
Comment 22 Josef Moravec 2018-10-12 14:15:06 UTC
    (In reply to Cori Lynn Arnold from comment #19)
    > (In reply to Josef Moravec from comment #18)
    > > And I think it would make more sense to have number in lib and the type of
    > > control number in authorised_value - there is a precendence for this in
    > > stocknumberAV value builder.
    > 
    > 
    > I don't think so. The point of the lib is to hold the string indicating the
    > type of control number, in our case at DGI, it's intended to hold the client
    > name, like "Springfield Library." It seems like most of the strings in lib
    > contain descriptions/types for the authorised_value.

    I understand your position, just pointed out there is an precedence on taking the seqeunce from authorised values. But I will not block the patches because of this.
Comment 23 Josef Moravec 2018-10-12 14:24:58 UTC
Created attachment 80508 [details] [review]
Bug 19263: Rancor - Add auto-001 widget

To test:

1 - Define a new authorised valued category "CONTROL_NUM_SEQUENCE"
2 - Add a value/sequence
    The authorised_value is the starting value - shoudl end in a number
    that can be incremented e.g. "control_sequence_001"
    The description field is the name for the seqeuence
    Opac description is unused
3 - Edit a record in rancor
4 - Note the new widget and option to increment or assign manually

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 24 Josef Moravec 2018-10-12 14:25:03 UTC
Created attachment 80509 [details] [review]
Bug 19263: Rancor - 001 widget - db update

    In advanced editor mode for cataloging, the 001 widget will
    automatically assign the next control number if a format is defined
    in  authorised_values table.

    To test you need access to the database.
    1) Verify that a new entry for CONTROL_NUM_SEQUENCE is added to
    table  authorised_value_categories
    2) Enter a new value for authorised_values with the authorised_value
    column ending in a number
    3) Edit a record using the advanced editor, specifically the 001
    field
    4) Note the new widget and option to increment or assign manually.

    The buttons fit within the widget now, and there's a database update
    to create the CONTROL_NUM_SEQUENCE.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 25 Josef Moravec 2018-10-12 14:25:08 UTC
Created attachment 80510 [details] [review]
Bug 19263: Rancor - 001 widdget only for configured client

Tests:

1) Verify that a new entry for CONTROL_NUM_SEQUENCE is added to table
authorised_value_categories
2) Edit a bib record using advanced editor and note that 001 widget
isn't there when adding/editing 001 field
3) Add a new row into authorised_values table with:
    a) CONTROL_NUM_SEQUENCE in category column
    b) authorised_value column has a string ending with a number i.e.
    "faw0001"
    c) lib column has a short string indicating type of control number
    i.e. "FAW"
4) Edit a bib record using the advanced editor and note that the 001
widget is there when adding / editing 001 field

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 26 Josef Moravec 2018-10-12 14:25:13 UTC
Created attachment 80511 [details] [review]
Bug 19263: Rancor - 001 widget - changes to address QA issues

Changes were made to address QA issues from Comment 17

Tests:

1) Verify that a new entry for CONTROL_NUM_SEQUENCE is added to table authorised_value_categories
2) Edit a bib record using advanced editor and note that the 001 widget isn't there when adding/editing 001 field
3) Add a new row into authorised_values table with:
     a) CONTROL_NUM_SEQUENCE in category column
     b) authorised_value column has a string ending with a number i.e. sprLib0001
     c) lib column has a short string indicating the type of control number i.e. "Springfield Library"
4) Edit a bib record using the advanced editor and note that the 001 widget is there when adding / editing 001 field

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 27 Nick Clemens 2018-10-27 14:26:42 UTC
Awesome work all!

Pushed to master for 18.11
Comment 28 Martin Renvoize 2018-11-08 15:22:35 UTC
Enhancement, will not be backported to 18.05.x series.
Comment 29 Katrin Fischer 2018-11-09 14:55:28 UTC
*** Bug 18418 has been marked as a duplicate of this bug. ***