Bug 9192

Summary: UNIMARC_sync_date_created_with_marc_biblio.pl field creation
Product: Koha Reporter: Fridolin Somers <fridolin.somers>
Component: Command-line UtilitiesAssignee: Fridolin Somers <fridolin.somers>
Status: CLOSED FIXED QA Contact: Paul Poulain <paul.poulain>
Severity: normal    
Priority: P5 - low CC: bgkriegel, chris, gmcharlt, jcamins, mathsabypro, mtj, paul.poulain, tomascohen
Version: Main   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8844
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Proposed patch
Bug 9192: UNIMARC_sync_date_created_with_marc_biblio.pl field creation
Bug 9192: UNIMARC_sync_date_created_with_marc_biblio.pl field creation
Proposed patch (follow-up 1)
[SIGNED-OFF] Bug 9192: UNIMARC_sync_date_created_with_marc_biblio.pl field creation (followup)
Bug 9192: followup fix typo
[PASSED QA]Bug 9192: UNIMARC_sync_date_created_with_marc_biblio.pl field creation

Description Fridolin Somers 2012-12-03 13:07:20 UTC
in UNIMARC_sync_date_created_with_marc_biblio.pl, if field does not exist, it is created.
This creation must be different if it is a control field or not.
See http://search.cpan.org/~gmcharlt/MARC-Record-2.0.3/lib/MARC/Field.pm#new%28%29
Comment 1 Fridolin Somers 2012-12-03 13:10:05 UTC Comment hidden (obsolete)
Comment 2 Fridolin Somers 2012-12-03 13:11:17 UTC
8844
Comment 3 Chris Cormack 2012-12-26 21:16:43 UTC Comment hidden (obsolete)
Comment 4 Mason James 2013-01-30 08:25:03 UTC Comment hidden (obsolete)
Comment 5 Mason James 2013-01-30 08:30:27 UTC
(In reply to comment #4)
> Created attachment 14939 [details] [review]
> Bug 9192: UNIMARC_sync_date_created_with_marc_biblio.pl field creation
> 
> Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
> Signed-off-by: Mason James <mtj@kohaaloha.com>

testing 1 commit(s) (applied to f8686e9 'Bug 9116: Remove some useless tmp var')

passing QA.. patch looks good
Comment 6 Jared Camins-Esakov 2013-01-31 21:25:34 UTC
There is a problem with this patch. This patch does not check whether the specified field is a control field or variable field. Instead, to decide which field creation routine to call it checks whether the user has supplied a subfield marker. Please provide a follow-up that either identifies control fields based on the fixed fields defined in the UNIMARC standard (field number < 010, I think) or by using the is_controlfield_tag routine from MARC::Record.
Comment 7 Fridolin Somers 2013-02-14 16:23:43 UTC Comment hidden (obsolete)
Comment 8 Fridolin Somers 2013-02-28 14:26:41 UTC
Is this what you meant Jared ?
Comment 9 Fridolin Somers 2013-04-12 09:51:01 UTC
What must be done to continue ?
Comment 10 Bernardo Gonzalez Kriegel 2013-09-07 22:34:25 UTC Comment hidden (obsolete)
Comment 11 Bernardo Gonzalez Kriegel 2013-09-07 22:42:12 UTC Comment hidden (obsolete)
Comment 12 Katrin Fischer 2013-10-05 22:07:27 UTC
Can I please get a test plan for this?
Comment 13 Fridolin Somers 2013-10-07 14:15:20 UTC
Test plan : 
- Launch UNIMARC_sync_date_created_with_marc_biblio.pl : 
- with -c 512
=> Script dies with message : "date-created-marc field is greated that 009, it should have a subfield."
- with -c 006a
=> Script dies with message : "die "date-created-marc field is lower that 010, it should not have a subfield."
- with -m 512
=> Script dies with message : "date-modified-marc field is greated that 009, it should have a subfield."
- with -m 006a
=> Script dies with message : "die "date-modified-marc field is lower that 010, it should not have a subfield."
Comment 14 Paul Poulain 2013-10-21 18:50:33 UTC
QA Comment :
 * UNIMARC specific
 * no visible side effect, maintenance script
 * passes koha-qa.pl
 * tested by a French & an Argentina librarian, 2 different UNIMARC libraries

passed QA
Comment 15 Paul Poulain 2013-10-21 18:52:00 UTC
Created attachment 22173 [details] [review]
[PASSED QA]Bug 9192: UNIMARC_sync_date_created_with_marc_biblio.pl field creation

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Mason James <mtj@kohaaloha.com>

Bug 9192: UNIMARC_sync_date_created_with_marc_biblio.pl field creation (followup)

Add tests :
if field < 10 it must not have a subfield
if field > 9 is must have a subfield

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Both patches applied, no koha-qa errors.

Bug 9192: followup fix typo

Fix typo on usage message.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Comment 16 Mathieu Saby 2013-10-23 13:29:18 UTC
It is strange to have a cronjob for doing that in UNIMARC.
Do you know how it is done in MARC21? If it is a better way, maybe we could do a ENH for making unimarc behave the same way as MARC21?

Mathieu
Comment 17 Galen Charlton 2013-10-23 14:29:44 UTC
(In reply to mathieu saby from comment #16)
> It is strange to have a cronjob for doing that in UNIMARC.
> Do you know how it is done in MARC21? If it is a better way, maybe we could
> do a ENH for making unimarc behave the same way as MARC21?

MARC21 users tend to use the 005 field, which per bug 5374 gets updated automatically whenever a bib is saved (it does that for UNIMARC as well, actually).

From my POV, it would be a plausible enhancement to have the UNIMARC date add/modified fields be updated by ModBiblio(Marc).  Is that plausible from the POV of UNIMARC users?
Comment 18 Galen Charlton 2013-10-23 14:30:26 UTC
I've pushed the current patch to master, BTW.  Thanks, Fridolyn!
Comment 19 Mathieu Saby 2013-10-23 14:33:20 UTC
(In reply to Galen Charlton from comment #18)
> I've pushed the current patch to master, BTW.  Thanks, Fridolyn!

(In reply to Galen Charlton from comment #17)
> (In reply to mathieu saby from comment #16)
> > It is strange to have a cronjob for doing that in UNIMARC.
> > Do you know how it is done in MARC21? If it is a better way, maybe we could
> > do a ENH for making unimarc behave the same way as MARC21?
> 
> MARC21 users tend to use the 005 field, which per bug 5374 gets updated
> automatically whenever a bib is saved (it does that for UNIMARC as well,
> actually).
> 
> From my POV, it would be a plausible enhancement to have the UNIMARC date
> add/modified fields be updated by ModBiblio(Marc).  Is that plausible from
> the POV of UNIMARC users?

005 could probably be used in unimarc, as it is made for that ;-)
We tested a long time ago, but I think I remember that the plugin was just updating 005 when some value was already in 005, and not filling it at first when we create the record.
Comment 20 Fridolin Somers 2013-10-24 07:40:57 UTC
(In reply to Galen Charlton from comment #18)
> I've pushed the current patch to master, BTW.  Thanks, Fridolyn!

Thanks a lot.
I know that using this script with cron once a day and not when record is created/modified is to speed up those actions.
It was even more usefull when items where in MARCXML.
Comment 21 Tomás Cohen Arazi (tcohen) 2013-12-05 15:17:04 UTC
This patch has been pushed to 3.12.x, will be in 3.12.8.

Thanks Fridolin!