Koha/C4
Alex Buckley bed1646444 Bug 22827: Add age dependency on other fields than dateaccessioned
A new agefield has been added to the 'Automatic item modifications by
age' tool. The options for the agefield are: replacementpricedate, datelastborrowed,
datelastseen, damaged_on, itemlost_on, withdrawn_on

If no option is selected then Koha will default to saving 'agefield' =
items.dateaccessioned

Similarly, if a Koha instance has an old item rule without 'agefield'
defined then Koha will default to using 'items.dateaccessioned'.
This is confirmed by the AutomaticItemModificationByAge.t unit test.

Test plan:

1. Go to: Tools > Catalog > Automatic item modifications by age
2. Observe there is a new 'Age field' dropdown in the rule form.
3. Create a rule, set the values:
- 'Age in days' = 20
- Leave 'Age field' = 'Choose an age field'
- 'Substitutions': 'items.barcode' = 'test'
- Save the rule
4. Confirm the 'List of rules' page displays 'items.dateaccessioned in the 'Age field' column
5. Add another rule:
- 'Age in days' = 2
- 'Age field' = 'items.datelastseen'
- 'Substitutions': 'items.barcode' = 'test2'
- Save the rule
6. Confirm the 'List of rules' page displays 'items.datelastseen' in
the 'Age field' column for that second rule
7. Add some more rules and confirm you can delete them
8. Edit a record:
- Make the items.dateaccessioned = 3 day ago (so rule 1 is false)
- Make the items.datelastseen = 3 days ago (so rule 2 is true)
9. Run the automatic_items_modification_by_age.pl:
- sudo koha-shell <instance>
- cd misc/cronjobs
- ./automatic_item_modification_by_age.pl -v -c
10. Confirm the item has it's barcode set to 'test2'
11. Run unit tests:
- sudo koha-shell <instance>
- prove t/db_dependent/Items/AutomaticItemModificationByAge.t -v

Sponsored-By: Catalyst IT

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-04-08 15:49:16 +02:00
..
AuthoritiesMarc Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Barcodes Bug 26328: Cast barcode from varchar to integer for incremental barcode 2022-03-23 10:50:51 -10:00
ClassSortRoutine Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
ClassSplitRoutine Bug 28572: Remove C4::Debug 2021-06-22 12:04:32 +02:00
Creators Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
External Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Form Bug 28572: Remove C4::Debug 2021-06-22 12:04:32 +02:00
Heading Bug 26852: subfield $e missing in X11 definition of MARC21 headings 2021-08-11 13:27:52 +02:00
ILSDI Bug 29844: Fix ->search occurrences 2022-02-09 15:36:23 -10:00
Installer Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Labels Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Linker Bug 28676: Cache and retrieve match_count when searching a cached heading 2021-09-20 12:06:56 +02:00
Members Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
OAI Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Output Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Patroncards Bug 25459: Makes barcode position respect units in patron cards layout 2021-11-02 16:50:01 +01:00
Reports Bug 26669: Adjust POD 2022-04-04 16:23:46 +02:00
Search Bug 29915: Tiny session adjustments 2022-03-22 10:17:33 -10:00
Serials Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
SIP Bug 29385: Catch register_id for payments against fees 2022-02-16 11:51:10 -10:00
Utils Bug 30063: Remove occurrences of C4::Utils::DataTables::Members 2022-04-04 09:47:01 +02:00
Accounts.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Acquisition.pm Bug 29844: Fix ->search occurrences 2022-02-09 15:36:23 -10:00
Auth.pm Bug 29609: Centralized code to build the link to a biblio detail page 2022-04-08 15:49:16 +02:00
Auth_cas_servers.yaml.sample Bug 17065 - Rename C4/Auth_cas_servers.yaml.orig 2016-08-08 13:16:36 +00:00
Auth_with_cas.pm Bug 28417: Don't require C4::Auth_with_cas from opac-user if not needed 2021-11-03 15:40:52 +01:00
Auth_with_ldap.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Auth_with_shibboleth.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
AuthoritiesMarc.pm Bug 27173: Add plugin hooks for authority record changes 2021-11-03 15:40:52 +01:00
BackgroundJob.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Barcodes.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Biblio.pm Bug 29486: _koha_marc_update_bib_ids no longer needed for GetMarcBiblio 2022-03-22 10:17:34 -10:00
Breeding.pm Bug 29391: Improve output of reservoir search 2022-01-09 21:04:17 -10:00
Budgets.pm Bug 24190: (follow-up) Rename AcqLog 2021-09-21 20:22:57 +02:00
Calendar.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Charset.pm Bug 18984: Remove NORMARC support 2021-10-07 15:36:40 +02:00
Circulation.pm Bug 30114: Koha offline circulation will always cancel the next hold when issuing item to a patron 2022-04-04 16:23:45 +02:00
ClassSortRoutine.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
ClassSource.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
ClassSplitRoutine.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Context.pm Bug 28306: Allow to query database with minimal memory footprint 2021-08-31 10:27:52 +02:00
Contract.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
CourseReserves.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Creators.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Heading.pm Bug 25616: Uppercase hard coded lower case boolean operators for Elasticsearch 2022-02-24 14:35:36 -10:00
HoldsQueue.pm Bug 29844: Fix ->search occurrences 2022-02-09 15:36:23 -10:00
HTML5Media.pm Bug 18984: Remove NORMARC support 2021-10-07 15:36:40 +02:00
ImportBatch.pm Bug 30402: Import authorities subroutines to ImportBatch script 2022-04-08 15:49:15 +02:00
ImportExportFramework.pm Bug 13952: (follow-up) JS translatability, clean warns, other 2022-04-04 16:23:46 +02:00
InstallAuth.pm Bug 19532: Database and installer stuff 2022-03-14 22:45:50 -10:00
Installer.pm Bug 26326: (follow-up) Add ability to check for existence of any primary key 2021-11-03 15:40:52 +01:00
ItemCirculationAlertPreference.pm Bug 29844: Fix ->search occurrences 2022-02-09 15:36:23 -10:00
Items.pm Bug 22827: Add age dependency on other fields than dateaccessioned 2022-04-08 15:49:16 +02:00
Koha.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Labels.pm Bug 21395: Make perlcritic happy 2020-06-29 12:37:02 +02:00
Languages.pm Bug 15067: Follow up to fix sorting 2021-08-04 14:06:43 +02:00
Letters.pm Bug 17648: ACCTDETAILS notice does not show in notices.pl 2022-03-17 11:22:56 -10:00
Linker.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Log.pm Bug 28692: (QA follow-up) Fix test for objects 2021-11-16 14:00:20 +01:00
MarcModificationTemplates.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Matcher.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Members.pm Bug 29844: Fix ->search occurrences 2022-02-09 15:36:23 -10:00
Message.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Output.pm Bug 30115: Uninitialized value warning in C4/Output.pm 2022-02-21 15:15:47 -10:00
Overdues.pm Bug 19532: (QA follow-up) Simplify resultset accessors 2022-03-14 22:45:52 -10:00
Patroncards.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Record.pm Bug 18984: Remove NORMARC support 2021-10-07 15:36:40 +02:00
Reports.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Reserves.pm Bug 29517: Check if agerestriction field is mapped before fetching biblio 2022-04-04 16:23:45 +02:00
Ris.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
RotatingCollections.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Scheduler.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Scrubber.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Search.pm Bug 30244: Include lost items in list of hidden items 2022-03-25 11:01:04 -10:00
Serials.pm Bug 30035: Fix month name in prediction pattern 2022-03-01 22:47:47 -10:00
Service.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
ShelfBrowser.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
SMS.pm Bug 27673: Replace YAML with YAML::XS 2021-02-16 14:54:50 +01:00
SocialData.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Stats.pm Bug 19532: Recalls objects and tests 2022-03-14 22:45:51 -10:00
Suggestions.pm Bug 28855: Purging suggestions test should not be on timestamp 2021-12-15 12:14:47 -10:00
Tags.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Templates.pm Bug 29791: (follow-up) Add missing comma in previous line 2022-03-24 14:22:10 -10:00
TmplToken.pm
TmplTokenType.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
TTParser.pm Bug 26673: Remove #!/usr/bin/env perl from .pm modules too 2020-10-26 00:14:42 +01:00
UsageStats.pm Bug 5229: Remove system preference 'OPACItemsResultsDisplay' 2021-11-19 15:23:27 +01:00
XISBN.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
XSLT.pm Bug 19532: (RM follow-up) More use of system preference 2022-03-14 23:11:12 -10:00