xowf::migrate_from_wf_current_state (private)

 xowf::migrate_from_wf_current_state

Defined in packages/xowf/tcl/xowf-procs.tcl

Partial Call Graph (max 5 caller/called nodes):
%3

Testcases:
No testcase defined.
Source code:
    #
    # Transform the former instance_attributes
    #   "wf_current_state" to the xowiki::FormPage attribute "state", and
    #   "wf_assignee" to the xowiki::FormPage attribute "assignee".
    #
    set count 0
    foreach atts [xo::dc list_of_lists entries {
      select p.state,p.assignee,pi.instance_attributes,p.xowiki_form_page_id
      from xowiki_form_page p, xowiki_page_instance pi, cr_items i, cr_revisions r
      where r.item_id = i.item_id and p.xowiki_form_page_id = r.revision_id and
      pi.page_instance_id = r.revision_id
    }] {
      lassign $atts state assignee instance_attributes xowiki_form_page_id
      if {[dict exists $instance_attributes wf_current_state]
          && [dict get $instance_attributes wf_current_state] ne $state} {

        #Object msg "must update state $state for $xowiki_form_page_id to [dict get $instance_attributes wf_current_state]"

        xo::db dml update_state "update xowiki_form_page  set state = '[dict get $instance_attributes wf_current_state]'
                where xowiki_form_page_id  = :xowiki_form_page_id"
        incr count
      }
      if {[dict exists $instance_attributes wf_assignee]
          && [dict get $instance_attributes wf_assignee] ne $assignee
        } {
        #Object msg "must update assignee $assignee for $xowiki_form_page_id to [dict get $instance_attributes wf_assignee]"
        set wf_assignee [dict get $instance_attributes wf_assignee]
        xo::dc dml update_state "update xowiki_form_page set assignee = :wf_assignee  where xowiki_form_page_id = :xowiki_form_page_id"
        incr count
      }
    }
    return $count
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ]
Show another procedure: