Bug 4118 - Add Collection Code (CCODE) to Statistics Table
Summary: Add Collection Code (CCODE) to Statistics Table
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: 3.10
Hardware: PC All
: P5 - low enhancement
Assignee: Kyle M Hall
QA Contact: Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-05 01:21 UTC by Kyle M Hall
Modified: 2013-05-23 06:23 UTC (History)
7 users (show)

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


Attachments
Adds code to C4 modules to support ccodes. (3.05 KB, patch)
2010-02-05 16:50 UTC, Chris Cormack
Details | Diff | Splinter Review
Updates the database to support ccodes in stats table (1.38 KB, patch)
2010-02-05 16:50 UTC, Chris Cormack
Details | Diff | Splinter Review
Bugfix 4118 - Add Collection Code to Statistics Table - Updated C4 Modules to add Collection Codes to stats table (3.08 KB, patch)
2012-06-11 09:36 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bugfix 4118 - Add Collection Code to Statistics Table - DB Update (1.51 KB, patch)
2012-06-11 09:40 UTC, Kyle M Hall
Details | Diff | Splinter Review
[SIGNED] Bugfix 4118 - Add Collection Code to Statistics Table - Updated C4 Modules to add Collection Codes to stats table (3.19 KB, patch)
2012-06-11 14:15 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
[SIGNED] Bugfix 4118 - Add Collection Code to Statistics Table - DB Update (1.59 KB, patch)
2012-06-11 14:15 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bugfix 4118 - Add Collection Code to Statistics Table - Fix DB Update (1.44 KB, patch)
2012-07-02 13:04 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bugfix 4118 - Add Collection Code to Statistics Table - Updated C4 Modules to add Collection Codes to stats table (3.14 KB, patch)
2012-07-02 13:04 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bugfix 4118 - Add Collection Code to Statistics Table - DB Update (1.58 KB, patch)
2012-07-02 13:05 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bugfix 4118 - Add Collection Code to Statistics Table - Fix DB Update (1.44 KB, patch)
2012-07-02 13:05 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bugfix 4118 - Add Collection Code to Statistics Table - Fix DB Update (1.50 KB, patch)
2012-07-17 10:42 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 4118 - Add Collection Code to Statistics Table - QA Followup (735 bytes, patch)
2012-08-03 11:28 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 4118 - Add Collection Code to Statistics Table (4.30 KB, patch)
2012-09-12 16:02 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 4118 - Add Collection Code to Statistics Table - Followup (1.87 KB, patch)
2012-09-12 16:11 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 4118: Follow up: Add ccode to kohastructure for stats (1.27 KB, patch)
2012-10-12 15:08 UTC, Nicole C. Engard
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 4118: Follow up: Add ccode to kohastructure for stats (1.36 KB, patch)
2012-10-12 15:09 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Follow up to Bug 8585: add missing word to preference (1.13 KB, patch)
2012-10-12 15:45 UTC, Nicole C. Engard
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Cormack 2010-05-21 01:23:21 UTC


---- Reported by kyle.m.hall@gmail.com 2010-02-05 13:21:57 ----

It would be nice to have the collection code added to the statistics table in addition to itemtype.



---- Additional Comments From kyle.m.hall@gmail.com 2010-02-05 16:50:23 ----

Created an attachment
Adds code to C4 modules to support ccodes.





---- Additional Comments From kyle.m.hall@gmail.com 2010-02-05 16:50:46 ----

Created an attachment
Updates the database to support ccodes in stats table





--- Bug imported by chris@bigballofwax.co.nz 2010-05-21 01:23 UTC  ---

This bug was previously known as _bug_ 4118 at http://bugs.koha.org/cgi-bin/bugzilla3/show_bug.cgi?id=4118
Imported an attachment (id=1848)
Imported an attachment (id=1849)

Actual time not defined. Setting to 0.0
Setting qa contact to the default for this product.
   This bug either had no qa contact or an invalid one.
The original submitter of attachment 1848 [details] [review] is unknown.
   Reassigning to the person who moved it here: chris@bigballofwax.co.nz.
The original submitter of attachment 1849 [details] [review] is unknown.
   Reassigning to the person who moved it here: chris@bigballofwax.co.nz.

Comment 1 Kyle M Hall 2012-06-11 09:36:02 UTC Comment hidden (obsolete)
Comment 2 Kyle M Hall 2012-06-11 09:40:14 UTC Comment hidden (obsolete)
Comment 3 Martin Renvoize (ashimema) 2012-06-11 14:15:13 UTC Comment hidden (obsolete)
Comment 4 Martin Renvoize (ashimema) 2012-06-11 14:15:50 UTC Comment hidden (obsolete)
Comment 5 Martin Renvoize (ashimema) 2012-06-11 14:16:25 UTC
Add data as expected... Signing off.
Comment 6 Ian Walls 2012-06-15 15:55:06 UTC
First patch is okay, just adds ccode to the stats table so you don't have to do a multi-table join to get it from items and deleteditems.

The database update, though, looks a little janky:

ALTER TABLE `statistics` ADD `ccode` VARCHAR( 80 ) NULL ;

should be more like 

ALTER TABLE `statistics` ADD COLUMN `ccode` VARCHAR ( 10 ) AFTER `associatedborrower`

The update message is also inaccurate ("Category code" instead of "collection code")
Comment 7 Kyle M Hall 2012-07-02 13:04:06 UTC Comment hidden (obsolete)
Comment 8 Kyle M Hall 2012-07-02 13:04:39 UTC Comment hidden (obsolete)
Comment 9 Kyle M Hall 2012-07-02 13:05:10 UTC Comment hidden (obsolete)
Comment 10 Kyle M Hall 2012-07-02 13:05:22 UTC Comment hidden (obsolete)
Comment 11 Jonathan Druart 2012-07-17 10:42:30 UTC Comment hidden (obsolete)
Comment 12 Paul Poulain 2012-08-02 11:34:33 UTC
QA comment:

Why do you have 
+
+=item DropAllForeignKeys($table)
+
in 1st patch ?

Other than this, it's OK, and it passes
../qa/koha-qa.pl -c 3

answer my previous question (and remove it if it was not intended) to earn "passed QA"
Comment 13 Kyle M Hall (khall) 2012-08-03 11:24:08 UTC
(In reply to comment #12)
> QA comment:
> 
> Why do you have 
> +
> +=item DropAllForeignKeys($table)
> +
> in 1st patch ?

That was an accident. I'll add another followup to remove it.
Comment 14 Kyle M Hall (khall) 2012-08-03 11:28:02 UTC Comment hidden (obsolete)
Comment 15 Paul Poulain 2012-08-31 15:11:14 UTC
QA comment: I was about to push your patch (after squashing the 2 last follow-up and adding a removal of useless `` in updatedatabase), and, at the end, I won't, because I've found a tiny mistake:

The update says:
UPDATE statistics SET statistics.ccode = ( SELECT items.ccode FROM items WHERE statistics.itemnumber = items.itemnumber )

which seems OK

OTOH you record a ccode only in Circulation.pm, which seems OK (you don't need to record the item ccode when a fine is paid, so nothing changed in C4::Accounts.pm)

BUT: when you pay a fine because of a lost item, the itemnumber field *can* be set.
In this case, you will have an itemnumber, but no ccode. Your updatedatabase will populate ccode anyway.

So, 2 options:
  * populate ccode in Accounts.pm, when there is an item
  * UPDATE by discarding statistics.type='payment' or 'writeoff' (maybe there are other values, not 100% sure)

Please choose and resubmit. I suggest you squash the 4 current patches, and add a follow-up for this QA question
Comment 16 Kyle M Hall (khall) 2012-09-12 16:02:16 UTC Comment hidden (obsolete)
Comment 17 Kyle M Hall (khall) 2012-09-12 16:11:30 UTC Comment hidden (obsolete)
Comment 18 Kyle M Hall (khall) 2012-09-12 16:13:48 UTC
> So, 2 options:
>   * populate ccode in Accounts.pm, when there is an item
>   * UPDATE by discarding statistics.type='payment' or 'writeoff' (maybe
> there are other values, not 100% sure)
> 
> Please choose and resubmit. I suggest you squash the 4 current patches, and
> add a follow-up for this QA question

Since a payment may be for multiple items, I don't think we should add a ccode for payments, so I have chosen the latter option.

I have also squashed the earlier patches per your suggestion.
Comment 19 Paul Poulain 2012-09-13 16:50:36 UTC
Patch pushed to master

My database does not contain ccode, so I could not check that the updatedatabase really worked properly (at least the column is created)

A nice follow-up could be to have the line "collection" not visible on reports/issues_stats.pl is there is nothing in the list. But it's not worth failing QA for that ;-)
Comment 20 Nicole C. Engard 2012-10-12 15:08:00 UTC Comment hidden (obsolete)
Comment 21 Nicole C. Engard 2012-10-12 15:08:40 UTC
follow up needs sign off.
Comment 22 Kyle M Hall (khall) 2012-10-12 15:09:27 UTC
Created attachment 12793 [details] [review]
[SIGNED-OFF] Bug 4118: Follow up: Add ccode to kohastructure for stats

CCode was added to the statistics table in this bug, but
was not added to kohastructure.sql. This patch adds it
with comment to the kohastructure.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 23 Nicole C. Engard 2012-10-12 15:18:32 UTC
Change back to enhancement after pushed, but marked critical right now.
Comment 24 Nicole C. Engard 2012-10-12 15:45:39 UTC Comment hidden (obsolete)
Comment 25 Nicole C. Engard 2012-10-12 15:46:47 UTC
Comment on attachment 12795 [details] [review]
Follow up to Bug 8585: add missing word to preference

Attached to the wrong bug.
Comment 26 Jonathan Druart 2012-10-16 10:29:00 UTC
Add the new field statistics.ccode to kohastructure.
Marked as Passed QA.
Comment 27 Paul Poulain 2012-10-17 16:10:42 UTC
follow-up pushed, (back to ENH)