Back to bug 29746

Who When What Removed Added
tomascohen 2021-12-21 12:43:36 UTC Status NEW Needs Signoff
CC jonathan.druart+koha, kyle, m.de.rooy, martin.renvoize, nick
Assignee koha-bugs tomascohen
david 2021-12-21 13:53:33 UTC Status Needs Signoff Signed Off
david 2021-12-21 13:53:43 UTC Attachment #128830 Attachment is obsolete 0 1
david 2021-12-21 13:53:51 UTC Attachment #128831 Attachment is obsolete 0 1
dcook 2021-12-21 22:11:32 UTC CC dcook
tomascohen 2021-12-23 12:19:42 UTC CC tomascohen
tomascohen 2021-12-23 12:19:45 UTC Attachment #128834 Attachment is obsolete 0 1
tomascohen 2021-12-23 12:19:48 UTC Attachment #128835 Attachment is obsolete 0 1
tomascohen 2021-12-23 12:22:49 UTC Summary Add a handy Koha::Boolean class Add a handy Koha::Result::Boolean class
tomascohen 2021-12-23 12:45:35 UTC CC katrin.fischer
tomascohen 2021-12-23 13:07:22 UTC Blocks 29765
jonathan.druart 2022-01-03 14:38:37 UTC QA Contact testopia jonathan.druart+koha
jonathan.druart 2022-01-04 14:37:51 UTC Blocks 29788
jonathan.druart 2022-01-04 15:20:08 UTC Status Signed Off Passed QA
jonathan.druart 2022-01-04 15:20:13 UTC Attachment #128882 Attachment is obsolete 0 1
jonathan.druart 2022-01-04 15:20:19 UTC Attachment #128883 Attachment is obsolete 0 1
fridolin.somers 2022-01-05 23:35:22 UTC Status Passed QA Pushed to master
Version(s) released in 22.05.00
jonathan.druart 2022-01-06 07:55:00 UTC Keywords release-notes-needed
tomascohen 2022-01-06 13:00:27 UTC Keywords release-notes-needed
Text to go in the release notes This development introduces a new library, Koha::Result::Boolean, that will be used in method that need to return a boolean, but could also want to carry some more information such as the reason for a 'false' return value.

A Koha::Result::Boolean object will be evaluated as a boolean in bool context, while retaining its object nature and methods.

For example, suppose a $patron object should not be deleted because the patron it represents has a guarantee:

```
if ( $patron->safe_to_delete ) { ... }
```

will eval to false, and the code will do what we expect.

If our code really wanted to know *why* it cannot be deleted, we can do:

```
my $result = $patron->safe_to_delete;
unless ( $result ) {
Koha::Exceptions->throw( "Cannot delete, errors: " . join( ', ', map {$_->message} @{$result->messages} ) );
}
```
kyle 2022-01-07 11:29:55 UTC Resolution --- FIXED
Status Pushed to master RESOLVED
martin.renvoize 2022-11-02 16:50:25 UTC Blocks 31873
katrin.fischer 2023-06-08 22:26:27 UTC Status RESOLVED CLOSED

Back to bug 29746