Commit 4538c9a8 authored by Frank Bergmann's avatar Frank Bergmann

cosine #5704: Sorting list of successors based on name

parent c79c996d
......@@ -26,6 +26,36 @@ if {"" eq $locale} {
set locale [lang::user::locale]
}
# -------------------------------------------------------------
# Sort a list of invoice_ids according to invoice name
# -------------------------------------------------------------
ad_proc im_invoice_dependency_tree_sort_invoices {
list
name_hash_list
} {
Sort a list of invoice_ids according to invoice name
(or whatever array provided in 2nd argument)
} {
array set name_hash $name_hash_list
# ad_return_complaint 1 $name_hash_list
set slist [list]
foreach l $list {
lappend slist [list $name_hash($l) $l]
}
set slist [lsort $slist]
set list [list]
foreach l $slist {
lappend list [lindex $l 1]
}
return $list
}
# -------------------------------------------------------------
# Main project
# -------------------------------------------------------------
......@@ -204,6 +234,7 @@ while {[llength $list] > 0 && $cnt < 10000} {
foreach id [array names hash] {
lappend list $id
}
set list [im_invoice_dependency_tree_sort_invoices $list [array get name_hash]]
}
......@@ -275,6 +306,7 @@ while {[llength $list] > 0 && $cnt < 10000} {
foreach id [array names hash] {
lappend list $id
}
set list [im_invoice_dependency_tree_sort_invoices $list [array get name_hash]]
}
# Display the successors per cost type
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment