Commit Graph

81 Commits

Author SHA1 Message Date
Martin Renvoize e6091dc13e
Bug 42766: Add logscriptaction() to C4::Log
Adds a logscriptaction() function parallel to cronlogaction() that logs
to the SCRIPTS action-log module rather than CRONJOBS, gated behind the
new ScriptLog system preference. Exported from C4::Log alongside the
existing cronlogaction().

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
2026-08-04 10:20:49 +00:00
Nick Clemens 2d73f3eb42
Bug 42714: (QA follow-up) Add comment with Perl doc for bash
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
2026-07-28 14:32:40 +00:00
Martin Renvoize 1652191b7f
Bug 42714: (QA follow-up) Use \$0 instead of caller() in cronlogaction
caller(1) was introduced to skip past Koha/Script.pm when cronlogaction
is called from the INIT/END blocks, but it breaks any direct caller that
invokes cronlogaction from within a Try::Tiny try/catch closure or a
callback sub - in those contexts caller(1) resolves to Try/Tiny.pm (or
the calling module) rather than the script itself.

\$0 is always the path of the running script regardless of call depth,
INIT/END phase, or enclosing closure, making it the correct choice here.

Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
2026-07-28 14:32:37 +00:00
Nick Clemens 8f5c0abd09
Bug 42714: Adjust cronlogaction to use caller(1)
Since we are calling from within another module we need more caller information to
log the correct script

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
2026-07-28 14:32:35 +00:00
Martin Renvoize 55e2810aac
Bug 42032: (follow-up) Write state JSON to AUTHORITIES info column
Mirrors bug 42188's biblio info-column convention. Generalise the
CATALOGUING-only info-column rewrite branch in C4::Log::logaction to
cover AUTHORITIES as well, using a module-aware prefix map so each
module gets its own prefix ("biblio" / "authority"). For AUTHORITIES
this means MODIFY now stores "authority {pre-change JSON}" and DELETE
stores "authority {final-state JSON}", while ADD stays bare
"authority" (the call site passes the string directly and ADD is
guarded anyway). The biblio behaviour is preserved bit-for-bit.

Test plan:
1. prove t/db_dependent/AuthoritiesMarc.t
2. Enable AuthoritiesLog. Create / modify / delete an authority via
   the staff UI, then check action_logs:
   - ADD    row's info column reads just "authority"
   - MODIFY row's info column reads "authority { ... pre-change JSON ... }"
   - DELETE row's info column reads "authority { ... final-state JSON ... }"
3. prove t/db_dependent/Koha/Biblio.t
4. prove t/db_dependent/Log.t

Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-05-05 13:42:05 -06:00
Martin Renvoize 4ec43ac10d
Bug 42188: (follow-up) Skip JSON payload in info column on ADD
The info column for CATALOGUING action logs is, by convention, the
record state before modification -- MODIFY writes the pre-change JSON
payload, DELETE writes the state at time of deletion, but ADD has no
pre-change state. Writing the new record state into info on ADD
duplicates the state that the subsequent MODIFY (if any) captures as
its "before" snapshot, and conflicts with that convention.

Skip the JSON payload on ADD so info degrades to the bare "biblio"
prefix. The diff column already captures the full creation (every
field "added" against an empty hashref), so no information is lost.

Test plan:
1. prove t/db_dependent/Koha/Biblio.t
2. Observe that the "CataloguingLog MARC-in-JSON diff tests" subtest
   now also asserts:
   - ADD info == "biblio"
   - MODIFY info matches /^biblio \{/
   - DELETE info matches /^biblio \{/
3. Create / modify / delete a record via the staff UI with
   CataloguingLog on, then check action_logs: the ADD row's info
   column should read just "biblio".

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-05-05 13:42:02 -06:00
Martin Renvoize 1846433ffb
Bug 42188: Use to_json for biblio action log info column
Replace Dumper with to_json for the biblio info column in logaction,
fixing UTF-8 encoding and extending coverage to ADD and DELETE actions
which previously logged only the literal string "biblio".

All three actions (ADD, MODIFY, DELETE) now log "biblio " followed by
a pretty-printed JSON representation of the relevant state: pre-change
for MODIFY, new state for ADD, and deleted state for DELETE.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-05-05 13:42:01 -06:00
Martin Renvoize d095599447
Bug 42030: (follow-up) Don't diff undefined fields
This patch updates the diff for ADD/CREATE and DELETE logactions to
exclude undefined fields from the diff.

Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-05-01 11:04:23 -06:00
Martin Renvoize 863b68b135
Bug 40136: (RM follow-up) Fix logaction to JSON-encode plain hashref infos
Commit 55689d41ba changed Koha::Patron::extended_attributes() and
add_extended_attribute() to pass plain hashrefs to logaction() and
updated tests to expect JSON in the info column. However, logaction()
still had a code path that converted any non-CATALOGUING hashref $infos
to a Dumper() string before the encode_json() at line 151 could fire,
so JSON was never stored and the tests failed.

Remove the catch-all Dumper branch; non-CATALOGUING hashref inputs now
fall through to the existing encode_json() call. The CATALOGUING/MODIFY
biblio-Dumper special case is preserved.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-23 11:05:59 +01:00
Martin Renvoize f4db130ad4
Bug 40136: (follow-up) Unify patron log entries when attributes change with patron data
Three issues were reported with patron action logging:

1. CREATE followed by extended_attributes() produced two log entries
   (CREATE for patron fields + MODIFY for attributes) instead of one.
2. MODIFY that changed both regular fields and patron attributes produced
   two separate MODIFY entries instead of one unified entry.
3. DELETE log did not include the patron's extended attribute values.

Fix:
- logaction() now explicitly returns the stored Koha::ActionLog object so
  callers can capture the action_id.
- Koha::Patron::store() saves the action_id of the CREATE or MODIFY log it
  writes into $self->{_patron_log_id}.
- Koha::Patron::extended_attributes() setter checks for _patron_log_id. If
  set, it calls _merge_attribute_log() to fold the attribute changes into
  the existing log entry (updating its info and diff JSON) instead of
  creating a new MODIFY entry. This covers both the CREATE and MODIFY cases.
- Koha::Patron::delete() now iterates extended_attributes before deletion
  and adds attribute.CODE keys to the patron_data snapshot, so the DELETE
  diff includes the removed attributes.
- New private helper _merge_attribute_log() decodes an existing action log
  entry's info/diff JSON, merges in the attribute change data using
  Struct::Diff, and saves the updated entry.
- Tests added to t/db_dependent/Koha/Patrons.t covering all three scenarios.

Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-23 10:46:22 +01:00
Hammat Wele 553a18da09
Bug 20956: BorrowersLog is not logging permission changes
Changes to permissions are not logged in the Koha action_logs, making it impossible to trace changes to staff permissions. This patch ensures that all changes to permissions are logged.

Test plan:

    1. Go to a staff interface
    2. Search for a patron and change their permissions (note their borrowernumber)
    3. Go to tools/Log viewer
    4. Filter by Module = Patrons, Object = <borrowernumber>.
    5. Click on submit
       ==> No permission changes are logged.
    6. Apply the patch
    7. Repeat step 1, 2, 3, 4, 5
       ==> Permission changes are now logged
    8. Check that the diff column contains the change:
       select diff from action_logs where object= <borrowernumber> order by action_id desc limit 1;

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-23 10:41:51 +01:00
Martin Renvoize ef7dde45f7
Bug 40135: Fix info column prefix for biblio MODIFY logs
The MODIFY path in logaction received the updated biblio as a plain
hashref (not a Koha::Object), so the info column was populated with
raw Dumper output instead of the expected "biblio ..." prefix.

This broke two things: the 'Modification Log' link from the bib record
sidebar (which filters on info LIKE 'biblio%'), and the Object column
in the log viewer (which detects biblio entries via info.substr(0,6)).

Following the same pattern as the Koha::Item MODIFY special case, add
a parallel branch for CATALOGUING MODIFY with a hashref \$infos that
sets the info column to "biblio " . Dumper(\$original). This restores
backward-compatible detection while keeping the diff column correctly
populated from the before/after hashrefs (including _marc changes).

Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-23 10:41:41 +01:00
Martin Renvoize f8f653f71e
Bug 40135: Include MARC field changes in CATALOGUING diff logs
The previous commit populated the diff column for biblio ADD/MODIFY/DELETE
logs with changes to biblio table columns (title, author, frameworkcode,
etc.), but lost the MARC-level change tracking that previously stored a
pre-change MARC dump in the info column.

This follow-up extends the diff to also capture MARC field changes by
including a synthetic _marc key in the before/after hashrefs passed to
logaction. MARC fields are represented as tag => array-of-formatted-strings
(e.g. "10 $a Title" for data fields, scalar for control fields), allowing
Struct::Diff to produce readable field-level diffs.

The _marc entries appear alongside biblio column changes in the existing
diff table in the log viewer, using dotted keys like _marc.245.0.

A helper _marc_record_to_diffable() converts a MARC::Record to this
diffable hashref. All three functions (AddBiblio, ModBiblio, DelBiblio)
use record_strip_nonxml (wrapped in eval) to safely capture the MARC even
for records with invalid XML characters, without producing warnings or
affecting the success of the main operation.

C4/Log.pm is also updated to Dumper() a plain hashref passed as $infos,
so the info column contains useful data rather than a stringified ref.

Tests are extended to verify that the diff column is populated and that
_marc changes are captured when MARC content actually changes.

Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
2026-03-23 10:41:38 +01:00
Tomas Cohen Arazi 1873d97c07
Bug 40163: Fix several http addresses in the code docs
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2025-09-23 16:21:29 -06:00
Jonathan Druart 1d844a7d2f
Bug 39325: Automatic fix
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-04-28 18:51:22 +02:00
Kyle M Hall a6a77c89cd
Bug 37944: Log object delete as JSON diff, implement for items
We should store deleted objects as diffs just as we do for modification and item created.
This enhancement will store modification diffs if the action is set to DELETE, and an "original" object is passed in.

Test Plan:
1) Enable CataloguingLog
2) Deletee an item
3) Query the database for the newest action log:
   select * from action_logs order by action_id desc limit 1\G
4) Note the diff column is NULL
5) Apply this patch
6) Restart all the things!
7) Delete another item
8) Query the database again
9) Note the diff has been created!

Signed-off-by: Sukhmandeep Benipal <sukhmandeep.benipal@inLibro.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-10-30 11:57:25 +01:00
Kyle M Hall 27d3b1cf81
Bug 37943: Log object create as JSON diff, implement for items
We should store newly created objects as diffs just as we do for modifications.
This enhancement will store modification diffs if the action is set to ADD or CREATE and an "original" object is passed in.

Test Plan:
1) Enable CataloguingLog
2) Create an item
3) Query the database for the newest action log:
   select * from action_logs order by action_id desc limit 1\G
4) Note the diff column is NULL
5) Apply this patch
6) Restart all the things!
7) Create another item
8) Query the database again
9) Note the diff has been created!

Signed-off-by: Sukhmandeep Benipal <sukhmandeep.benipal@inLibro.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-10-30 11:57:24 +01:00
Janusz Kaczmarek ca6853cf28
Bug 37522: Logging item modification should record the original version of the item
When modifying bibliographic record, Koha records in the log the
original version of the record.  This allows one to see what has been
changed in the record.

However, in case of item modification Koha records in the log the the
current version of the item (i.e. the version after the edit).  This is
inconsistent with the biblio modification behavior and makes it
difficult or even impossible to trace changes (especially in case of the
first modif since the initial version is not being recorded).

This patch makes the item modification logging feature work similarly to
logging modifications in bibliographic records.

Test plan:
==========
1. With CataloguingLog enabled (default in ktd) make a modification of
   an item.
2. Check the Modification log.  You should see as the recorded version
   the version of the item after the modification.
3. Apply the patch; restart_all.
4. Repeat p. 1.
5. In the Modification log you should see now the version of the item
   that existed before the recent modification.

Sponsored-by: Ignatianum University in Cracow
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-10-29 16:14:44 +01:00
Martin Renvoize 781dd75a5d
Bug 25159: (QA follow-up) Tidy changes
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-05-02 16:47:44 +02:00
Kyle M Hall 47211deee1
Bug 25159: (QA follow-up) Allow passing of 'original' as hashref or Koha::Object
Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-05-02 16:47:43 +02:00
Kyle M Hall 97c2110fa6
Bug 25159: Add ability to specify a pre-modified version of action log data and store as diff
Test Plan:
1) sudo cpanm Struct::Diff
2) prove t/db_dependent/Log.t

Signed-off-by: Kyle Hall <kyle@bywatersolutions.com>
Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-05-02 16:47:42 +02:00
Marcel de Rooy 557c09b466
Bug 32057: (QA follow-up) Remove pretty flag
Not needed for storage. You can always display pretty in the
interface (on a follow-up report).

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-14 08:49:34 -03:00
Kyle Hall cf1a43e2a1
Bug 32057: Replace insert query with use of Koha::ActionLogs
Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-14 08:49:33 -03:00
Kyle Hall 1942dbe881
Bug 32057: Add optional stack trace to action logs
It can be useful to know where in Koha a particular logged action was generated from, and how. We should add the ability to attach a syspref controlled basic stack trace with the caller depth controlled via the syspref. We can the call caller() until the specified depth has been reached.

Test Plan:
1) Apply this patch
2) Run updatedatabase.pl
4) Restart all the things!
5) Set the new syspref ActionLogsTraceDepth to a number ( e.g. 3 )
6) Update a syspref or trigger another enabled log action
7) Query the database: SELECT * FROM action_logs WHERE trace IS NOT NULL
8) Note the stack trace was created!

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-14 08:49:32 -03:00
Nick Clemens 7749e73526
Bug 31203: Add End action to cronjobs and log viewer
Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-05 16:12:55 -03:00
Nick Clemens df69e14057
Bug 31203: Alter cronlogaction to take a hash
This patch simply changes the routine to expect a hashref for info
and to log the PID as object in action logs

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-05 16:12:46 -03:00
Marcel de Rooy b3a0d75a40
Bug 30984: (QA follow-up) Ternary formatting style
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-08-01 09:21:38 -03:00
Kyle Hall 18fd0c89cf
Bug 30984: Action logs should log the cronjob script name that generated the given log
When something is changed by a cronjob, and that entity is logged via action logs, we can know what changed, and that it was via a cronjob, but we cannot necessarily know which cronjob made that change. The closest we can come is to find the action logs for the cronjob module which ran before the change which is by no means reliable assuming the CronLog is even enabled.

We should add a new column to action logs to store the name of the script ran for any action logs where the interface is "cron".

Test plan:
1) Apply this patch
2) Run updatedatabase.pl
3) Enable all the Log/Logging sysprefs
4) Run some cronjobs that will generate action logs
5) Note the new action_logs column "script" contains the filename of the
   cronjob that caused the change.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-08-01 09:21:38 -03:00
Marcel de Rooy 6abe27e7b8 Bug 28692: (QA follow-up) Fix test for objects
Fix the bug where object is first stringified and then tested for
being a Koha::Item.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-11-16 14:00:20 +01:00
Marcel de Rooy 2d528efc69 Bug 28692: (QA follow-up) Sort hash keys of unblessed
Trivial add. Reads much better. And might help future diffs.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-11-16 14:00:20 +01:00
Marcel de Rooy 53c56bc3dc Bug 28692: (QA follow-up) Add module
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-11-16 14:00:20 +01:00
Jonathan Druart de99b016d8 Bug 28692: Get from storage before log actions
To make sure we have logging the values from DB.
It will reduce DB action_log table size when we log the full object and
it contains DateTime object.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-11-16 14:00:20 +01:00
Jonathan Druart 9d6d641d1f Bug 17600: Standardize our EXPORT_OK
On bug 17591 we discovered that there was something weird going on with
the way we export and use subroutines/modules.
This patch tries to standardize our EXPORT to use EXPORT_OK only.

That way we will need to explicitely define the subroutine we want to
use from a module.

This patch is a squashed version of:
Bug 17600: After export.pl
Bug 17600: After perlimport
Bug 17600: Manual changes
Bug 17600: Other manual changes after second perlimports run
Bug 17600: Fix tests

And a lot of other manual changes.

export.pl is a dirty script that can be found on bug 17600.

"perlimport" is:
git clone https://github.com/oalders/App-perlimports.git
cd App-perlimports/
cpanm --installdeps .
export PERL5LIB="$PERL5LIB:/kohadevbox/koha/App-perlimports/lib"
find . \( -name "*.pl" -o -name "*.pm" \) -exec perl App-perlimports/script/perlimports --inplace-edit --no-preserve-unused --filename {} \;

The ideas of this patch are to:
* use EXPORT_OK instead of EXPORT
* perltidy the EXPORT_OK list
* remove '&' before the subroutine names
* remove some uneeded use statements
* explicitely import the subroutines we need within the controllers or
modules

Note that the private subroutines (starting with _) should not be
exported (and not used from outside of the module except from tests).

EXPORT vs EXPORT_OK (from
https://www.thegeekstuff.com/2010/06/perl-exporter-examples/)
"""
Export allows to export the functions and variables of modules to user’s namespace using the standard import method. This way, we don’t need to create the objects for the modules to access it’s members.

@EXPORT and @EXPORT_OK are the two main variables used during export operation.

@EXPORT contains list of symbols (subroutines and variables) of the module to be exported into the caller namespace.

@EXPORT_OK does export of symbols on demand basis.
"""

If this patch caused a conflict with a patch you wrote prior to its
push:
* Make sure you are not reintroducing a "use" statement that has been
removed
* "$subroutine" is not exported by the C4::$MODULE module
means that you need to add the subroutine to the @EXPORT_OK list
* Bareword "$subroutine" not allowed while "strict subs"
means that you didn't imported the subroutine from the module:
  - use $MODULE qw( $subroutine list );
You can also use the fully qualified namespace: C4::$MODULE::$subroutine

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-07-16 08:58:47 +02:00
Jonathan Druart 807147fb7b Bug 23632: Remove C4::Logs::GetLogs
Koha::ActionLogs->search must be used instead.
There is no call to this subroutine in our code, it should be removed.

Test plan:
Make sure the 3 test files still return green and that there is no more
occurrences of GetLogs in the codebase.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-08-18 15:45:48 +02:00
Marcel de Rooy 467dbcc609
Bug 21190: Add interfaces parameter to POD in C4::Logs
Just fixing documentation along the way.
No test plan, just read the patch.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jon Knight <J.P.Knight@lboro.ac.uk>
Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-04-14 16:13:38 +01:00
Marcel de Rooy eb970752b4
Bug 23896: logaction should pass the correct interface to Koha::Logger
Trivial fix.

Test plan:
Run t/db../Log.t to ensure that we did not break stuff.
If you set opac to debug in log4perl config, inspect opac-error.log to see
if you have extra loglines from running the test script.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-30 10:53:56 +00:00
Martin Renvoize 9ec4d86636 Bug 22600: Add 'interface' to accountlines
This patch adds the 'interface' field to the accountlines table and
updates all Koha::Object routines and calls to use it.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-04-10 19:43:11 +00:00
Josef Moravec 472c576513 Bug 22003: Remove unused subroutines displaylog and GetLogStatus from C4::Log
These two routines are not used

Test plan:
0) Apply the patch
1) git grep GetLogStatus should return no occurence
2) git grep displaylog should return no occurence
3) prove t/Log.t should return green

Signed-off-by: Pierre-Marc Thibault <pierre-marc.thibault@inLibro.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-01-11 12:20:49 +00:00
Marcel de Rooy 7f7a6879b2 Bug 19528: Fix a few typos like corrosponding
[1] Replace corrosponding => corresponding
[2] Replace containts => contains
[3] Replace item_level-itypes => item-level_itypes
[4] Replace Managment => Management
[5] Replace should returns => should return

Test plan:
Note that this patch only deals with POD lines or test descriptions.
So there is nothing to test, just read the patch.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Patch amended by RM: The release notes should not be modified

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-10-27 14:09:04 -03:00
Tomas Cohen Arazi d1eb706153 Bug 14642: Add logging for Holds
This patch adds logging for several holds actions. Specifically for:

- CREATE
- CANCEL
- DELETE
- RESUME
- SUSPEND
- MODIFY

To test:
- Enable the HoldsLog syspref
- Add a hold on a record/item
=> SUCCESS: The log view shows the CREATE action
- Click on the <Suspend> button
=> SUCCESS: The log view shows the SUSPEND action
- Click on the <Unsuspend> button
=> SUCCESS: The log view shows the RESUME action
- Click on the red cross, to delete the hold
=> SUCCESS: The log view shows the CANCEL action

Note: The DELETE action is logged when DelMember is called, with bug 16819 patches applied.

Sponsored-by: NEKLS
Signed-off-by: Liz Rea <liz@catalyst.net.nz>
I also wonder about this going in defaulted on, but since the other logs are as well it seems ok to me.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2016-08-17 18:43:13 +00:00
Tomas Cohen Arazi baeba970f7 Bug 16829: make logaction and GetLogs aware of the interface column
This patch changes the logaction API so it accepts a new 'interface' param.
Current code calling logaction is not changed, and this parameter can be ommited
in most contexts, and it will correctly fall-back to C4::Context->interface.

Unit tests are provided on a different patch.

GetLogs gets patched as well, so it can be required to filter by 'interface' param.

Sponsored-by: NEKLS

Signed-off-by: Nicole C Engard <nengard@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2016-08-17 18:01:49 +00:00
Kyle M Hall bcf7268f4f Bug 16436 [QA Followup] - Use debug instead of info
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2016-08-02 10:19:32 +00:00
Kyle M Hall ce8c55fba0 Bug 16436 - Allow action logs to be logged to the koha log file
Test Plan:
1) Ensure that your Koha::Logger configuration is in good working order
2) Apply this patch
3) Modify the first line of your log4perl.conf file from:
    log4perl.logger.intranet = WARN, INTRANET
   to
    log4perl.logger.intranet = INFO, INTRANET
4) Change a system preference setting
5) Note the new line in your log file!

Signed-off-by: Srdjan <srdjan@catalyst.net.nz>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2016-08-02 10:19:31 +00:00
Jonathan Druart 798d38e4c7 Bug 16011: $VERSION - Remove comments
perl -p -i -e 's/^.*set the version for version checking.*\n//' **/*.pm

+ manual adjustements

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>

Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
2016-03-24 17:20:29 +00:00
Jonathan Druart 017699c345 Bug 16011: $VERSION - Remove the $VERSION init
Mainly a
  perl -p -i -e 's/^.*3.07.00.049.*\n//' **/*.pm
Then some adjustements

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>

Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
2016-03-24 17:20:28 +00:00
Jonathan Druart 3830d78d46 Bug 16011: $VERSION - remove use vars $VERSION
perl -p -i -e 's/^(use vars .*)\$VERSION\s?(.*)/$1$2/' **/*.pm

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>

Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
2016-03-24 17:20:26 +00:00
Kyle M Hall 774993ae2d Bug 15632 [QA Followup] - Get rid of use of uninitialized value errors for unit tests
* Set $user to "" if not passed
* Tidy sub

Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
2016-03-03 21:22:15 +00:00
Jonathan Druart ca36ee3794 Bug 15939: Action logs - Do not default dates to today
When accessing the modification logs from a link that does not
explicitly set the to and from dates (e.g., from patron or bib details),
no results are displayed unless the object had an action occur during
the current day.

This is a side-effect of commit 5dceb851 for bug 13813.

Test plan:
- View the modification logs of a record which has already been modified
(/tools/viewlog.pl?do_it=1&modules=CATALOGUING&action=MODIFY&object=XXX)
=> Without this patch, you won't see any logs (unless you have modified
the record today)
=> With this patch, the behavior is the same as prior bug 13813 (you can
check in 3.20.x), you will see all logs

Signed-off-by: Galen Charlton <gmcharlt@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
2016-03-02 00:53:14 +00:00
Marc Véron e8b2f04638 Bug 14870: (followup) Remove stray C4::Dates
(See comment #23)

This patch removes stray C4::Dates (date_fromat...) from
C4/Items.pm
C4/Log.pm
C4/Serials.pm
serials/acqui-search-result.pl
t/DateUtils.t
t/db_dependent/Items/GetItemsForInventory.t
tools/koha-news.pl

Some of them were inside comments etc.

To test:
- git grep 'C4::Dates' should give no result
- git grep 'format_d' should give no result
  Exception: in one cron job there exists an own sub format_date, and occurences not
             related to C4::Dates
- Search for regressions

http://bugs.koha-community.org/show_bug.cgi?id=14870
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
serials/acqui-search-results.pl looks like it should be revisited,
containing code that might not be needed. Searching a vendor
in serials still works witout a problem.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-19 13:05:06 -03:00
Marc Véron 5dceb851dd Bug 13813: Remove deprecated module C4::Dates from system
Test plan: See Bugzilla.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-09-18 12:40:55 -03:00