[Bug 22280] New: The ILL module assumes every status needs a next/previous status

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug 22280] New: The ILL module assumes every status needs a next/previous status

bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22280

            Bug ID: 22280
           Summary: The ILL module assumes every status needs a
                    next/previous status
 Change sponsored?: ---
           Product: Koha
           Version: master
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P5 - low
         Component: ILL
          Assignee: [hidden email]
          Reporter: [hidden email]
  Target Milestone: ---

Swedish ILL is very centrally driven, so some status changes are only done by
updates from the API. That means that these statuses do not need a prev_actions
or a next_actions:

        IN_NEG => {
            prev_actions => [ ],
            id             => 'IN_NEG',
            name           => 'InlĂ„n Negativt svar',
            ui_method_name => 'Negativt svar',
            method         => 'requestitem',
            next_actions   => [ ],
            ui_method_icon => 'fa-send-o'
        },

But leaving these blank as above leads to errors, around line 386 of
/usr/share/koha/lib/Koha/Illrequest.pm:

        # Update all core methods' next_actions.
        foreach my $prev_action ( @{$backend_status->{prev_actions}} ) {
            if ( grep $prev_action, @core_status_ids ) {
                my @next_actions =
                     @{$status_graph->{$prev_action}->{next_actions}}; ###
ERROR HERE
                push @next_actions, $backend_status_key;
                $status_graph->{$prev_action}->{next_actions}
                    = \@next_actions;
            }
        }
        # Update all core methods' prev_actions
        foreach my $next_action ( @{$backend_status->{next_actions}} ) {
            if ( grep $next_action, @core_status_ids ) {
                my @prev_actions =
                     @{$status_graph->{$next_action}->{prev_actions}}; ### AND
HERE
                push @prev_actions, $backend_status_key;
                $status_graph->{$next_action}->{prev_actions}
                    = \@prev_actions;
            }
        }

The error is something like "Can't treat an undefined value as an array".

Changing those lines to check if an array is defined makes the error go away,
and I have not seen any bad side effects:

   @{$status_graph->{$prev_action}->{next_actions}} if
$status_graph->{$prev_action}->{next_actions}; ### NO MORE ERROR HERE
   @{$status_graph->{$next_action}->{prev_actions}} if
$status_graph->{$next_action}->{prev_actions}; ### OR HERE

Does that change make sense to others, or am I missing some other way to work
around this?

--
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 22280] The ILL module assumes every status needs a next/previous status

bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22280

Andrew Isherwood <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrew.isherwood@ptfs-europ
                   |                            |e.com

--- Comment #1 from Andrew Isherwood <[hidden email]> ---
Hi Magnuse

That's a very interesting point. It feels to me like an oversight, we should be
allowing for the case where an status is isolated and doesn't come from
anywhere or go anywhere.

Your solution seems like a reasonable way to address the problem.

My biggest concern at the moment would be where to place this bug fix in the
ILL dependency tree. Illrequest.pm is pretty heavily modified in many of the
bugs in the tree and, even though your proposed fixes are small, I'm not sure
if they'd conflict. In which case, I'd be inclined to make it dependent on
18589. We already have at least one bug fix that is dependent on that bug,
which is at the top of the current QA tree.

--
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|

[Bug 22280] The ILL module assumes every status needs a next/previous status

bugzilla-daemon
In reply to this post by bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22280

--- Comment #2 from Magnus Enger <[hidden email]> ---
(In reply to Andrew Isherwood from comment #1)
> My biggest concern at the moment would be where to place this bug fix in the
> ILL dependency tree. Illrequest.pm is pretty heavily modified in many of the
> bugs in the tree and, even though your proposed fixes are small, I'm not
> sure if they'd conflict. In which case, I'd be inclined to make it dependent
> on 18589. We already have at least one bug fix that is dependent on that
> bug, which is at the top of the current QA tree.

Sounds good to me. :-)

--
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
_______________________________________________
Koha-bugs mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/