Taking `Koha::Item->delete` as an example, it accepts many parameters. Calling `Koha::Items->delete` will find out there's a `delete()` method defined in `Koha::Item` and loop through all items, calling that particular method. It would be handy if we could pass on some parameters. As an example, the following sequence: ```perl $biblio->items->delete; DelBiblio( $biblio->id); ``` would trigger reindexing the record for each item, and then when actually deleting the biblio. With the current codebase, to avoid it, we could instead do: ```perl foreach my $item ($biblio->items->as_list) { $item->delete( { skip_record_index } ); } DelBiblio( $biblio->id); ``` But it would be great if we could just write: ```perl $biblio->items->delete( { skip_record_index => 1 } ); DelBiblio( $biblio->id ); ```
Created attachment 166790 [details] [review] Bug 36873: Unit tests Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 166791 [details] [review] Bug 36873: Make Koha::Objects->delete pass parameters to the underlying method This patch makes the generic method pass any parameters it got passed to the underlying `delete()` method. To test: 1. Apply the unit tests patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Koha/Objects.t => FAIL: Tests fail, parameters are not passed 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass! 5. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 166799 [details] [review] Bug 36873: Unit tests Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: David Nind <david@davidnind.com>
Created attachment 166800 [details] [review] Bug 36873: Make Koha::Objects->delete pass parameters to the underlying method This patch makes the generic method pass any parameters it got passed to the underlying `delete()` method. To test: 1. Apply the unit tests patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Koha/Objects.t => FAIL: Tests fail, parameters are not passed 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass! 5. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: David Nind <david@davidnind.com>