Bug 4888

Summary: pre-set of field indicators value
Product: Koha Reporter: Stefano Bolelli Gallevi <bolelligallevi>
Component: CatalogingAssignee: Salva Zaragoza Rubio <salva>
Status: RESOLVED FIXED QA Contact: Bugs List <koha-bugs>
Severity: enhancement    
Priority: P5 - low CC: black23, bolelligallevi, camins, chris, joao.pinto, josef.moravec, julian.maurice, katrin.fischer, koha.sekjal, marjorie.barry-vila, mirko, paul.poulain, salva, ztajoli
Version: Main   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=2280
Change sponsored?: Seeking developer Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Patches compressed on zip format
New proposed patch
Revised patch without marcflavour discrimination
New propose patch for tt templates and authtype support as well
Bug 4888 - pre-set of field indicators value
Bug 4888 - pre-set of field indicators value
Bug 4888 - pre-set of field indicators value
Bug 4888 - pre-set of field indicators value

Description Stefano Bolelli Gallevi 2010-06-11 14:40:36 UTC
Building a MARC Framework now is not possible to set default values for the field indicators.
It would be very useful to set default values for indicators because in many cases they change very rarely
Comment 1 Jared Camins-Esakov (do not use) 2010-09-29 00:23:49 UTC
*** Bug 5095 has been marked as a duplicate of this bug. ***
Comment 2 Salva Zaragoza Rubio 2010-12-15 12:14:18 UTC
Hi,

With regard to Bug 4888 in the Koha Bugzilla, we would like to know the
development stage on this bug because we had
intended to develop a new functionality to validate indicators depending
on the field you're on according to marc21 rules.
Something like the issue brought up on the bug.

We thought on creating a new section on the intranet to manage the
values of the indicators depending on the field and even the
frameworkcode if you want to.

When you're cataloguing a bibliographic or an authority you'll have the
possibility of open a pop-up to see and choose a correct
value for the indicator you're focused. When you're going to save the
record it will validate the indicators values and notify the wrong
ones.

Thanks

Salva
Comment 3 Jared Camins 2010-12-16 15:30:30 UTC
Salva: to the best of my knowledge, no one has done any work on this bug. Also, the feature you describe sounds very useful.
Comment 4 Salva Zaragoza Rubio 2010-12-17 08:44:00 UTC
(In reply to comment #3)
> Salva: to the best of my knowledge, no one has done any work on this bug. Also,
> the feature you describe sounds very useful.

Ok, perfect, so we carry on with development on the bug and we'll notify further improvements or news

thanks
Comment 5 Salva Zaragoza Rubio 2011-02-01 13:42:32 UTC
Hi,

We have developed a solution for this bug and we would like to know what you think before sending the patch.

There's a little guide about the enhancement in this link:

https://docs.google.com/viewer?a=v&pid=explorer&chrome=true&srcid=0B2dwXW_1hO2qYzdmZTMzZjgtODg0My00OWEwLWJiYTMtNzUzYTliOTE1NDY4&hl=en

Please be free to comment.

Before sending the patch for commit with the new functionality we've uploaded on an external server for anyone who wants to see and comment about it.

http://masmedios.info:8090/

user: developer
password: development

We'll let it active till this friday (2011-01-05) and send the final patch with the proposed changes for public testing.

Please be nice when you're in the server.

Salva
Comment 6 Salva Zaragoza Rubio 2011-02-09 16:04:23 UTC Comment hidden (obsolete)
Comment 7 MJ Ray (software.coop) 2011-03-04 10:27:02 UTC
This bug is mentioned in:
Bug 4888 - Add funtionality for indicators -	Database files http://lists.koha-community.org/pipermail/koha-patches/2011-February/013814.html
Bug 4888 - Add funtionality for indicators -	Intranet Files http://lists.koha-community.org/pipermail/koha-patches/2011-February/013815.html
Comment 8 Nicole C. Engard 2011-03-08 00:34:21 UTC
the first patch does not apply:

Apply? [y]es/[n]o/[e]dit/[v]iew patch/[a]ccept all y
Applying: Bug 4888 - Add funtionality for indicators - Database files
Using index info to reconstruct a base tree...
error: patch failed: kohaversion.pl:16
error: kohaversion.pl: patch does not apply
Did you hand edit your patch?
It does not apply to blobs recorded in its index.
Cannot fall back to three-way merge.
Patch failed at 0001 Bug 4888 - Add funtionality for indicators - Database files
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".
nengard@debian:~/kohaclone$
Comment 9 Salva Zaragoza Rubio 2011-03-08 07:32:44 UTC
Thanks Nicole, I'll review the patch and update it to meet the current master state.

Regards

Salva
Comment 10 Salva Zaragoza Rubio 2011-03-31 20:35:10 UTC Comment hidden (obsolete)
Comment 11 Paul Poulain 2011-04-08 13:07:20 UTC
the new version needs to be signed off
Comment 12 Paul Poulain 2011-04-08 13:19:57 UTC
I have a design problem with this patch.
* marc_indicators marc_indicators_value => couldn't those table just be a field on marc_tag_structure ?
* marc_indicators_values => this table sounds useless for me, it's a constant table, why not use a Perl array ?

Something like 2 fields:
default_indicator1 enum('','0','1','2','3','4','5','6','7','8','9','a','b','c','d'...'z');
default_indicator2 enum('','0','1','2','3','4','5','6','7','8','9','a','b','c','d'...'z');

in marc_tag_structure are they not doing the same thing ?

Otherwise, I like the idea & like the fact you can have control over the valid values of indicators (even if, but i'm not a librarian), I still think most indicators are just here for cutting hairs in 4 -frenchism suspected-)
Comment 13 Salva Zaragoza Rubio 2011-04-08 19:49:18 UTC
(In reply to comment #12)
> I have a design problem with this patch.
> * marc_indicators marc_indicators_value => couldn't those table just be a field
> on marc_tag_structure ?
> * marc_indicators_values => this table sounds useless for me, it's a constant
> table, why not use a Perl array ?
> 
> Something like 2 fields:
> default_indicator1
> enum('','0','1','2','3','4','5','6','7','8','9','a','b','c','d'...'z');
> default_indicator2
> enum('','0','1','2','3','4','5','6','7','8','9','a','b','c','d'...'z');
> 
> in marc_tag_structure are they not doing the same thing ?
> 
> Otherwise, I like the idea & like the fact you can have control over the valid
> values of indicators (even if, but i'm not a librarian), I still think most
> indicators are just here for cutting hairs in 4 -frenchism suspected-)

If we create the values of the indicators as a column in the marc_tag_structure then we can only set one value for indicator-field-framework, and we want to be able to set a list of values for indicator-field-framework. So I created a table "marc_indicators" to relate the field and framework with an indicator, and a second table "marc_indicators_value" related with the former to set a list of values, not only one. A third table "marc_indicators_desc" exists to specify the description of the value (related to an indicator-field-framework) on the language you want to.

The table "marc_indicators_values" contains the allowed values for the indicators so the database is coherent and consistent and can check constraints and perform "on delete cascade" by itself. Besides this approach is more flexible so in a future a development in the intranet can be made to add more values without changing the database (the enum column).
Comment 14 Salva Zaragoza Rubio 2011-04-09 16:41:36 UTC Comment hidden (obsolete)
Comment 15 Katrin Fischer 2011-05-26 06:02:54 UTC
This sounds like an interesting and quite big new feature.

Because of the switch to Template::Toolkit the patch does not apply any longer and needs to be reformatted first.

Applying: Bug 4888 - pre-set of field indicators value
/home/katrin/kohaclone/.git/rebase-apply/patch:278: trailing whitespace.
            my $query = qq|SELECT tagfield,liblibrarian,libopac,mandatory,repeatable 
/home/katrin/kohaclone/.git/rebase-apply/patch:279: trailing whitespace.
                            FROM marc_tag_structure 
/home/katrin/kohaclone/.git/rebase-apply/patch:442: trailing whitespace.
                    $query = qq|INSERT INTO marc_indicators_desc 
/home/katrin/kohaclone/.git/rebase-apply/patch:562: trailing whitespace.
                $query = qq|INSERT INTO marc_indicators_desc 
/home/katrin/kohaclone/.git/rebase-apply/patch:893: trailing whitespace.
#!/usr/bin/perl 
error: patch failed: cataloguing/addbiblio.pl:1029
error: cataloguing/addbiblio.pl: patch does not apply
error: patch failed: installer/data/mysql/de-DE/mandatory/sysprefs.sql:309
error: installer/data/mysql/de-DE/mandatory/sysprefs.sql: patch does not apply
error: patch failed: installer/data/mysql/en/mandatory/sysprefs.sql:309
error: installer/data/mysql/en/mandatory/sysprefs.sql: patch does not apply
error: patch failed: installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql:311
error: installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql: patch does not apply
error: patch failed: installer/data/mysql/it-IT/necessari/sysprefs.sql:295
error: installer/data/mysql/it-IT/necessari/sysprefs.sql: patch does not apply
error: patch failed: installer/data/mysql/pl-PL/mandatory/sysprefs.sql:308
error: installer/data/mysql/pl-PL/mandatory/sysprefs.sql: patch does not apply
error: patch failed: installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql:363
error: installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql: patch does not apply
error: patch failed: installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql:387
error: installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql: patch does not apply
error: patch failed: installer/data/mysql/updatedatabase.pl:4209
error: installer/data/mysql/updatedatabase.pl: patch does not apply
warning: koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css has type 100644, expected 100755
error: koha-tmpl/intranet-tmpl/prog/en/modules/admin/biblio_framework.tmpl: does not exist in index
error: koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tmpl: does not exist in index
error: koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tmpl: does not exist in index
Patch failed at 0001 Bug 4888 - pre-set of field indicators value
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".
Patch left in /tmp/Revised-patch-without-marcflavour-discrimination-JGmNwV.patch
Comment 16 Salva Zaragoza Rubio 2011-05-26 06:38:37 UTC Comment hidden (obsolete)
Comment 17 Julian Maurice 2011-08-05 09:35:01 UTC
Is this patch valid for Unimarc too?
Comment 18 Paul Poulain 2011-08-05 09:57:08 UTC
Julian:
the feature is interesting for UNIMARC too
I don't know if the patch is working for UNIMARC as well, please, take some timetime to test :

* setup a unimarc site
* apply the patch
* look at the redbook, or ask Stéphane for some suggestions
* add default indicator for a field that has one
* check it works in cataloguing and authorities

There's nothing specific about indicators in UNIMARC (except they are not the same as MARC21), so it should work fine.

However, once it's signed-off, please create another bug (ENH) = "define default indicators for UNIMARC like the default ones for MARC21", linked to 4888
Comment 19 Julian Maurice 2011-08-05 10:16:32 UTC
Patch does not apply on master

Apply? [y]es/[n]o/[e]dit/[v]iew patch/[a]ccept all y
Applying: Bug 4888 - pre-set of field indicators value
Using index info to reconstruct a base tree...
<stdin>:319: trailing whitespace.
            
<stdin>:348: trailing whitespace.
            my $query = ($type eq 'auth')?qq|SELECT tagfield,liblibrarian,libopac,mandatory,repeatable 
<stdin>:349: trailing whitespace.
                            FROM auth_tag_structure 
<stdin>:350: trailing whitespace.
                            WHERE authtypecode=? AND tagfield=?|:qq|SELECT tagfield,liblibrarian,libopac,mandatory,repeatable 
<stdin>:351: trailing whitespace.
                            FROM marc_tag_structure 
warning: squelched 20 whitespace errors
warning: 25 lines add whitespace errors.
Falling back to patching base and 3-way merge...
Auto-merging admin/auth_tag_structure.pl
Auto-merging cataloguing/addbiblio.pl
CONFLICT (content): Merge conflict in cataloguing/addbiblio.pl
Auto-merging installer/data/mysql/de-DE/mandatory/sysprefs.sql
CONFLICT (content): Merge conflict in installer/data/mysql/de-DE/mandatory/sysprefs.sql
Auto-merging installer/data/mysql/en/mandatory/sysprefs.sql
CONFLICT (content): Merge conflict in installer/data/mysql/en/mandatory/sysprefs.sql
Auto-merging installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
CONFLICT (content): Merge conflict in installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
Auto-merging installer/data/mysql/it-IT/necessari/sysprefs.sql
CONFLICT (content): Merge conflict in installer/data/mysql/it-IT/necessari/sysprefs.sql
Auto-merging installer/data/mysql/kohastructure.sql
Auto-merging installer/data/mysql/pl-PL/mandatory/sysprefs.sql
CONFLICT (content): Merge conflict in installer/data/mysql/pl-PL/mandatory/sysprefs.sql
Auto-merging installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql
CONFLICT (content): Merge conflict in installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql
Auto-merging installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql
CONFLICT (content): Merge conflict in installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql
Auto-merging installer/data/mysql/updatedatabase.pl
CONFLICT (content): Merge conflict in installer/data/mysql/updatedatabase.pl
Auto-merging koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
CONFLICT (content): Merge conflict in koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt
Failed to merge in the changes.
Patch failed at 0001 Bug 4888 - pre-set of field indicators value
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".
Comment 20 Katrin Fischer 2011-10-07 06:18:17 UTC
Patch needs some work, because now only one syspref.sql file needs to be updated.
Comment 21 Mirko Tietgen 2013-01-24 17:12:05 UTC Comment hidden (obsolete)
Comment 22 Mirko Tietgen 2013-01-24 17:16:47 UTC
I tried to resurrect this patch. I have not tested much yet, but I think there are some problems and it does not seem to give the option to add a default value for indicators automatically (or i have not found it yet).

I don't think I will have time to work much on this, I wanted to put the rebased version up here anyway and invite you to test it.
Comment 23 Mirko Tietgen 2013-01-24 17:29:28 UTC Comment hidden (obsolete)
Comment 24 Mirko Tietgen 2013-01-24 17:34:22 UTC
Looks like i b0rked the authorities part (authorities.tt)
Comment 25 Mirko Tietgen 2013-01-24 17:48:43 UTC Comment hidden (obsolete)
Comment 26 Mirko Tietgen 2013-01-24 17:59:28 UTC
Checking for the right values works in the pop-up window. Entering a "wrong" value directly into the "Add MARC record" view and pressinf 'Save' results not in a waring/message but the error 

Can't call method "fields" on an undefined value at /home/mirko/koha/C4/Biblio.pm line 2527.

(checked in OPAC)
Comment 27 Mirko Tietgen 2013-01-24 19:19:34 UTC
Created attachment 14837 [details] [review]
Bug 4888 - pre-set of field indicators value

Preload on database of the set of field indicators value as defined by
http://www.loc.gov/marc/bibliographic/ecbdhome.html.
New sql files in marc21/mandatory to create and populate the indicators tables with the sets of values for
the Default framework/authtype.
Each framework/authtype will be able to have its own copy to allow individual modification of indicators value.
When editing the framework/authtype exists the possibility of cloning the indicators set from an existing
framework/authtype populated with indicators.

Modification of the intranet administration-Marc Frameworks/Authority MARC Framework to clone on creation from
another framework and to delete set of indicators from a framework.
Management (add/modify/delete) for indicators of the fields in the Framework Structure.

Modification of the intranet cataloguing addbiblio / authorities authorities to enable a plugin to see the
defined indicators value for a specific framework, and to check validity of indicators value.

Two new system preferences: CheckValueIndicators for checking the value of the indicators when cataloguing
a biblio record; DisplayPluginValueIndicators: to enable the plugin at addbiblio to see indicators value and to
check too.

Rebased to master 01/2013

Bug 4888 - rebase follow-up

Fixing errors I made during rebase

Bug 4888 follow-up: rebase errors 2

Another rebase error fixed

Bug 4888 follow-up: fix authorities.tt

Fixed an error in authorities.tt

Bug 4888 follow-up

fixed auth_tag_structure.tt
Comment 28 Owen Leonard 2013-02-10 00:14:30 UTC
I think this really needs a test plan.
Comment 29 Marjorie Barry-Vila 2015-10-15 17:43:45 UTC
(In reply to Mirko Tietgen from comment #27)
> Created attachment 14837 [details] [review] [review]
> Bug 4888 - pre-set of field indicators value
> 
> Preload on database of the set of field indicators value as defined by
> http://www.loc.gov/marc/bibliographic/ecbdhome.html.
> New sql files in marc21/mandatory to create and populate the indicators
> tables with the sets of values for
> the Default framework/authtype.
> Each framework/authtype will be able to have its own copy to allow
> individual modification of indicators value.
> When editing the framework/authtype exists the possibility of cloning the
> indicators set from an existing
> framework/authtype populated with indicators.
> 
> Modification of the intranet administration-Marc Frameworks/Authority MARC
> Framework to clone on creation from
> another framework and to delete set of indicators from a framework.
> Management (add/modify/delete) for indicators of the fields in the Framework
> Structure.
> 
> Modification of the intranet cataloguing addbiblio / authorities authorities
> to enable a plugin to see the
> defined indicators value for a specific framework, and to check validity of
> indicators value.
> 
> Two new system preferences: CheckValueIndicators for checking the value of
> the indicators when cataloguing
> a biblio record; DisplayPluginValueIndicators: to enable the plugin at
> addbiblio to see indicators value and to
> check too.
> 
> Rebased to master 01/2013
> 
> Bug 4888 - rebase follow-up
> 
> Fixing errors I made during rebase
> 
> Bug 4888 follow-up: rebase errors 2
> 
> Another rebase error fixed
> 
> Bug 4888 follow-up: fix authorities.tt
> 
> Fixed an error in authorities.tt
> 
> Bug 4888 follow-up
> 
> fixed auth_tag_structure.tt

Hi,

Do you always work on this patch?

Regards,
Marjorie
Comment 30 Mirko Tietgen 2016-02-13 10:43:08 UTC
(In reply to Marjorie Barry-Vila from comment #29)

> Hi,
> 
> Do you always work on this patch?
> 
> Regards,
> Marjorie

I'm not working on this. AFAIR the patch (written by somebody else) did not do what I was hoping for.
Comment 31 Katrin Fischer 2023-10-02 19:29:12 UTC
I am not sure which bug added it, but we do now have the option to set default values for indicators in the MARC bibliographic framework configuration.