Forum OpenACS Q&A: Installing Contacts?

Collapse
Posted by Christof Spitz on
I'd really like to install Contacts since I desperatly need an address management, but it never worked. Can anyone give me a clue how to do it? Contacts needs so many other packages, and openacs never gets all of them installed without some errors.

That's frustrating 😟

Malte recommended Contacts in another post. Ok, but that doesn't help if it can't be installed ...

I am trying this since all the way from openacs 4.6 till 5.2.2. I am not a programmer and always try to use the latest 'stable' release.

The old address manager package doesn't work either. It can be installed though, but then it fails to work.

Thanks
Christof

Collapse
2: Re: Installing Contacts? (response to 1)
Posted by Nima Mazloumi on
Christof,

please post which dependent packages result to errors. We have to fix them first to get contacts installed.

Also which OpenACS, PostgreSQL, AOLServer, OS do you have installed?

Greetings,
Nima

Collapse
3: Re: Installing Contacts? (response to 1)
Posted by damon pin on
I have a similar problem, I check out contacts from the cvs head , this is a installation of new 5.2 on postgres 7.4

Installing packages...

Installing Contacts 1.1d12

* Installing data model for Contacts 1.1d12...
o Loading data model /var/lib/aolserver/elshk/packages/contacts/sql/postgresql/contacts-create.sql...

CREATE TABLE
content_type__create_type
---------------------------
0
(1 row)
CREATE TABLE
CREATE TABLE
CREATE TABLE
CREATE VIEW
CREATE TABLE
CREATE TABLE
define_function_args
----------------------
1
(1 row)
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
content_folder__register_content_type
---------------------------------------
0
(1 row)
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
define_function_args
----------------------
1
(1 row)
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE TABLE
acs_object_type__create_type
------------------------------
0
(1 row)
CREATE TABLE
CREATE TABLE
define_function_args
----------------------
1
(1 row)
CREATE FUNCTION
CREATE FUNCTION
CREATE SEQUENCE
CREATE TABLE
CREATE TABLE
CREATE TABLE
INSERT 723952 1
INSERT 723953 1
INSERT 723954 1
INSERT 723955 1
INSERT 723956 1
CREATE TABLE
acs_object_type__create_type
------------------------------
0
(1 row)

Failed to install Contacts, version 1.1d12. The following error was generated:

CONTEXT: PL/pgSQL function "acs_object__new" line 17 at select into variables PL/pgSQL function "content_item__new" line 85 at assignment PL/pgSQL function "content_folder__new" line 34 at assignment PL/pgSQL function "content_folder__new" line 7 at return PL/pgSQL function "contact__folder_id" line 11 at assignment psql:contacts-messages-create.sql:38: ERROR: syntax error at or near ")" at character 965 psql:contacts-messages-create.sql:55: ERROR: syntax error at or near "cr" at character 181



NOTE: If the error comes from a sql script you may try to source it manually. When you are done with that you should revisit the APM and try again but remember to leave the manually souced sql scipts unchecked on the previous page.

Collapse
4: Re: Installing Contacts? (response to 1)
Posted by Christof Spitz on
Nima, here is what I have installed:

* Debian 3.1 stable,
* aolserver_v40_r10,
* PostgreSQL 7.4.7 ("createdb -E UNICODE openacs"),
* OpenACS Core 5.2.2 from /download page here.

After basic installation of the data model and restart of aolserver, openacs runs ok.

/acs-admin/install: Install or Upgrade From OpenACS Repository shows Contacts 1.0d27 and wants to install these packages:

Categories 1.1d4 *
Organization 0.5d3 *
Mail Services Lite 1.0b5 *
Mail Tracking 0.3b3 *
General Comments 4.6.1 *
Reference Data - Language 0.1d *
Reference Data - Country 0.2d1 *
Postal Address 0.1d *
Reference Data - US State 0.1d *
Reference Data - US County 0.1d *
Reference Data - US Zipcode 2.0 *
Reference Data - ITU Code 0.1d *
Telecom Information 0.1d *
Attribute Management System 1.1d5 *
Contacts 1.0d27

(Ok I don't need any US Reference Data, but what to do?)

Installing selected packages, please wait ...

Server Error:

HTTP/1.0 500 Internal Server Error Set-Cookie: ad_session_id=1%2c496%2c1+%7b166+1137585645+1EA37D8624B9FF58EC56FB6D5CAF60064A0F2F01%7d; Path=/; Max-Age=1200; Expires=Wed, 18-Jan-2006 12:00:45 GMT Expires: Wed, 18 Jan 2006 11:40:45 GMT Pragma: no-cache Cache-Control: no-cache Server: AOLserver/4.0 MIME-Version: 1.0 Date: Wed, 18 Jan 2006 11:40:51 GMT Content-Type: text/html; charset=utf-8 Content-Length: 5325 Connection: close

(I never had an internal server error before openacs-5-2-2, but I had errors like the following one:)

In addition to the above error there is:

Server Error

There was a server error processing your request. We apologize.

Take me back where I was (before the error)

invalid command name "acs_mail_lite::after_install"
while executing
"acs_mail_lite::after_install "
("eval" body line 1)
invoked from within
"eval $command"
(procedure "apm_invoke_callback_proc" line 37)
invoked from within
"apm_invoke_callback_proc -version_id $version_id -type after-install"
(procedure "apm_package_install" line 146)
invoked from within
"apm_package_install -enable -package_path $package_path -load_data_model -data_model_files $data_model_files

... and so on ...

You may have a look at the complete contacts installation part from my error.log here: http://www.lotsawa.de/cs/trash/contacts-install-error.log

Thanks very much
Christof

Collapse
5: Re: Installing Contacts? (response to 1)
Posted by Nima Mazloumi on
It seems like the proc acs_mail_lite::after_install is missing in the file packages/acs-mail-lite/tcl/acs-mail-lite-procs.tcl

    ad_proc -private after_install {} {
        Callback to be called after package installation.
        Adds the service contract package-specific bounce management.

        @author Timo Hentschel (mailto:thentschel@sussdorff-roy.com)
    } {
        acs_sc::contract::new -name AcsMailLite -description "Callbacks for Bounce Management"
        acs_sc::contract::operation::new -contract_name AcsMailLite -operation MailBounce -input "header:string body:string" -output "" -description "Callback to handle bouncing mails"
    }
So you either install developer support now and call the body of that proc in the developer support shell manually or you add this proc to that file and reinstall.


Once done let me what comes next.


Hang on, I think I know now why it broke. The file was not loaded due to the fact that you havn't installed tcllib in first place, right? That's why
package require mime 1.4
package require base64 2.3.1
called at the top of the file already fail. Look at the server log. My guess is that the aolserver didnt load that file at all and thus tells you that the proc is unknown. If that is true, check out my post here. This issue is not in the documentation I guess since tcllib will be mandatory from Openacs 5.3 on.
Collapse
6: Re: Installing Contacts? (response to 1)
Posted by Christof Spitz on
Nima, thanks a lot. I installed tcllib (a simple "apt-get install tcllib" did that, without any recompilation, would be nice to update the wiki installation document accordingly). It seems we have one source of failure less, but see what happens now:

Installing selected packages, please wait ...

We will continue automatically when installation is complete.

HTTP/1.0 500 Internal Server Error Expires: Wed, 18 Jan 2006 13:12:33 GMT Pragma: no-cache Cache-Control: no-cache Server: AOLserver/4.0 MIME-Version: 1.0 Date: Wed, 18 Jan 2006 13:13:34 GMT Content-Type: text/html; charset=utf-8 Content-Length: 7458 Connection: close

......

Server Error

There was a server error processing your request. We apologize.

Take me back where I was (before the error)

Database operation "dml" failed (exception ERROR, "FEHLER: Einfügen oder Aktualisieren in Tabelle lang_message_keysᆱ verletzt Fremdschlüssel-Constraint ï¾»lang_message_keys_fkᆱ
DETAIL: Schlüssel (package_key)=(acs-translations) ist nicht in Tabelle ᄏapm_package_typesᆱ vorhanden.
")

FEHLER: Einfügen oder Aktualisieren in Tabelle ᄏlang_message_keysᆱ verletzt Fremdschlüssel-Constraint ᄏlang_message_keys_fkᆱ
DETAIL: Schlüssel (package_key)=(acs-translations) ist nicht in Tabelle ᄏapm_package_typesᆱ vorhanden.

SQL:
insert into lang_message_keys
(message_key, package_key)
values
('rel_type_contact_rel', 'acs-translations')

while executing
"ns_pg_bind dml nsdb0 {
insert into lang_message_keys
(message_key, package_key)
values
(:message_key, :pack..."
("uplevel" body line 1)
invoked from within
"uplevel $ulevel [list ns_pg_bind $type $db $sql]"

(Sorry for the German messages)

You may have a look a the complete error.log here: http://www.lotsawa.de/cs/trash/contacts-install-error2.log
(search for ##### Error #####).

Thanks again, Christof

Collapse
7: Re: Installing Contacts? (response to 1)
Posted by Nima Mazloumi on
Seems like Malte is messing around with some packages :)

Ok, what this errror is saying is that a query is trying to insert an new internationalisation key into the table for message keys. But the system will only accept keys for packages installed. Thus you need to install the package acs-translations which is basically an empty package which can contain any package independant keys.

Please grep for the sql query and tell me where this insert is taking place:

insert into lang_message_keys
(message_key, package_key)
values
('rel_type_contact_rel', 'acs-translations')

Either you take that insert out or the package that does this call needs a dependency to acs-translations.

Collapse
8: Re: Installing Contacts? (response to 1)
Posted by Christof Spitz on
You're great, Nima. I have to grep that later, since I am in a hurry. I installed ACS Translation Storage first, and then contacts installed! But sorry to bother you again ... see what happens when I try to add a person or organisation:

Database operation "select" failed (exception NSDB, "Query was not a statement returning rows.")

FEHLER: Relation ᄏdotlrn_communities_allᆱ existiert nicht

(doesn't exist)

SQL:
select groups.group_id,
acs_objects.title as group_name,
( select count(distinct gamm.member_id) from group_approved_member_map gamm where gamm.group_id = groups.group_id ) as member_count,
( select count(distinct gcm.component_id) from group_component_map gcm where gcm.group_id = groups.group_id) as component_count,
CASE WHEN contact_groups.package_id is not null THEN '1' ELSE '0' END as mapped_p,
CASE WHEN default_p THEN '1' ELSE '0' END as default_p
from groups left join contact_groups on ( groups.group_id = contact_groups.group_id ), acs_objects
where groups.group_id not in ('-1','-2')
and groups.group_id = acs_objects.object_id
and groups.group_id not in ( select gcm.component_id from group_component_map gcm where gcm.group_id != -1 )
and groups.group_id not in (select community_id from dotlrn_communities_all)
order by mapped_p desc, CASE WHEN contact_groups.default_p THEN '000000000' ELSE upper(groups.group_name) END

while executing
"ns_pg_bind select nsdb0 {
select groups.group_id,
acs_objects.title as group_name,
( select count(distinct gamm.member_id) f..."
("uplevel" body line 1)

Seems Contacts need dotlrn installed.

Collapse
9: Re: Installing Contacts? (response to 1)
Posted by Nima Mazloumi on
This really sucks. Why does contacts depend on dotlrn at all. Someone thought it should.

You can remove that line:

"and groups.group_id not in (select community_id from dotlrn_communities_all)"

Make sure you have activated "watch all files" in the Package Manager for the package where this query belongs to to make your change visible.

Collapse
Posted by Christof Spitz on
Now I installed the package on a Debian machine that has dotlrn 2-2 running:

* apt-get install tcllib
* install ACS Translation Storage
* install Contacts (version 1.02d)

It seems it runs! Seems to be a rather complex application, so I have to try to understand it ... For example, although I am the site wide admin, it says "You do not have permission to add users to groups" when I try to add a person or an organization.

Again, thanks a lot!
Christof

Collapse
Posted by Malte Sussdorff on
Contacts has a hidden dependency on dotlrn which is why it is not released yet. Wrap a check for .LRN around all the text you find and then we can make it .LRN free.

You do not have permission as the default groups have not been setup correctly just yet. Do yourself a favour and run "contacts::populate::crm" right after installation manually in the OpenACS Shell.

Why don't we make this a requirement in the first place? Well, the people who actually know how to use contacts and how to give the permissions to the various groups might not like us to setup groups and default groups with attributes the way we see fit. But for testing this should be okay.

German language keys are added because this is the only way to add german localization for partial content (like group names, relationship names, attribute names) and this is why it is in the installation scripts. We could wrap all of this around a "if german_installed_p" place.

Hope this helps and please post all the glory details how you changed code in contacts to make it work.

Collapse
Posted by Nima Mazloumi on
Malte: Does it makes sense to have hidden dependencies or special checks for languages? It seems to me that this messes up the code, no? Isn't it possible to solve these dependencies with callbacks or somehow else?
Collapse
Posted by Malte Sussdorff on
Getting away from the dependencies using callbacks works just up to a certain degree. But if you manage to get the same functionality with a callback then go ahead. At the moment this is hard to achieve though.

If you look carefully at the code, yes, you could write a contacts::populate::german procedure which allows you to register the german language keys, but this involves more work as you would have to check the attribute_id for each of the attributes before you register the string. And it is not possible to install the language keys in the contacts.de_DE.xml due to the fact that the keys are stored in acs-translation (which is something we do not commit).

Collapse
Posted by Jon Griffin on
Malte,
This stuff is really bad design, why is any generic package dependent on .lrn? If something is in the core of .lrn that is needed, maybe it should be factored into the OACS core. Otherwise, why don't you just super class the stuff into a new package.

Maybe I am missing something, but something as generic as contacts shouldn't depend on much except maybe ref-, even that is probably optional.

Collapse
Posted by Malte Sussdorff on
Well.... According to my sources (grep for dotlrn_communities_all), this part should not even be called. Maybe you had a broken .LRN installation). Here is the full code:

set dotlrn_installed_p [apm_package_installed_p dotlrn]
if { $dotlrn_installed_p } {
set filter_clause "and groups.group_id not in (select community_id from dotlrn_communities_all)"
} else {
set filter_clause ""
}

As this is the only place with this query, there is a clear check here. Obviously you could put this into a callback, so whoever has the time and the courage to do it is welcome to do so.

Collapse
Posted by Malte Sussdorff on
Jon, after your comment I double checked. There is no point in contacts that depends on .LRN, so my statement of a hidden dependency is wrong. Obviously someone else (I think AlexK) cleaned it up already. Everything is wrapped in "if $dotlrn_installed_p" like my previous posting shows. I have no clue how and why Christof got to this error though.

As for super class: Taking into account that we execute code based on application_links you could *probably* write callbacks instead that do some uplevel magic using something like

foreach "callback_implementation" {

  pray implementation_name is named like the target object type

  call application data link like "application_data_link::get_linked -from_object_id $organization_id -to_object_type $implementation_name"

  if linked_p {
    execute callback_implementation
  }
}

But trust me, we are using similar techniques on many pages and you do not want to go down that road.

On the other hand, the more I look into this, the more I see I could get rid of all the dependency on .LRN and get it into a custom package somehow. Just have to make sure I overwrite the existing procedures (it is only one) and use a custom /www/contact.tcl (which I probably could do the same way as we are using our own custom versions of project manager pages).

But be aware that .LRN is not the only package contacts is tightly integrated using "if installed_p" or "if linked_p" statements. Projects is one, invoices is the other. Ripping it all out should be possible before the release, but you will miss out on a lot of integration if you have the other packages installed. As nooone complained so far about these two packages the integration did not do any harm. This is especially true for all the includes in /lib that reference the other packages. Should I take them out again and move to a custom package? Not that I would do so in the next two months anyway :).

The dependency on acs-mail-lite depending on tcllib should be strengthened by requiring acs-mail-lite from OpenACS HEAD, I have to agree. As tcllib is only required in 5.3 ....