Bugzilla – Attachment 80308 Details for
Bug 19263
Advanced Editor - Rancor - Add auto control number (001) widget
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19263: 001 widget only for configured client
Bug-19263-001-widget-only-for-configured-client.patch (text/plain), 7.07 KB, created by
Nick Clemens (kidclamp)
on 2018-10-09 19:19:32 UTC
(
hide
)
Description:
Bug 19263: 001 widget only for configured client
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2018-10-09 19:19:32 UTC
Size:
7.07 KB
patch
obsolete
>From 69dc406b3b8eeb059debb2b52d8f769c078872de Mon Sep 17 00:00:00 2001 >From: Cori Lynn Arnold <carnold@dgiinc.com> >Date: Tue, 9 Oct 2018 12:48:58 +0000 >Subject: [PATCH] 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> >--- > installer/data/mysql/mandatory/auth_val_cat.sql | 3 +- > .../prog/en/includes/cateditor-widgets-marc21.inc | 106 +++++++++++---------- > 2 files changed, 59 insertions(+), 50 deletions(-) > >diff --git a/installer/data/mysql/mandatory/auth_val_cat.sql b/installer/data/mysql/mandatory/auth_val_cat.sql >index 6fff954..df119a0 100644 >--- a/installer/data/mysql/mandatory/auth_val_cat.sql >+++ b/installer/data/mysql/mandatory/auth_val_cat.sql >@@ -44,7 +44,8 @@ INSERT IGNORE INTO authorised_value_categories( category_name ) > ('HINGS_C'), > ('HINGS_AS'), > ('HINGS_RD'), >- ('STACK'); >+ ('STACK') >+ ('CONTROL_NUM_SEQUENCE'); > > -- UNIMARC specific? > INSERT IGNORE INTO authorised_value_categories( category_name ) VALUES >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-widgets-marc21.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-widgets-marc21.inc >index 92b8b8c..970f58e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-widgets-marc21.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-widgets-marc21.inc >@@ -113,56 +113,64 @@ require( [ 'koha-backend', 'widget' ], function( KohaBackend, Widget ) { > }, > } ); > >- Widget.Register( '001@', { >- init: function() { >- var $result = $( >- '<span class="subfield-widget">' >- + _("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>' >- + '</span>' >- ); >+ /* Check to see if there are any Control Number entries >+ * in the authorised values table. >+ * If not, let's not show the widget >+ */ >+ var reg001 = KohaBackend.GetAuthorisedValues( 'CONTROL_NUM_SEQUENCE'); >+ if(reg001) { >+ >+ Widget.Register( '001@', { >+ init: function() { >+ var $result = $( >+ '<span class="subfield-widget">' >+ + _("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>' >+ + '</span>' >+ ); > >- return $result[0]; >- }, >- setControlNumber: function( text ) { >- if ( text ) this.setText( text ); >- $( this.node ).find('.control-number-widget-contents') >- .html( text == '<empty>' ? ( '<span class="hint">' + _("unset") + '</span>' ) : text ); >- this.mark.changed(); >- }, >- postCreate: function( node, mark ) { >- var widget = this; >- this.setControlNumber( this.text ); >- $( this.node ) >- .find('.control-number-widget-assign').click( function() { >- var sequence = $( widget.node ).find('.control-number-widget-sequence').val(); >- $.post( >- '/cgi-bin/koha/svc/cataloguing/control_num_sequences/' + sequence >- ).done( function( result ) { >- if ( result.next_value ) widget.setControlNumber( result.next_value ); >- } ); >- } ).end() >- .find('.control-number-widget-override').click( function() { >- var result = prompt( _("Enter new control number") ); >- >- if ( result ) widget.setControlNumber( result ); >- } ).end(); >- >- var sequence_list = $.map( KohaBackend.GetAuthorisedValues( 'CONTROL_NUM_SEQUENCE' ), function( authval ) { >- return authval.lib; >- } ); >- sequence_list.sort(); >- >- $.each( sequence_list, function( undef, sequence ) { >- $( widget.node ).find('.control-number-widget-sequence').append( '<option>' + sequence + '</option>' ); >- } ); >- >- // TODO: Make Enter on select click "Assign" >- } >- } ); >+ return $result[0]; >+ }, >+ setControlNumber: function( text ) { >+ if ( text ) this.setText( text ); >+ $( this.node ).find('.control-number-widget-contents') >+ .html( text == '<empty>' ? ( '<span class="hint">' + _("unset") + '</span>' ) : text ); >+ this.mark.changed(); >+ }, >+ postCreate: function( node, mark ) { >+ var widget = this; >+ this.setControlNumber( this.text ); >+ $( this.node ) >+ .find('.control-number-widget-assign').click( function() { >+ var sequence = $( widget.node ).find('.control-number-widget-sequence').val(); >+ $.post( >+ '/cgi-bin/koha/svc/cataloguing/control_num_sequences/' + sequence >+ ).done( function( result ) { >+ if ( result.next_value ) widget.setControlNumber( result.next_value ); >+ } ); >+ } ).end() >+ .find('.control-number-widget-override').click( function() { >+ var result = prompt( _("Enter new control number") ); >+ >+ if ( result ) widget.setControlNumber( result ); >+ } ).end(); >+ >+ var sequence_list = $.map( KohaBackend.GetAuthorisedValues( 'CONTROL_NUM_SEQUENCE' ), function( authval ) { >+ return authval.lib; >+ } ); >+ sequence_list.sort(); >+ >+ $.each( sequence_list, function( undef, sequence ) { >+ $( widget.node ).find('.control-number-widget-sequence').append( '<option>' + sequence + '</option>' ); >+ } ); >+ >+ // TODO: Make Enter on select click "Assign" >+ } >+ } ); >+ }; > > Widget.Register( '005@', { > init: function() { >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 19263
:
66897
|
76864
|
78085
|
80231
|
80237
|
80240
|
80257
|
80306
|
80307
|
80308
|
80500
|
80508
|
80509
|
80510
|
80511