Index: openacs-4/packages/dotlrn-ecommerce/www/admin/patrons.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/admin/patrons.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn-ecommerce/www/admin/patrons.tcl 2 Jun 2005 06:39:43 -0000 1.2 +++ openacs-4/packages/dotlrn-ecommerce/www/admin/patrons.tcl 4 Jun 2005 10:05:18 -0000 1.3 @@ -22,28 +22,93 @@ participant { label Participant } - patron { - label Patron - } relationship { label Relationship + display_template { + @patrons.relationship;noquote@ + } } + patron { + label "Related User" + display_template { + + @patrons.patron@
Phone: @patrons.phone@ +
+ + @patrons.patron@ + + } + } + patron_p { + label "Patron for this Section" + display_template { + + Yes + + } + html { align center } + } } db_multirow -extend { relationship } patrons patrons { - select r.rel_id, person__name(d.user_id) as participant, person__name(r.object_id_two) as patron - from acs_rels r, dotlrn_member_rels_full d - where r.object_id_one = d.user_id - and r.rel_type = 'patron_rel' - and d.community_id = (select community_id - from dotlrn_ecommerce_section - where section_id = :section_id) + select rels.rel_id, rels.patron_rel_id, rels.participant, rels.patron, rels.direction, r.rel_id as patron_p, a.phone + from ( + + select d.rel_id, + r.rel_id as patron_rel_id, + (select first_names||' '||last_name||' ('||email||')' from dotlrn_users where user_id = d.user_id) as participant, + (select first_names||' '||last_name||' ('||email||')' from dotlrn_users where user_id = r.object_id_two) as patron, + 1 as direction, + d.community_id, + r.object_id_two as patron_id + from acs_rels r, dotlrn_member_rels_full d + where r.object_id_one = d.user_id + and r.rel_type = 'patron_rel' + and d.community_id = (select community_id + from dotlrn_ecommerce_section + where section_id = :section_id) + + union + + select d.rel_id, + r.rel_id as patron_rel_id, + (select first_names||' '||last_name||' ('||email||')' from dotlrn_users where user_id = d.user_id) as participant, + (select first_names||' '||last_name||' ('||email||')' from dotlrn_users where user_id = r.object_id_one) as patron, + 2 as direction, + d.community_id, + r.object_id_one as patron_id + from acs_rels r, dotlrn_member_rels_full d + where r.object_id_two = d.user_id + and r.rel_type = 'patron_rel' + and d.community_id = (select community_id + from dotlrn_ecommerce_section + where section_id = :section_id) + and not r.object_id_one in (select r.object_id_two + from acs_rels r, dotlrn_member_rels_full d + where r.object_id_one = d.user_id + and r.rel_type = 'patron_rel' + and d.community_id = (select community_id + from dotlrn_ecommerce_section + where section_id = :section_id)) + +) rels left join acs_rels r +on (rels.rel_id = r.object_id_one and r.rel_type = 'membership_patron_rel' and rels.patron_id = r.object_id_two) +left join ec_addresses a +on (r.object_id_two = a.user_id) + + order by lower(rels.participant) } { - foreach category [category::get_mapped_categories $rel_id] { + foreach category [category::get_mapped_categories $patron_rel_id] { lappend relationship [category::get_name $category] } set relationship [join $relationship ", "] + + if { $direction == 1 } { + set relationship "$relationship »" + } else { + set relationship "« $relationship" + } } db_1row get_section_info "select c.course_id, s.section_name