workflow::action::fsm::set_enabled_in_state (public)

 workflow::action::fsm::set_enabled_in_state -action_id action_id \
    -state_id state_id [ -enabled ] [ -assigned ] \
    [ -workflow_id workflow_id ]

Defined in packages/workflow/tcl/action-procs.tcl

Edit the enabled state of an action

Switches:
-action_id (required)
-state_id (required)
-enabled (optional, boolean)
-assigned (optional, boolean)
-workflow_id (optional)
Optionally provide the workflow_id. If not, this will be gotten from a query.
Author:
Lars Pind <lars@collaboraid.biz>

Partial Call Graph (max 5 caller/called nodes):
%3 db_boolean db_boolean (public) db_dml db_dml (public) db_string db_string (public) workflow::action::fsm::delete workflow::action::fsm::delete (public) workflow::action::get_element workflow::action::get_element (public) workflow::action::fsm::set_enabled_in_state workflow::action::fsm::set_enabled_in_state workflow::action::fsm::set_enabled_in_state->db_boolean workflow::action::fsm::set_enabled_in_state->db_dml workflow::action::fsm::set_enabled_in_state->db_string workflow::action::fsm::set_enabled_in_state->workflow::action::fsm::delete workflow::action::fsm::set_enabled_in_state->workflow::action::get_element

Testcases:
No testcase defined.
Source code:
    if { $workflow_id eq "" } {
        set workflow_id [workflow::action::get_element  -action_id $action_id  -element workflow_id]
    }

    set currently_assigned_p [db_string enabled_p {
        select assigned_p
        from   workflow_fsm_action_en_in_st
        where  action_id = :action_id
        and    state_id = :state_id
    } -default {}]

    set currently_enabled_p [expr {$currently_assigned_p ne ""}]
    set currently_assigned_p [string is true -strict $currently_assigned_p]

    set db_assigned_p [db_boolean $assigned_p]

    if { $currently_enabled_p != $enabled_p} {
        if { $enabled_p } {
            db_dml enabled {
                insert into workflow_fsm_action_en_in_st (action_id, state_id, assigned_p)
                values (:action_id, :state_id, :db_assigned_p)
            }
        } else {
            db_dml disable {
                delete
                from   workflow_fsm_action_en_in_st
                where  action_id = :action_id
                and    state_id = :state_id
            }
        }
    } elseif$currently_assigned_p != $assigned_p } {
        db_dml update_assigned_p {
            update workflow_fsm_action_en_in_st
            set    assigned_p = :db_assigned_p
            where  action_id = :action_id
            and    state_id = :state_id
        }
    }

    workflow::definition_changed_handler -workflow_id $workflow_id
Generic XQL file:
packages/workflow/tcl/action-procs.xql

PostgreSQL XQL file:
packages/workflow/tcl/action-procs-postgresql.xql

Oracle XQL file:
packages/workflow/tcl/action-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: