[Koha-bugs] [Bug 21173] Run auto item modifications by age every hour and set the item age unit to hours

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Oct 4 06:55:15 CEST 2018


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21173

--- Comment #13 from Alex Buckley <alexbuckley at catalyst.net.nz> ---
Created attachment 79914
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=79914&action=edit
Bug 21173: Fixed rebase removal of filters and changed items.dateaccessioned to
datetime datatype

This means we can make the auto item modification tool work for hours since
item was created

Updated test plan:

1. Go to Tools->Automatic item modifications by age and create a new
rule by selecting the 'Edit rules' button

2. Notice you can only set the age in the unit of days not
hours. Also although not visible in the interface the rule will
calculate the age of the item based on when it was created (i.e. added to
Koha).

3. Apply patch and run ./updatedatabase.pl in the
koha-shell

4. Now revisit Tools->Automatic item modifications by age. Notice the
table of existing rules now contains a new column 'Age starting point'
this is the date from which the item age is calculated. This enhancement
offers you two options as the age starting point: Created (displayed in
this table as 'itemcreated') or Last altered (displayed in this table as
'itemaltered').

5. Click 'Edit rules' to create a new rule. Notice in the form
for creating the new rule you can set the unit to either
'Hours' or 'Days'.

6. In the new rule set the following values: Age: 1, Unit: Hours,
condition items.location = 'CART', items.location = ''

7.  Now save the rule and confirm the correct values are
dispayed in the rules table which is loaded

8. Click 'Edit rules' button again.

9. Modify the rule you just created changing Age to
2 and create another new rule with the following
values: Age='1', Unit='Hour', 'Age starting
point'='Created', Condition 'items.homebranch'='<a
branchcode of a branch in your Koha instance>',
substituions 'items.homebranch'='<another
branchcode in your Koha instance>'

10. Now click 'Save' and confirm the data displayed for both rules is
correct.

11. Create two new items and set their location field
to 'CART'. Then in the database set their dateaccessioned value to 2 hours
before the
current time

12. Exit out of the database terminal and manually run
the automatic_item_modification_by_age.pl cronjob from
the koha-shell with this command:
./automatic_item_modification_by_age.pl --confirm

13. Now return to the database and notice the two items you set have
a location of 'CART' now have a blank location field because the
manually run cronjob altered them as they meet the conditions of the
rule.

14. Repeat step 11 but this time change the rule in the Auto item modification
tool interface to 'Age starting point='Altered'' so we can test the auto item
mod tool on items that have been last altered more than 2 hours ago.

15. Enter this text into your /etc/cron.d/koha-common file:
*/2  * * * * root koha-foreach --enabled
/usr/share/koha/bin/cronjobs/automatic_item_modification_by_age.pl
--confirm

This will make the cronjob run every 2 minutes.

16. Now restart koha-common with this command: sudo
/etc/init.d/koha-common restart

17. Now wait for more than 2 minutes and check the
database again and notice that the two items have blank location fields
as the automatically running cronjob altered the items.

18. Repeat steps 9-17 with the new rules in the auto item modification
tool for the following rule conditions:

New rule:
    Age: 2
    Age starting point: Created
    Units: Days
    Condition 'items.homebranch'='<a branchcode of a branch in your Koha
instance>',
    Substitutions 'items.homebranch'='<another branchcode in your Koha
instance>'

New rule:
    Age: 2
    Age starting point: Altered
    Units: Days
    Condition 'items.homebranch'='<a branchcode of a branch in your Koha
instance>',
    Substitutions 'items.homebranch'='<another branchcode in your Koha
instance>'

Sponsored-By: Toi Ohomai Institute of Technology, New Zealand

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list