Index: openacs-4/packages/contacts/contacts.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/contacts.info,v
diff -u -r1.31 -r1.32
--- openacs-4/packages/contacts/contacts.info 5 Oct 2005 18:44:45 -0000 1.31
+++ openacs-4/packages/contacts/contacts.info 5 Oct 2005 22:15:19 -0000 1.32
@@ -7,14 +7,14 @@
f
f
-
+
Matthew Geddert
This application lets you collaboratively view, edit and categorize contacts.
2005-10-05
Contacts is an application for managing all those people and or organization you need to keep track of. It has a complete UI for storing and categorizing contacts. Each contact can have an arbitrary number of custom attributes associated with it, including other contacts (i.e. a certain contact "belongs" to a certain organization). It also functions as a service contract provider for attributes related to users in your system
0
-
+
@@ -25,6 +25,7 @@
+
Index: openacs-4/packages/contacts/lib/contact-complaint-form.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contact-complaint-form.tcl,v
diff -u -r1.10 -r1.11
--- openacs-4/packages/contacts/lib/contact-complaint-form.tcl 4 Oct 2005 21:47:34 -0000 1.10
+++ openacs-4/packages/contacts/lib/contact-complaint-form.tcl 5 Oct 2005 22:16:16 -0000 1.11
@@ -89,8 +89,8 @@
}
ad_form -extend -name complaint_form -form {
- {object_id:text(hidden)
- {value $object_id}
+ {complaint_object_id:text(hidden)
+ {value $complaint_object_id}
}
{project:text(inform)
{label "[_ contacts.Object]"}
@@ -130,7 +130,7 @@
-description $description \
-supplier_id $supplier_id \
-paid $paid \
- -object_id $object_id \
+ -complaint_object_id $complaint_object_id \
-state $state
@@ -145,19 +145,19 @@
-description $description \
-supplier_id $supplier_id \
-paid $paid \
- -object_id $object_id \
+ -complaint_object_id $complaint_object_id \
-state $state
} -new_request {
- if { [exists_and_not_null $object_id]} {
- set project "[pm::project::name -project_item_id $object_id]"
+ if { [exists_and_not_null complaint_object_id]} {
+ set project "[pm::project::name -project_item_id $complaint_object_id]"
}
} -edit_request {
db_1row get_revision_info { }
- if { [exists_and_not_null object_id] } {
- set project "[pm::project::name -project_item_id $object_id]"
+ if { [exists_and_not_null complaint_object_id] } {
+ set project "[pm::project::name -project_item_id $complaint_object_id]"
}
} -after_submit {
Index: openacs-4/packages/contacts/lib/contact-complaint-form.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contact-complaint-form.xql,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/contacts/lib/contact-complaint-form.xql 14 Sep 2005 16:37:19 -0000 1.2
+++ openacs-4/packages/contacts/lib/contact-complaint-form.xql 5 Oct 2005 22:16:16 -0000 1.3
@@ -44,7 +44,7 @@
cr.title,
cr.description
from
- contact_complaint_tracking cct,
+ contact_complaint_track cct,
cr_revisions cr
where
complaint_id = :complaint_id
Index: openacs-4/packages/contacts/lib/contact-complaint-list.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contact-complaint-list.tcl,v
diff -u -r1.8 -r1.9
--- openacs-4/packages/contacts/lib/contact-complaint-list.tcl 5 Oct 2005 08:42:13 -0000 1.8
+++ openacs-4/packages/contacts/lib/contact-complaint-list.tcl 5 Oct 2005 22:16:16 -0000 1.9
@@ -1,10 +1,10 @@
# filter_p: if set to 1, the filter selection will be displayed
# customer_id: customer_id for which we want to see the complaints
# supplier_id: supplier_id for which we want to see the complaints
-# row_list: list of elements to be displayed
+# elements: list of elements to be displayed
set required_param_list [list]
-set optional_param_list [list filter_p]
+set optional_param_list [list filter_p elements]
set optional_unset_list [list customer_id supplier_id]
foreach required_param $required_param_list {
@@ -27,9 +27,20 @@
}
}
+# Here we specified which elements we will show
+set rows_list [list]
+if {![exists_and_not_null elements] } {
+ set rows_list [list title {} customer {} supplier {} turnover {} percent {} state {} complaint_object_id {} description {}]
+} else {
+ foreach element $elements {
+ lappend rows_list [list $element]
+ lappend rows_list [list]
+ }
+}
+# This are the elements of the template::list
set edit_url "/contacts/add-edit-complaint?complaint_id=@complaint.complaint_id@&customer_id=@complaint.customer_id@"
-set elements [list \
+set elements_list [list \
title [list label [_ contacts.Title_1] \
display_template \
"
@@ -43,23 +54,14 @@
turnover [list label [_ contacts.Turnover]]\
percent [list label [_ contacts.Percent]]\
state [list label "[_ contacts.Status]:"]\
- object_id [list label [_ contacts.Object_id]]\
+ complaint_object_id [list label [_ contacts.Object_id]]\
description [list label [_ contacts.Description]]\
]
-if {![exists_and_not_null row_list] } {
- set rows [list title {} customer {} supplier {} turnover {} percent {} state {} object_id {} description {}]
-} else {
- set rows [list]
- foreach element $row_list {
- lappend rows [list $element]
- lappend rows [list]
- }
-}
+
set customer_list [list]
set supplier_list [list]
-
db_foreach get_users { } {
if { [string equal [lsearch $customer_list [list $customer $c_id]] "-1"] } {
lappend customer_list [list "$customer" $c_id]
@@ -90,12 +92,12 @@
}
}
} \
- -elements $elements \
+ -elements $elements_list \
-formats {
normal {
label "Table"
layout table
- row $rows
+ row $rows_list
}
}
Index: openacs-4/packages/contacts/lib/contact-complaint-list.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contact-complaint-list.xql,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/contacts/lib/contact-complaint-list.xql 5 Oct 2005 08:42:13 -0000 1.3
+++ openacs-4/packages/contacts/lib/contact-complaint-list.xql 5 Oct 2005 22:16:16 -0000 1.4
@@ -7,7 +7,7 @@
select
cct.*, cr.title, cr.description
from
- contact_complaint_tracking cct, cr_items ci, cr_revisions cr
+ contact_complaint_track cct, cr_items ci, cr_revisions cr
where
ci.latest_revision = cct.complaint_id
and cr.revision_id = cct.complaint_id
@@ -23,7 +23,7 @@
( select first_names ||' '|| last_name from cc_users where user_id = customer_id) as customer,
( select first_names ||' '|| last_name from cc_users where user_id = supplier_id) as supplier
from
- contact_complaint_tracking cct
+ contact_complaint_track cct
Index: openacs-4/packages/contacts/sql/postgresql/contacts-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/sql/postgresql/contacts-create.sql,v
diff -u -r1.10 -r1.11
--- openacs-4/packages/contacts/sql/postgresql/contacts-create.sql 9 Aug 2005 12:44:19 -0000 1.10
+++ openacs-4/packages/contacts/sql/postgresql/contacts-create.sql 5 Oct 2005 22:17:48 -0000 1.11
@@ -128,30 +128,6 @@
constraint organization_rels_rel_id_pk primary key
);
-
-
-create table contact_complaint_tracking (
- complaint_id integer
- constraint contact_complaint_tracking_pk
- primary key
- constraint contact_complaint_tracking_fk
- references cr_revisions(revision_id)
- on delete cascade,
- customer_id integer
- constraint contact_complaint_tracking_customer_fk
- references parties(party_id) on delete cascade,
- turnover float,
- percent integer,
- supplier_id integer
- constraint contact_complaint_tracking_supplier_fk
- references parties(party_id) on delete cascade,
- paid float,
- object_id integer,
- state varchar(10),
- constraint cct_state_ck
- check (state in ('valid','invalid','open'))
-);
-
\i contacts-package-create.sql
\i contacts-search-create.sql
\i contacts-messages-create.sql
Index: openacs-4/packages/contacts/sql/postgresql/contacts-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/sql/postgresql/contacts-drop.sql,v
diff -u -r1.6 -r1.7
--- openacs-4/packages/contacts/sql/postgresql/contacts-drop.sql 12 Sep 2005 14:12:22 -0000 1.6
+++ openacs-4/packages/contacts/sql/postgresql/contacts-drop.sql 5 Oct 2005 22:17:48 -0000 1.7
@@ -19,7 +19,7 @@
drop table contact_groups;
drop table contact_rels;
drop table organization_rels;
-drop table contact_complaint_tracking;
+drop table contact_complaint_track;
select content_type__drop_type ('contact_party_revision','t','t');
--drop table contact_party_revisions;
Index: openacs-4/packages/contacts/tcl/contact-complaint-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/tcl/contact-complaint-procs.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/contacts/tcl/contact-complaint-procs.tcl 9 Aug 2005 20:50:06 -0000 1.2
+++ openacs-4/packages/contacts/tcl/contact-complaint-procs.tcl 5 Oct 2005 22:17:15 -0000 1.3
@@ -16,7 +16,7 @@
{-description ""}
-supplier_id:required
-paid:required
- -object_id:required
+ -complaint_object_id:required
{-state "open"}
} {
Inserts a new complaint. Creates a new revision if complaint_id is not present,
@@ -30,7 +30,7 @@
@param description
@param supplier_id
@param paid
- @param object_id The object_id you are making the complaint
+ @param complaint_object_id The complaint is being made over this object_id
} {
if { [empty_string_p $complaint_id] } {
Index: openacs-4/packages/contacts/tcl/contact-complaint-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/tcl/contact-complaint-procs.xql,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/contacts/tcl/contact-complaint-procs.xql 9 Aug 2005 20:50:06 -0000 1.2
+++ openacs-4/packages/contacts/tcl/contact-complaint-procs.xql 5 Oct 2005 22:17:15 -0000 1.3
@@ -5,10 +5,10 @@
insert into
- contact_complaint_tracking
- (complaint_id,customer_id,turnover,percent,supplier_id,paid,object_id,state)
+ contact_complaint_track
+ (complaint_id,customer_id,turnover,percent,supplier_id,paid,complaint_object_id,state)
values
- (:complaint_id,:customer_id,:turnover,:percent,:supplier_id,:paid,:object_id,:state)
+ (:complaint_id,:customer_id,:turnover,:percent,:supplier_id,:paid,:complaint_object_id,:state)
Index: openacs-4/packages/contacts/tcl/contacts-install-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/tcl/contacts-install-procs.tcl,v
diff -u -r1.13 -r1.14
--- openacs-4/packages/contacts/tcl/contacts-install-procs.tcl 10 Sep 2005 05:46:23 -0000 1.13
+++ openacs-4/packages/contacts/tcl/contacts-install-procs.tcl 5 Oct 2005 22:17:15 -0000 1.14
@@ -258,3 +258,101 @@
array set sn_array [site_node::get -url $url]
contacts::populate::crm -package_id $sn_array(object_id)
}
+
+
+ad_proc -public contacts::install::package_upgrade {
+ {-from_version_name:required}
+ {-to_version_name:required}
+} {
+ @author Miguel Marin (miguelmarin@viaro.net)
+ @author Viaro Networks www.viaro.net
+ @creation-date 2005-10-05
+} {
+ apm_upgrade_logic \
+ -from_version_name $from_version_name \
+ -to_version_name $to_version_name \
+ -spec {
+ 1.0d18 1.0d19 {
+
+ content::type::new -content_type "contact_complaint" \
+ -pretty_name "Contact Complaint" \
+ -pretty_plural "Contact Complaints" \
+ -table_name "contact_complaint_track" \
+ -id_column "complaint_id"
+
+ # now set up the attributes that by default we need for the complaints
+ content::type::attribute::new \
+ -content_type "contact_complaint" \
+ -attribute_name "customer_id" \
+ -datatype "integer" \
+ -pretty_name "Customer ID" \
+ -sort_order 1 \
+ -column_spec "integer constraint contact_complaint_track_customer_fk
+ references parties(party_id) on delete cascade"
+
+ content::type::attribute::new \
+ -content_type "contact_complaint" \
+ -attribute_name "turnover" \
+ -datatype "money" \
+ -pretty_name "Turnover" \
+ -sort_order 2 \
+ -column_spec "float"
+
+ content::type::attribute::new \
+ -content_type "contact_complaint" \
+ -attribute_name "percent" \
+ -datatype "integer" \
+ -pretty_name "Percent" \
+ -sort_order 3 \
+ -column_spec "integer"
+
+ content::type::attribute::new \
+ -content_type "contact_complaint" \
+ -attribute_name "supplier_id" \
+ -datatype "integer" \
+ -pretty_name "Supplier ID" \
+ -sort_order 4 \
+ -column_spec "integer"
+
+ content::type::attribute::new \
+ -content_type "contact_complaint" \
+ -attribute_name "paid" \
+ -datatype "money" \
+ -pretty_name "Paid" \
+ -sort_order 5 \
+ -column_spec "float"
+
+ content::type::attribute::new \
+ -content_type "contact_complaint" \
+ -attribute_name "complaint_object_id" \
+ -datatype "integer" \
+ -pretty_name "Complaint Object ID" \
+ -sort_order 6 \
+ -column_spec "integer constraint contact_complaint_track_complaint_object_id_fk
+ references acs_objects(object_id) on delete cascade"
+
+ content::type::attribute::new \
+ -content_type "contact_complaint" \
+ -attribute_name "state" \
+ -datatype "string" \
+ -pretty_name "State" \
+ -sort_order 7 \
+ -column_spec "varchar(7) constraint cct_state_ck
+ check (state in ('valid','invalid','open'))"
+
+ # Now we need to copy all information on contact_complaint_tracking table (the one we are taking out)
+ # into the new one called contact_complaint_track with the new fields. This is simple since
+ # all the collumns have the same datatype, just changed some names.
+
+ db_dml insert_data {
+ insert into
+ contact_complaint_track
+ (complaint_id,customer_id,turnover,percent,supplier_id,paid,complaint_object_id,state)
+ select * from contact_complaint_tracking
+ }
+
+ # Now we just delete the table contact_complaint_tracking
+ db_dml drop_table { drop table contact_complaint_tracking }
+ }
+ }
+}
\ No newline at end of file
Index: openacs-4/packages/contacts/tcl/contacts-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/tcl/contacts-procs.tcl,v
diff -u -r1.32 -r1.33
--- openacs-4/packages/contacts/tcl/contacts-procs.tcl 5 Oct 2005 16:18:49 -0000 1.32
+++ openacs-4/packages/contacts/tcl/contacts-procs.tcl 5 Oct 2005 22:18:32 -0000 1.33
@@ -584,6 +584,7 @@
foreach {section attribute pretty_name value} $values {
set return_array($attribute) [lang::util::localize $value]
}
+
if {![empty_string_p $attribute_name]} {
return $return_array($attribute_name)
} else {
Index: openacs-4/packages/contacts/www/add-edit-complaint.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/add-edit-complaint.adp,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/contacts/www/add-edit-complaint.adp 4 Oct 2005 21:33:40 -0000 1.3
+++ openacs-4/packages/contacts/www/add-edit-complaint.adp 5 Oct 2005 22:14:17 -0000 1.4
@@ -3,4 +3,4 @@
@context;noquote@
-
\ No newline at end of file
+
\ No newline at end of file
Index: openacs-4/packages/contacts/www/complaint-ae.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/complaint-ae.adp,v
diff -u -r1.1 -r1.3
--- openacs-4/packages/contacts/www/complaint-ae.adp 10 Aug 2005 19:37:21 -0000 1.1
+++ openacs-4/packages/contacts/www/complaint-ae.adp 5 Oct 2005 22:14:17 -0000 1.3
@@ -2,4 +2,5 @@
@supplier_id@
+supplier_id="@supplier_id@" customer_id="@customer_id@" complaint_object_id ="@object_id@">
+
Index: openacs-4/packages/contacts/www/contact.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/www/contact.adp,v
diff -u -r1.30 -r1.31
--- openacs-4/packages/contacts/www/contact.adp 5 Oct 2005 18:42:57 -0000 1.30
+++ openacs-4/packages/contacts/www/contact.adp 5 Oct 2005 22:15:44 -0000 1.31
@@ -53,7 +53,7 @@