[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [8974] API/Addressbook: contacts
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [8974] API/Addressbook: contacts |
Date: |
Tue, 13 Mar 2012 18:30:49 +0000 |
Revision: 8974
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8974
Author: sigurdne
Date: 2012-03-13 18:30:48 +0000 (Tue, 13 Mar 2012)
Log Message:
-----------
API/Addressbook: contacts
Modified Paths:
--------------
trunk/addressbook/inc/class.soaddressbook.inc.php
trunk/addressbook/inc/class.uiaddressbook.inc.php
trunk/phpgwapi/inc/accounts/class.accounts_.inc.php
trunk/phpgwapi/inc/accounts/class.accounts_sql.inc.php
trunk/phpgwapi/inc/class.account.inc.php
trunk/phpgwapi/inc/class.contacts_sql.inc.php
trunk/phpgwapi/inc/class.country.inc.php
trunk/phpgwapi/inc/class.sbox.inc.php
Modified: trunk/addressbook/inc/class.soaddressbook.inc.php
===================================================================
--- trunk/addressbook/inc/class.soaddressbook.inc.php 2012-03-12 18:35:59 UTC
(rev 8973)
+++ trunk/addressbook/inc/class.soaddressbook.inc.php 2012-03-13 18:30:48 UTC
(rev 8974)
@@ -402,6 +402,8 @@
function edit_person($person_id, $fields)
{
+ $fields['tab_address'] =
isset($fields['tab_address']['tmp_data']['addr']) ?
$fields['tab_address']['tmp_data']['addr'] : array();
+
$principal['owner'] = $fields['owner'];
$principal['access'] =
$fields['tab_person_data']['ispublic'];
$preferred_force_addr =
isset($fields['tab_address']['addr_preferred']) ?
$fields['tab_address']['addr_preferred'] : 0;
@@ -420,6 +422,10 @@
$principal['cat_id'] = $cats;
$person = array_merge($fields['tab_person_data'],
$fields['tab_extra']);
+// $person = array_merge($person, $fields['tab_address']);
+//_debug_array($person);
+//_debug_array($fields);die();
+
$orgs = $fields['edit_orgs'];
$orgs['preferred_org'] =
isset($fields['tab_orgs']['preferred_org']) ?
$fields['tab_orgs']['preferred_org'] : 0;
$queries = $fields['transactions'];
@@ -430,17 +436,17 @@
unset($fields['edit_orgs']);
unset($fields['tab_cats']);
unset($fields['old_my_orgs']);
- unset($fields['tab_address']);
+// unset($fields['tab_address']);
unset($fields['addr_data']);
unset($fields['transactions']);
//unset($fields['tab_comms']);
unset($fields['old_comm']);
- $this->contacts->edit_contact($person_id, $principal,
PHPGW_SQL_RUN_SQL);
- $this->contacts->edit_person($person_id, $person,
PHPGW_SQL_RUN_SQL);
+ $queries[] = $this->contacts->edit_contact($person_id,
$principal, PHPGW_SQL_RETURN_SQL);
+ $queries[] = $this->contacts->edit_person($person_id,
$person, PHPGW_SQL_RETURN_SQL);
foreach($orgs['delete'] as $org_id)
{
-
$this->contacts->delete_org_person_relation($org_id, $person_id,
PHPGW_SQL_RUN_SQL);
+ $queries[] =
$this->contacts->delete_org_person_relation($org_id, $person_id,
PHPGW_SQL_RETURN_SQL);
}
if($orgs['preferred_org'])
@@ -463,10 +469,10 @@
}
$data = array('my_preferred' => 'N');
- $this->contacts->edit_org_person_relation('',
$person_id, $data, PHPGW_SQL_RUN_SQL);
+ $queries[] =
$this->contacts->edit_org_person_relation('', $person_id, $data,
PHPGW_SQL_RETURN_SQL);
$data = array('my_preferred' => 'Y',
'my_addr_id' =>
$fields['preferred_address']);
-
$this->contacts->edit_org_person_relation($orgs['preferred_org'], $person_id,
$data, PHPGW_SQL_RUN_SQL);
+ $queries[] =
$this->contacts->edit_org_person_relation($orgs['preferred_org'], $person_id,
$data, PHPGW_SQL_RETURN_SQL);
}
$comm_preferred = $fields['tab_comms']['preferred'];
@@ -482,24 +488,30 @@
$fields['edit_others']['delete'],
$fields['edit_others']['edit'],
$fields['tab_others']['other_value'], $person_id);
-
- $this->execute_queries($queries);
-
+
if($preferred_force_addr && $preferred_force_addr!='')
- {
- $preferred_force_addr =
$this->get_preferred_location($person_id, $preferred_force_addr);
+ {
+ $preferred_force_addr =
$this->get_preferred_location($person_id, $preferred_force_addr);
- $this->contacts->edit_location_by_contact(
- $person_id,
- array('addr_preferred' => 'N'),
- PHPGW_SQL_RUN_SQL);
+ $queries[] =
$this->contacts->edit_location_by_contact(
+ $person_id,
+ array('addr_preferred' => 'N'),
+ PHPGW_SQL_RETURN_SQL);
- $this->contacts->edit_location(
+
+ $queries[] = $this->contacts->edit_location(
$preferred_force_addr,
- array('addr_preferred' => 'Y'),
- PHPGW_SQL_RUN_SQL);
- }
-
+ $fields['tab_address'],
+ //array('addr_preferred' => 'Y'),
+ PHPGW_SQL_RETURN_SQL);
+ }
+ else
+ {
+//_debug_array($fields['tab_address']);die();
+ $queries[] =
$this->add_location($fields['tab_address'], $person_id, PHPGW_SQL_RETURN_SQL);
+ }
+//_debug_array($queries);die();
+ $this->execute_queries($queries);
/* Update the first and last name in accounts */
if($fields['tab_person_data'])
{
@@ -516,6 +528,8 @@
}
$this->contacts->finalize_edit($person_id);
+
+
}
function edit_org($org_id, $fields)
@@ -566,27 +580,27 @@
$this->execute_queries($queries);
if($preferred_force_addr && $preferred_force_addr!='')
- {
- $preferred_force_addr =
$this->get_preferred_location($org_id, $preferred_force_addr);
+ {
+ $preferred_force_addr =
$this->get_preferred_location($org_id, $preferred_force_addr);
- $this->contacts->edit_location_by_contact(
+ $this->contacts->edit_location_by_contact(
$org_id,
array('addr_preferred' => 'N'),
PHPGW_SQL_RUN_SQL);
- $this->contacts->edit_location(
+ $this->contacts->edit_location(
$preferred_force_addr,
array('addr_preferred' => 'Y'),
PHPGW_SQL_RUN_SQL);
- }
+ }
}
function get_preferred_location($contact_id, $preferred_forced)
- {
- $addr_tmp =
$this->contacts->get_addr_contact_data($contact_id);
- if(is_array($addr_tmp))
- {
- foreach($addr_tmp as $data)
+ {
+ $addr_tmp =
$this->contacts->get_addr_contact_data($contact_id);
+ if(is_array($addr_tmp))
+ {
+ foreach($addr_tmp as $data)
{
if($preferred_forced==$data['key_addr_id'])
{
@@ -597,11 +611,11 @@
$locations[$data['key_addr_id']] = $data;
}
}
- }
- ksort($locations);
- end($locations);
- return key($locations);
- }
+ }
+ ksort($locations);
+ end($locations);
+ return key($locations);
+ }
/**
* This function call to edit_location from contact object
@@ -934,7 +948,7 @@
$this->add_communication_media($fields,
$contact_id, PHPGW_SQL_RUN_SQL);
}
- $this->unlock();
+// $this->unlock();
}
function upgrade_others($add_others=array(),
$del_others=array(), $edit_others=array(), $data=array(), $contact_id)
@@ -967,7 +981,7 @@
$this->add_others($fields, $contact_id,
PHPGW_SQL_RUN_SQL);
}
- $this->unlock();
+// $this->unlock();
}
/**
Modified: trunk/addressbook/inc/class.uiaddressbook.inc.php
===================================================================
--- trunk/addressbook/inc/class.uiaddressbook.inc.php 2012-03-12 18:35:59 UTC
(rev 8973)
+++ trunk/addressbook/inc/class.uiaddressbook.inc.php 2012-03-13 18:30:48 UTC
(rev 8974)
@@ -1389,23 +1389,19 @@
*/
function address_form($fields)
{
+ $this->form_start();
+
+ $addresstype='<select name="entry[tmp_data][addr][addr_type]">'
+ .
$this->get_addr_type($fields['tmp_data']['addr']['addr_type']) . '</select>';
+ $addr_preferred = '<input type="hidden"
name="entry[tmp_data][addr][addr_preferred]" value="'
+ .$fields['tmp_data']['addr']['addr_preferred'].'">';
+
+
if ( isset($fields['tmp_data']['addr'])
&& is_array($fields['tmp_data']['addr'])
&& isset($fields['tmp_data']['addr']['addr_add1']) )
{
- echo '<pre>' . print_r($fields['tmp_data']['addr'],
true) . '</pre>';
- $this->set_form_fields(array
- (
- 1 => array('Address 1',
'entry[tmp_data][addr][addr_add1]', $fields['tmp_data']['addr']['addr_add1']),
- 2 => array('Address 2',
'entry[tmp_data][addr][addr_add2]', $fields['tmp_data']['addr']['addr_add2']),
- 3 => array('City',
'entry[tmp_data][addr][addr_city]', $fields['tmp_data']['addr']['addr_city']),
- 4 => array('State',
'entry[tmp_data][addr][addr_state]', $fields['tmp_data']['addr']['addr_state']),
- 5 => array('Postal Code',
'entry[tmp_data][addr][addr_postal_code]',
$fields['tmp_data']['addr']['addr_postal_code']),
- 6 => array('Country',
'entry[tmp_data][addr][addr_country]',
$fields['tmp_data']['addr']['addr_country']),
- 7 => array(lang('Type'), $addresstype,
'special'),
- 8 => array('', $addr_preferred, 'special')
- ));
-
+// echo '<pre>' . print_r($fields['tmp_data']['addr'],
true) . '</pre>';
if ( isset($fields['addr_preferred']) &&
isset($this->array_data[$fields['addr_preferred']]) )
{
$this->array_data[$fields['addr_preferred']]['addr_preferred'] = 'Y';
@@ -1428,16 +1424,22 @@
);
}
- $addresstype='<select name="entry[tmp_data][addr][addr_type]">'
- .
$this->get_addr_type($fields['tmp_data']['addr']['addr_type']) . '</select>';
- $addr_preferred = '<input type="hidden"
name="entry[tmp_data][addr][addr_preferred]" value="'
- .$fields['tmp_data']['addr']['addr_preferred'].'">';
+ $this->set_form_fields(array
+ (
+ 1 => array('Address 1',
'entry[tmp_data][addr][addr_add1]', $fields['tmp_data']['addr']['addr_add1']),
+ 2 => array('Address 2',
'entry[tmp_data][addr][addr_add2]', $fields['tmp_data']['addr']['addr_add2']),
+ 3 => array('City', 'entry[tmp_data][addr][addr_city]',
$fields['tmp_data']['addr']['addr_city']),
+ 4 => array('State',
'entry[tmp_data][addr][addr_state]', $fields['tmp_data']['addr']['addr_state']),
+ 5 => array('Postal Code',
'entry[tmp_data][addr][addr_postal_code]',
$fields['tmp_data']['addr']['addr_postal_code']),
+ 6 => array('Country',
'entry[tmp_data][addr][addr_country]',
$fields['tmp_data']['addr']['addr_country']),
+ 7 => array('Type', $addresstype, 'special'),
+ 8 => array('', $addr_preferred, 'special')
+ ));
$key_addr_id_name = 'entry[tmp_data][addr][key_addr_id]';
$key_addr_id = $fields['tmp_data']['addr']['key_addr_id'];
- $this->form_start();
$this->template->set_var('lang_general_data', lang('Address
Data for').' '.$this->record_name);
@@ -1454,12 +1456,12 @@
'link1' => array('type' => 'link', 'mode' => 'edit',
'key' => 'key_addr_id', 'action'=> 'addr_edit_row', 'extra' => array('owner'
=> $this->owner, 'ab_id' => $this->contact_id, 'record_name' =>
$this->record_name) ),
'link2' => array('type' => 'link', 'mode' =>
'delete', 'key' => 'key_addr_id', 'action'=> 'addr_del_row', 'extra' =>
array('owner' => $this->owner, 'ab_id' => $this->contact_id, 'record_name' =>
$this->record_name))
);
- $this->array_data = $this->read_tab_session('addr_data');
+// $this->array_data = $this->read_tab_session('addr_data');
//var_export($fields);
//var_export($this->array_data);
- $this->template->set_var('detail_fields',
- $this->get_detail_form('address', array('Type',
'Address', 'Preferred', 'Edit','Delete'), 'array_data', $types_data,
'key_addr_id'));
+// $this->template->set_var('detail_fields',
+// $this->get_detail_form('address', array('Type',
'Address', 'Preferred', 'Edit','Delete'), 'array_data', $types_data,
'key_addr_id'));
return $this->template->fp('out', 'tab_body_general_data');
}
@@ -3232,13 +3234,13 @@
{
if ($col==1)
{
- $this->template->set_var('field_name_one',
lang($field_name));
+ $this->template->set_var('field_name_one', $field_name
? lang($field_name) : '');
$this->template->set_var('input_name_one', $input_name);
$this->template->set_var('input_value_one',
$input_value);
}
else
{
- $this->template->set_var('field_name_two',
lang($field_name));
+ $this->template->set_var('field_name_two', $field_name
? lang($field_name) : '');
$this->template->set_var('input_name_two', $input_name);
$this->template->set_var('input_value_two',
$input_value);
}
@@ -3248,12 +3250,12 @@
{
if ($col==1)
{
- $this->template->set_var('field_other_name1',
lang($field_name));
+ $this->template->set_var('field_other_name1',
$field_name ? lang($field_name) : '');
$this->template->set_var('value_other_name1',
$field_value);
}
else
{
- $this->template->set_var('field_other_name2',
lang($field_name));
+ $this->template->set_var('field_other_name2',
$field_name ? lang($field_name) : '');
$this->template->set_var('value_other_name2',
$field_value);
}
}
Modified: trunk/phpgwapi/inc/accounts/class.accounts_.inc.php
===================================================================
--- trunk/phpgwapi/inc/accounts/class.accounts_.inc.php 2012-03-12 18:35:59 UTC
(rev 8973)
+++ trunk/phpgwapi/inc/accounts/class.accounts_.inc.php 2012-03-13 18:30:48 UTC
(rev 8974)
@@ -45,7 +45,7 @@
/**
* @var object $account the currently selected user object
*/
- protected $account;
+ public $account;
/**
* @var integer $account_id track the current account_id -
which may not match the this->account->id
@@ -231,7 +231,7 @@
*
* @return void
*/
- abstract protected function read_repository();
+ abstract public function read_repository();
/**
* Save/update account information to database
@@ -263,7 +263,7 @@
{
if ($expiredate)
{
- $expires = (int) $expiry;
+ $expires = (int) $expiredate;
}
else if (
isset($GLOBALS['phpgw_info']['server']['auto_create_expire']) )
{
Modified: trunk/phpgwapi/inc/accounts/class.accounts_sql.inc.php
===================================================================
--- trunk/phpgwapi/inc/accounts/class.accounts_sql.inc.php 2012-03-12
18:35:59 UTC (rev 8973)
+++ trunk/phpgwapi/inc/accounts/class.accounts_sql.inc.php 2012-03-13
18:30:48 UTC (rev 8974)
@@ -738,7 +738,7 @@
*
* @return object phpgwapi_account derived object containing
account data
*/
- protected function read_repository()
+ public function read_repository()
{
$this->account = $this->get($this->account_id, false);
return $this->account;
Modified: trunk/phpgwapi/inc/class.account.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.account.inc.php 2012-03-12 18:35:59 UTC (rev
8973)
+++ trunk/phpgwapi/inc/class.account.inc.php 2012-03-13 18:30:48 UTC (rev
8974)
@@ -477,7 +477,8 @@
public function toArray()
{
$array = $this->_data;
- unset($array['passwd'], $array['passwd_hash']);
+ // unset($array['passwd'], $array['passwd_hash']);
+ unset($array['passwd']);
return $array;
}
Modified: trunk/phpgwapi/inc/class.contacts_sql.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.contacts_sql.inc.php 2012-03-12 18:35:59 UTC
(rev 8973)
+++ trunk/phpgwapi/inc/class.contacts_sql.inc.php 2012-03-13 18:30:48 UTC
(rev 8974)
@@ -2648,11 +2648,11 @@
{
if ( $this->db->get_transaction() )
{
- $this->global_lock = true;
+// $this->global_lock = true;
}
else
{
-
$this->lock_table($this->location->table, '', true);
+//
$this->lock_table($this->location->table, '', true);
}
}
if(count($addr[0]) == 0)
Modified: trunk/phpgwapi/inc/class.country.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.country.inc.php 2012-03-12 18:35:59 UTC (rev
8973)
+++ trunk/phpgwapi/inc/class.country.inc.php 2012-03-13 18:30:48 UTC (rev
8974)
@@ -304,7 +304,7 @@
{
$translated = $name;
}
- $translated_list[$code] = $translated;
+ $translated_list[$code] =
ltrim($translated,'!');
}
asort($translated_list);
}
Modified: trunk/phpgwapi/inc/class.sbox.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.sbox.inc.php 2012-03-12 18:35:59 UTC (rev
8973)
+++ trunk/phpgwapi/inc/class.sbox.inc.php 2012-03-13 18:30:48 UTC (rev
8974)
@@ -11,6 +11,7 @@
*/
phpgw::import_class('phpgwapi.datetime');
+ phpgw::import_class('phpgwapi.country');
/**
* Class for creating predefines select boxes
@@ -420,7 +421,7 @@
}
$selected = trim($selected);
- $slctd = !$selected ? '' : ' selected';
+ $slctd = $selected ? '' : ' selected';
$lang_select1 = lang('Select One');
$select = <<<HTML
<select name="{$name}">
@@ -429,7 +430,7 @@
HTML;
foreach ( phpgwapi_country::get_translated_list() as
$code => $country )
{
- $slctd = $code == $selected ? '' : ' selected';
+ $slctd = $code == $selected ? ' selected' : '' ;
$select .= <<<HTML
<option
value="{$code}"{$slctd}>{$country}</option>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [8974] API/Addressbook: contacts,
Sigurd Nes <=