mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-29 03:13:40 +01:00
- several bug fixes
- new HEAD install works - update 1.2 works - update 1.0 should work, but untested
This commit is contained in:
parent
9bffe8f947
commit
a696318869
@ -141,7 +141,7 @@ class bocontacts extends socontacts
|
|||||||
'n_family' => lang('last name'),
|
'n_family' => lang('last name'),
|
||||||
'n_suffix' => lang('suffix'),
|
'n_suffix' => lang('suffix'),
|
||||||
'n_fn' => lang('full name'),
|
'n_fn' => lang('full name'),
|
||||||
'org_name' => lang('company name'),
|
'org_name' => lang('company'),
|
||||||
);
|
);
|
||||||
foreach($labels as $name => $label)
|
foreach($labels as $name => $label)
|
||||||
{
|
{
|
||||||
@ -264,9 +264,8 @@ class bocontacts extends socontacts
|
|||||||
/**
|
/**
|
||||||
* saves contact to db
|
* saves contact to db
|
||||||
*
|
*
|
||||||
* @param array &contact contact array from etemplate::exec
|
* @param array &$contact contact array from etemplate::exec
|
||||||
* @return boolean true on success, false on failure, an error-message is in $contact['msg']
|
* @return boolean true on success, false on failure, an error-message is in $contact['msg']
|
||||||
* TODO make fullname format choosable at best with selectbox and javascript in edit dialoge
|
|
||||||
*/
|
*/
|
||||||
function save(&$contact)
|
function save(&$contact)
|
||||||
{
|
{
|
||||||
@ -279,7 +278,6 @@ class bocontacts extends socontacts
|
|||||||
}
|
}
|
||||||
if($contact['id'] && !$this->check_perms(EGW_ACL_EDIT,$contact))
|
if($contact['id'] && !$this->check_perms(EGW_ACL_EDIT,$contact))
|
||||||
{
|
{
|
||||||
$contact['msg'] = lang('You are not permittet to edit this contact');
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// convert categories
|
// convert categories
|
||||||
@ -293,16 +291,10 @@ class bocontacts extends socontacts
|
|||||||
$contact['n_fn'] = $this->fullname($contact);
|
$contact['n_fn'] = $this->fullname($contact);
|
||||||
$contact['n_fileas'] = $this->fileas($contact);
|
$contact['n_fileas'] = $this->fileas($contact);
|
||||||
|
|
||||||
$error_nr = parent::save($contact);
|
if(!($error_nr = parent::save($contact)))
|
||||||
|
|
||||||
if(!$error_nr)
|
|
||||||
{
|
{
|
||||||
$GLOBALS['egw']->contenthistory->updateTimeStamp('contacts', $contact['id'],$isUpdate ? 'modify' : 'add', time());
|
$GLOBALS['egw']->contenthistory->updateTimeStamp('contacts', $contact['id'],$isUpdate ? 'modify' : 'add', time());
|
||||||
}
|
}
|
||||||
$contact['msg'] = $error_nr ?
|
|
||||||
lang('Something went wrong by saving this contact. Errorcode %1',$error_nr) :
|
|
||||||
lang('Contact saved');
|
|
||||||
|
|
||||||
return !$error_nr;
|
return !$error_nr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -416,7 +408,7 @@ class bocontacts extends socontacts
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called by delete-account hook if an account gets deleted
|
* Delete contact linked to account, called by delete-account hook, when an account get deleted
|
||||||
*
|
*
|
||||||
* @param array $data
|
* @param array $data
|
||||||
*/
|
*/
|
||||||
@ -431,4 +423,35 @@ class bocontacts extends socontacts
|
|||||||
$this->delete($contact_id);
|
$this->delete($contact_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update contact if linked account get updated, called by edit-account hook, when an account get edited
|
||||||
|
*
|
||||||
|
* @param array $data
|
||||||
|
*/
|
||||||
|
function editaccount($data)
|
||||||
|
{
|
||||||
|
//echo "bocontacts::editaccount()"; _debug_array($data);
|
||||||
|
|
||||||
|
// check if account is linked to a contact
|
||||||
|
if (($contact_id = $GLOBALS['egw']->accounts->id2name($data['account_id'],'person_id')) &&
|
||||||
|
($contact = $this->read($contact_id)))
|
||||||
|
{
|
||||||
|
$need_update = false;
|
||||||
|
foreach(array(
|
||||||
|
'n_family' => 'lastname',
|
||||||
|
'n_given' => 'firstname',
|
||||||
|
'email' => 'email',
|
||||||
|
) as $cname => $aname)
|
||||||
|
{
|
||||||
|
if ($contact[$cname] != $data[$aname]) $need_update = true;
|
||||||
|
|
||||||
|
$contact[$cname] = $data[$aname];
|
||||||
|
}
|
||||||
|
if ($need_update)
|
||||||
|
{
|
||||||
|
$this->save($contact);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -147,10 +147,20 @@ class socontacts
|
|||||||
|
|
||||||
$custom =& CreateObject('admin.customfields',$contact_app);
|
$custom =& CreateObject('admin.customfields',$contact_app);
|
||||||
$this->customfields = $custom->get_customfields();
|
$this->customfields = $custom->get_customfields();
|
||||||
if ($this->customfields && !is_array($this->customfields)) $this->customfields = unserialize($this->customfields);
|
// if ($this->customfields && !is_array($this->customfields)) $this->customfields = unserialize($this->customfields);
|
||||||
if (!$this->customfields) $this->customfields = array();
|
// if (!$this->customfields) $this->customfields = array();
|
||||||
$this->content_types = $custom->get_content_types();
|
$this->content_types = $custom->get_content_types();
|
||||||
if ($this->content_types && !is_array($this->content_types)) $this->content_types = unserialize($this->content_types);
|
// if ($this->content_types && !is_array($this->content_types)) $this->content_types = unserialize($this->content_types);
|
||||||
|
if (!$this->content_types)
|
||||||
|
{
|
||||||
|
$this->content_types = $custom->content_types = array('n' => array(
|
||||||
|
'name' => 'contact',
|
||||||
|
'options' => array(
|
||||||
|
'template' => 'addressbook.edit',
|
||||||
|
'icon' => 'navbar.png'
|
||||||
|
)));
|
||||||
|
$custom->save_repository();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -93,10 +93,7 @@ class socontacts_sql extends so_sql
|
|||||||
// having them double is ambigues
|
// having them double is ambigues
|
||||||
if (!$only_keys)
|
if (!$only_keys)
|
||||||
{
|
{
|
||||||
$account_table = $GLOBALS['egw']->db->get_table_definitions('phpgwapi',$this->accounts_table); // global db is on phpgwapi
|
$only_keys = array_diff(array_keys($this->db_cols),array_keys($accounts2contacts));
|
||||||
// all addressbook columns, but the ones given with CASE ... AS above plus the account-columns
|
|
||||||
$only_keys = implode(',',array_merge(array_diff(array_keys($this->db_cols),array_keys($accounts2contacts)),
|
|
||||||
array_keys($account_table['fd'])));
|
|
||||||
}
|
}
|
||||||
elseif($only_keys !== true)
|
elseif($only_keys !== true)
|
||||||
{
|
{
|
||||||
@ -121,8 +118,9 @@ class socontacts_sql extends so_sql
|
|||||||
$filter[] = str_replace(' AS '.$db_col,'',$accounts2contacts[$db_col]).
|
$filter[] = str_replace(' AS '.$db_col,'',$accounts2contacts[$db_col]).
|
||||||
($value === "!''" ? "!=''" : '='.$this->db->quote($value,$this->table_def['fd'][$db_col]['type']));
|
($value === "!''" ? "!=''" : '='.$this->db->quote($value,$this->table_def['fd'][$db_col]['type']));
|
||||||
}
|
}
|
||||||
elseif($value == "!''") // not empty query, will match all accounts, as their value is NULL not ''
|
elseif($value === "!''") // not empty query, will match all accounts, as their value is NULL not ''
|
||||||
{
|
{
|
||||||
|
unset($filter[$col]);
|
||||||
$filter[] = "($db_col != '' AND $db_col IS NOT NULL)";
|
$filter[] = "($db_col != '' AND $db_col IS NOT NULL)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -161,7 +159,7 @@ class socontacts_sql extends so_sql
|
|||||||
{
|
{
|
||||||
parent::search($criteria,$only_keys,$order_by,$extra_cols,$wildcard,$empty,$op,'UNION',$filter,
|
parent::search($criteria,$only_keys,$order_by,$extra_cols,$wildcard,$empty,$op,'UNION',$filter,
|
||||||
'LEFT'.$this->accounts_join.' '.$join,$need_full_no_count);
|
'LEFT'.$this->accounts_join.' '.$join,$need_full_no_count);
|
||||||
$filter[] = 'person_id=0';
|
$filter[] = '(person_id=0 OR person_id IS NULL)'; // unfortunally both is used in eGW
|
||||||
parent::search($criteria,$only_keys,$order_by,$extra_cols,$wildcard,$empty,$op,'UNION',$filter,
|
parent::search($criteria,$only_keys,$order_by,$extra_cols,$wildcard,$empty,$op,'UNION',$filter,
|
||||||
'RIGHT'.$this->accounts_join.' '.$join,$need_full_no_count);
|
'RIGHT'.$this->accounts_join.' '.$join,$need_full_no_count);
|
||||||
}
|
}
|
||||||
@ -214,6 +212,10 @@ class socontacts_sql extends so_sql
|
|||||||
'email' => $account->data['email'],
|
'email' => $account->data['email'],
|
||||||
'owner' => 0,
|
'owner' => 0,
|
||||||
'tid' => 'n',
|
'tid' => 'n',
|
||||||
|
'creator' => $GLOBALS['egw_info']['user']['account_id'],
|
||||||
|
'created' => time(),
|
||||||
|
'modifier' => $GLOBALS['egw_info']['user']['account_id'],
|
||||||
|
'modified' => time(),
|
||||||
),$account_id);
|
),$account_id);
|
||||||
|
|
||||||
return $this->data+array('account_id' => $account_id);
|
return $this->data+array('account_id' => $account_id);
|
||||||
@ -244,7 +246,6 @@ class socontacts_sql extends so_sql
|
|||||||
'n_family' => $lastname,
|
'n_family' => $lastname,
|
||||||
'private' => 0,
|
'private' => 0,
|
||||||
));
|
));
|
||||||
//echo "<p>soccontacts_sql::_find_unique_contacts($firstname,$lastname)</p>\n"; _debug_array($contacts);
|
|
||||||
|
|
||||||
return $contacts && count($contacts) == 1 ? $contacts[0]['id'] : false;
|
return $contacts && count($contacts) == 1 ? $contacts[0]['id'] : false;
|
||||||
}
|
}
|
||||||
|
@ -669,7 +669,8 @@ class uicontacts extends bocontacts
|
|||||||
{
|
{
|
||||||
if (!isset($sel_options['owner'][(int)$content['owner']]))
|
if (!isset($sel_options['owner'][(int)$content['owner']]))
|
||||||
{
|
{
|
||||||
$sel_options['owner'][(int)$content['owner']] = $GLOBALS['egw']->common->grab_owner_name($content['owner']);
|
$sel_options['owner'][(int)$content['owner']] = !$content['owner'] ? lang('Accounts') :
|
||||||
|
$GLOBALS['egw']->common->grab_owner_name($content['owner']);
|
||||||
}
|
}
|
||||||
$readonlys['owner'] = !$content['owner'] || // dont allow to move accounts, as this mean deleting the user incl. all content he owns
|
$readonlys['owner'] = !$content['owner'] || // dont allow to move accounts, as this mean deleting the user incl. all content he owns
|
||||||
!$this->check_perms(EGW_ACL_DELETE,$content); // you need delete rights to move a contact into an other addressbook
|
!$this->check_perms(EGW_ACL_DELETE,$content); // you need delete rights to move a contact into an other addressbook
|
||||||
|
17
addressbook/setup/default_records.inc.php
Normal file
17
addressbook/setup/default_records.inc.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
/**************************************************************************\
|
||||||
|
* eGroupWare - Adressbook - default records *
|
||||||
|
* http://www.egroupware.org *
|
||||||
|
* Written and (c) 2006 by Ralf Becker <RalfBecker-AT-outdoor-training.de> *
|
||||||
|
* ------------------------------------------------------------------------ *
|
||||||
|
* This program is free software; you can redistribute it and/or modify it *
|
||||||
|
* under the terms of the GNU General Public License as published by the *
|
||||||
|
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||||
|
* option) any later version. *
|
||||||
|
\**************************************************************************/
|
||||||
|
|
||||||
|
/* $Id$ */
|
||||||
|
|
||||||
|
// Create Addressbook for Default group, by setting a group ACL from the group to itself for all rights: add, read, edit and delete
|
||||||
|
$defaultgroup = $GLOBALS['egw_setup']->add_account('Default','Default','Group',False,False);
|
||||||
|
$GLOBALS['egw_setup']->add_acl('addressbook',$defaultgroup,$defaultgroup,1|2|4|8);
|
@ -16,6 +16,7 @@ address book - view addressbook de Adressbuch - Anzeigen
|
|||||||
address line 2 addressbook de Adresszeile 2
|
address line 2 addressbook de Adresszeile 2
|
||||||
address type addressbook de Adresstyp
|
address type addressbook de Adresstyp
|
||||||
addressbook common de Adressbuch
|
addressbook common de Adressbuch
|
||||||
|
addressbook menu addressbook de Adressbuch Menü
|
||||||
addressbook preferences addressbook de Adressbuch Einstellungen
|
addressbook preferences addressbook de Adressbuch Einstellungen
|
||||||
addressbook the contact should be saved to addressbook de Adressbuch in das der Kontakt gespeichert werden soll
|
addressbook the contact should be saved to addressbook de Adressbuch in das der Kontakt gespeichert werden soll
|
||||||
addressbook-fieldname addressbook de Adressbuch Feldname
|
addressbook-fieldname addressbook de Adressbuch Feldname
|
||||||
@ -79,6 +80,7 @@ download export file (uncheck to debug output in browser) addressbook de Downloa
|
|||||||
download this contact as vcard file addressbook de Diese Adresse als vCard Datei herunterladen
|
download this contact as vcard file addressbook de Diese Adresse als vCard Datei herunterladen
|
||||||
edit custom field addressbook de Benutzerdefiniertes Feld bearbeiten
|
edit custom field addressbook de Benutzerdefiniertes Feld bearbeiten
|
||||||
edit custom fields admin de Benutzerdefinierte Felder bearbeiten
|
edit custom fields admin de Benutzerdefinierte Felder bearbeiten
|
||||||
|
edit extra account-data in the addressbook admin de Zusätzliche Benutzerdaten im Adressbuch bearbeiten.
|
||||||
edit phonenumbers - addressbook de Telefonnummern bearbeiten
|
edit phonenumbers - addressbook de Telefonnummern bearbeiten
|
||||||
email & internet addressbook de Email & Internet
|
email & internet addressbook de Email & Internet
|
||||||
empty for all addressbook de leer für alle
|
empty for all addressbook de leer für alle
|
||||||
|
@ -16,6 +16,7 @@ address book - view addressbook en Address book - view
|
|||||||
address line 2 addressbook en Address Line 2
|
address line 2 addressbook en Address Line 2
|
||||||
address type addressbook en Address Type
|
address type addressbook en Address Type
|
||||||
addressbook common en Addressbook
|
addressbook common en Addressbook
|
||||||
|
addressbook menu addressbook en Addressbook menu
|
||||||
addressbook preferences addressbook en Addressbook preferences
|
addressbook preferences addressbook en Addressbook preferences
|
||||||
addressbook the contact should be saved to addressbook en Addressbook the contact should be saved to
|
addressbook the contact should be saved to addressbook en Addressbook the contact should be saved to
|
||||||
addressbook-fieldname addressbook en Addressbook-Fieldname
|
addressbook-fieldname addressbook en Addressbook-Fieldname
|
||||||
@ -79,6 +80,7 @@ download export file (uncheck to debug output in browser) addressbook en Downloa
|
|||||||
download this contact as vcard file addressbook en download this contact as vCard file
|
download this contact as vcard file addressbook en download this contact as vCard file
|
||||||
edit custom field addressbook en Edit Custom Field
|
edit custom field addressbook en Edit Custom Field
|
||||||
edit custom fields admin en Edit Custom Fields
|
edit custom fields admin en Edit Custom Fields
|
||||||
|
edit extra account-data in the addressbook admin en Edit extra account-data in the addressbook
|
||||||
edit phonenumbers - addressbook en Edit Phonenumbers -
|
edit phonenumbers - addressbook en Edit Phonenumbers -
|
||||||
email & internet addressbook en Email & Internet
|
email & internet addressbook en Email & Internet
|
||||||
empty for all addressbook en empty for all
|
empty for all addressbook en empty for all
|
||||||
|
@ -19,16 +19,15 @@
|
|||||||
$setup_info['addressbook']['enable'] = 1;
|
$setup_info['addressbook']['enable'] = 1;
|
||||||
|
|
||||||
$setup_info['addressbook']['author'] = 'Ralf Becker, Cornelius Weiss, Lars Kneschke';
|
$setup_info['addressbook']['author'] = 'Ralf Becker, Cornelius Weiss, Lars Kneschke';
|
||||||
$setup_info['addressbook']['note'] = 'The phpgwapi manages contact data. Addressbook manages servers for its remote capability.';
|
// $setup_info['addressbook']['note'] = 'The phpgwapi manages contact data. Addressbook manages servers for its remote capability.';
|
||||||
$setup_info['addressbook']['license'] = 'GPL';
|
$setup_info['addressbook']['license'] = 'GPL';
|
||||||
$setup_info['addressbook']['description'] =
|
$setup_info['addressbook']['description'] =
|
||||||
'Contact manager with Vcard support.<br>
|
'Contact manager with Vcard support.<br />
|
||||||
Always have your address book available for updates or look ups from anywhere. <br>
|
Always have your address book available for updates or look ups from anywhere. <br />
|
||||||
Share address book contact information with others. <br>
|
Share address book contact information with others. <br />
|
||||||
Link contacts to calendar events or InfoLog entires like phonecalls.<br>
|
Link contacts to calendar events or InfoLog entires like phonecalls.<br />
|
||||||
Addressbook is the eGroupWare default contact application. <br>
|
Addressbook is the eGroupWare default contact application. <br />
|
||||||
It makes use of the eGroupWare contacts class to store and retrieve
|
It stores contact information via SQL or LDAP and provides contact services via the eGroupWare API.';
|
||||||
contact information via SQL or LDAP.';
|
|
||||||
|
|
||||||
$setup_info['addressbook']['maintainer'] = 'eGroupWare coreteam';
|
$setup_info['addressbook']['maintainer'] = 'eGroupWare coreteam';
|
||||||
$setup_info['addressbook']['maintainer_email'] = 'egroupware-developers@lists.sourceforge.net';
|
$setup_info['addressbook']['maintainer_email'] = 'egroupware-developers@lists.sourceforge.net';
|
||||||
|
@ -12,6 +12,15 @@
|
|||||||
|
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
|
$test[] = '1.0.0';
|
||||||
|
function addressbook_upgrade1_0_0()
|
||||||
|
{
|
||||||
|
$GLOBALS['egw_setup']->oProc->RenameTable('phpgw_addressbook','egw_addressbook');
|
||||||
|
$GLOBALS['egw_setup']->oProc->RenameTable('phpgw_addressbook_extra','egw_addressbook_extra');
|
||||||
|
|
||||||
|
return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.2';
|
||||||
|
}
|
||||||
|
|
||||||
$test[] = '1.2';
|
$test[] = '1.2';
|
||||||
function addressbook_upgrade1_2()
|
function addressbook_upgrade1_2()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user