Bug 11473 - View log template has malformed conditionals, and logging info incorrect/inconsistent/unexpected
Summary: View log template has malformed conditionals, and logging info incorrect/inco...
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Transaction logs (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: David Cook
QA Contact: Jonathan Druart
URL:
Keywords:
Depends on:
Blocks: 10352 11477
  Show dependency treegraph
 
Reported: 2014-01-03 06:01 UTC by David Cook
Modified: 2019-05-13 15:43 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 11473 - Fix log viewer template conditions (6.61 KB, patch)
2014-01-06 04:10 UTC, David Cook
Details | Diff | Splinter Review
Bug 11473 - Remove boilerplate in log viewer template (3.98 KB, patch)
2014-01-06 04:12 UTC, David Cook
Details | Diff | Splinter Review
Bug 11473 - Improve wording in log viewer template (4.14 KB, patch)
2014-01-06 04:12 UTC, David Cook
Details | Diff | Splinter Review
Bug 11473 - add 'biblio' and 'item' to cataloguing logging info (3.90 KB, patch)
2014-01-06 04:13 UTC, David Cook
Details | Diff | Splinter Review
Bug 11473 - Fix log viewer template conditions (6.69 KB, patch)
2014-01-06 08:32 UTC, Chris Cormack
Details | Diff | Splinter Review
Bug 11473 - Remove boilerplate in log viewer template (4.04 KB, patch)
2014-01-06 08:33 UTC, Chris Cormack
Details | Diff | Splinter Review
Bug 11473 - Improve wording in log viewer template (4.19 KB, patch)
2014-01-06 08:33 UTC, Chris Cormack
Details | Diff | Splinter Review
Bug 11473 - add 'biblio' and 'item' to cataloguing logging info (3.95 KB, patch)
2014-01-06 08:33 UTC, Chris Cormack
Details | Diff | Splinter Review
Bug 11473 - Fix log viewer template conditions (6.75 KB, patch)
2014-01-10 15:47 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 11473 - Remove boilerplate in log viewer template (4.10 KB, patch)
2014-01-10 15:47 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 11473 - Improve wording in log viewer template (4.26 KB, patch)
2014-01-10 15:47 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 11473 - add 'biblio' and 'item' to cataloguing logging info (4.02 KB, patch)
2014-01-10 15:47 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description David Cook 2014-01-03 06:01:22 UTC
1) Malformed conditionals

Currently, the majority of "viewlog.tt" is ignored, because we haven't formed the conditionals correctly. 

(e.g. Using 'module' when we should be using 'loopro.module' [or 'loopro.MODULENAME' like 'loopro.CIRCULATION'], 'info' instead of 'loopro.info', etc.)

This means that we always get the raw "loopro.object", which is either a borrowernumber, biblionumber, itemnumber, subscriptionid, or authid, with absolutely no qualifier at all.


*SOLUTION*

Alas, the solution requires a few systematic changes.

Detecting an object as a 'borrowernumber' is easy, since MEMBERS, CIRCULATION, and FINES always use it as its object. Same goes for 'subscriptionid' for SERIALS and 'authid' for AUTHORITIES. For these cases, we just need to fix the variables called in the conditions.

However, unfortunately, CATALOGUING sometimes uses biblionumber and sometimes uses itemnumber as its object. This causes the following problem...


2) Conditions in viewlog.pl and viewlog.tt do not correctly differentiate items and biblios.

There are conditions that check to see if the 'info' column says 'item'. However, this has erratic results, because 'item' is only logged for item adds and deletions - not modifications. (Authorities also only track 'authority' for additions and deletions - not modifications.)

'biblio' is only tracked for biblio additions. Deletions have no info, while modifications include the record content.  


In viewlog.tt, logs without an 'info' of 'item' will be labelled and linked as 'biblio'. That means that all item modifications will be treated as biblios and not items. 

*SOLUTION*
Change logaction to prepend the info column with "biblio" for all biblio transactions and "item" for all item transactions. Then, check for the applicable substring in viewlog.pl and viewlog.tt to determine how to link and label the number.

For legacy data, have a third option that doesn't label/link the object. Just have the raw number (as we currently do).
Comment 1 David Cook 2014-01-06 04:10:49 UTC Comment hidden (obsolete)
Comment 2 David Cook 2014-01-06 04:12:19 UTC Comment hidden (obsolete)
Comment 3 David Cook 2014-01-06 04:12:49 UTC Comment hidden (obsolete)
Comment 4 David Cook 2014-01-06 04:13:20 UTC Comment hidden (obsolete)
Comment 5 Chris Cormack 2014-01-06 08:32:57 UTC Comment hidden (obsolete)
Comment 6 Chris Cormack 2014-01-06 08:33:09 UTC Comment hidden (obsolete)
Comment 7 Chris Cormack 2014-01-06 08:33:24 UTC Comment hidden (obsolete)
Comment 8 Chris Cormack 2014-01-06 08:33:41 UTC Comment hidden (obsolete)
Comment 9 Jonathan Druart 2014-01-10 15:47:06 UTC
QA comment:

It is not perfect but it is far better than it is currently.
2 first patches could be squashed for more visibility.

Marked as Passed QA.
Comment 10 Jonathan Druart 2014-01-10 15:47:34 UTC
Created attachment 24152 [details] [review]
Bug 11473 - Fix log viewer template conditions

This patch adds the 'loopro' key to the 'module' value, so that
conditions are actually triggered in the template logic.

(Note: loopro.CIRCULATION is valid, but I changed it for the sake
of consistency across the different conditions.)

This patch also adds substr checks to the 'info' column when
using the cataloguing module. This will check for 'item' and 'biblio',
so that the appropriate label qualifer can be shown in the log viewer.
If either term is absent, the unqualified number will be shown instead
(this will be the majority of action logs at this point).

_TEST PLAN_

Before applying:

1) Access log viewer from Tools (or wherever really)
2) Look up logs for circulation, patrons, cataloguing, serial,
authorities, etc.
3) Note that the "Object" will always just be a number without qualification.

After applying the patch:

1) Look at those same logs
2) Note that the object number for borrowers will usually be prefaced
by 'member' (notwithstanding FINES which aren't taken into account in
this template yet); new bibs and new items should say 'Item X' or
'Biblio X'. Serials should have a link. Authorities should have a link
and an 'auth' preface.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

Works as advertised

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 11 Jonathan Druart 2014-01-10 15:47:39 UTC
Created attachment 24153 [details] [review]
Bug 11473 - Remove boilerplate in log viewer template

This patch eliminates unnecessary conditions and boilerplate.

_TEST PLAN_

Apply the patch.

1) Try viewing logs for circulation, patrons, fines,
cataloguines, serials, authorities, etc.
2) Note that everything should look exactly the same as before,
with one exception: FINES
3) Fines will now show "member X" for the user associated with
the fine.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 12 Jonathan Druart 2014-01-10 15:47:43 UTC
Created attachment 24154 [details] [review]
Bug 11473 - Improve wording in log viewer template

This patch capitalizes 'member' and 'biblio' as object labels in the
log viewer.

It also adds a "Subscription" label, and changes "auth" to "Authority".

_TEST PLAN_

Before applying patch:

1) View logs for patrons, new biblio, serials, and authorities.

Apply the patch:

1) Notice the capitalization and new/modified labels.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 13 Jonathan Druart 2014-01-10 15:47:48 UTC
Created attachment 24155 [details] [review]
Bug 11473 - add 'biblio' and 'item' to cataloguing logging info

This patch adds the words 'biblio' and 'item' to the 'info'
of the cataloguing logs which were missing them (such as biblio
delete, biblio mod, item mod, upload cover image).

This patch also adds 'authority' for authority mod.

_TEST PLAN_

Before applying:
1) Create/view mods for items, biblios, and authorities.
2) Create/view biblio deletion
3) Create/view upload cover image log
4) Note that none of these contain the words 'biblio','item',or
'authority' in their "Info" columns.

Apply patch.

5) Repeat steps 1-3
6) Note that the new logs contain 'biblio','item', and 'authority'
in their "Info" column, while the past ones don't.
7) Note also that 'biblio' and 'item' will have 'Biblio' and 'Item'
appear in their "Object" column for the new logs

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 14 Galen Charlton 2014-01-17 06:07:44 UTC
Pushed to master, along with a follow-up that repairs links to the item from item modification log entries.

Thanks, David!
Comment 15 Fridolin Somers 2014-03-25 11:02:47 UTC
Patches pushed to 3.14.x, will be in 3.14.5