fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [9104] reg


From: Sigurd Nes
Subject: [Fmsystem-commits] [9104] reg
Date: Wed, 04 Apr 2012 09:47:48 +0000

Revision: 9104
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9104
Author:   sigurdne
Date:     2012-04-04 09:47:47 +0000 (Wed, 04 Apr 2012)
Log Message:
-----------
reg

Modified Paths:
--------------
    trunk/property/inc/class.hook_helper.inc.php
    trunk/registration/inc/class.bopending.inc.php
    trunk/registration/inc/class.soreg.inc.php
    trunk/registration/inc/class.uipending.inc.php
    trunk/registration/templates/base/user_edit.xsl

Modified: trunk/property/inc/class.hook_helper.inc.php
===================================================================
--- trunk/property/inc/class.hook_helper.inc.php        2012-04-04 09:23:01 UTC 
(rev 9103)
+++ trunk/property/inc/class.hook_helper.inc.php        2012-04-04 09:47:47 UTC 
(rev 9104)
@@ -52,6 +52,12 @@
                 */
                public function add_location_contact($data)
                {
+                       if(!isset($data['location_code']) || 
!$data['location_code'])
+                       {
+                               phpgwapi_cache::message_set("location_code not 
set", 'error');
+                               return false;
+                       }
+
                        $value_set = array();
                        $value_set['location_code'] = $data['location_code'];
                        $value_set['contact_id'] = $data['contact_id'];
@@ -60,7 +66,7 @@
                        $value_set['modified_date'] = time();
                        
                        $cols = implode(',', array_keys($value_set));
-                       $values = 
$GLOBALS['phpgw_setup']->oProc->validate_insert(array_values($value_set));
+                       $values = 
$GLOBALS['phpgw']->db->validate_insert(array_values($value_set));
                        $sql = "INSERT INTO fm_location_contact ({$cols}) 
VALUES ({$values})";
                        $GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__);
 

Modified: trunk/registration/inc/class.bopending.inc.php
===================================================================
--- trunk/registration/inc/class.bopending.inc.php      2012-04-04 09:23:01 UTC 
(rev 9103)
+++ trunk/registration/inc/class.bopending.inc.php      2012-04-04 09:47:47 UTC 
(rev 9104)
@@ -238,6 +238,7 @@
 
                function process_users($data)
                {
+
                        $so = createobject('registration.soreg');
                        $ui = createobject('registration.uireg');
 
@@ -249,7 +250,7 @@
                                        $process_approval[] = $reg_id;
                                }
                        }
-
+//_debug_array($process_approval);die();
                        unset($reg_id);
                        
                        $url = $GLOBALS['phpgw']->link('/login.php',array( 
'logindomain' => $GLOBALS['phpgw_info']['user']['domain']),false,true);
@@ -306,7 +307,7 @@
                                        {
                                                
phpgwapi_cache::message_set("Confirmation sent to {$info['email']}", 'message');
                                        }
-                       //              $so->delete_reg_info($reg_id);
+                                       $so->delete_reg_info($reg_id);
                                }
                        }
                }

Modified: trunk/registration/inc/class.soreg.inc.php
===================================================================
--- trunk/registration/inc/class.soreg.inc.php  2012-04-04 09:23:01 UTC (rev 
9103)
+++ trunk/registration/inc/class.soreg.inc.php  2012-04-04 09:47:47 UTC (rev 
9104)
@@ -248,45 +248,13 @@
                        
                        $group_id =  $default_group_id ? $default_group_id : 
$GLOBALS['phpgw']->accounts->name2id('default');
 
-                       if (!$GLOBALS['phpgw']->accounts->exists($account_lid) )
-                       {       
-                               $account                        = new 
phpgwapi_user();
-                               $account->lid           = $account_lid;
-                               $account->firstname     = $fields['n_given'];
-                               $account->lastname      = $fields['n_family'];
-                               $account->passwd        = $fields['passwd'];
-                               $account->enabled       = true;
-
-                               if ($this->config['trial_accounts'])
-                               {
-                                       $account->expires = time() + ((60 * 60) 
* ($this->config['days_until_trial_account_expires'] * 24));
-                               }
-                               else
-                               {
-                                       $account->expires = -1;
-                               }
-
-                               $account_id =  
$GLOBALS['phpgw']->accounts->create($account, array($group_id), array(), 
array());
-                               if($account_id)
-                               {
-                                       
$GLOBALS['phpgw']->log->write(array('text'=>'I-Notification, user created 
%1','p1'=> $account_lid));
-                               }
-                       }
-
-                       if (!$account_id)
-                       {
-                               return false;
-                       }
-
                        $contacts   = createobject('phpgwapi.contacts');
 
-                       $GLOBALS['phpgw']->db->transaction_begin();
-
                        $primary = array
                        (
-       //                      'per_prefix'            => 'Mr',
-       //                      'per_title'                     => 
'FDV-RÃ¥dgiver',
-       //                      'per_department'        => 'Utbygging',
+       //                      'per_prefix'            => '',
+       //                      'per_title'                     => '',
+       //                      'per_department'        => '',
                                'per_first_name'        => $account->firstname,
                                'per_last_name'         => $account->lastname,
                                'access'                        => 'public',
@@ -308,12 +276,11 @@
                                'addr_postal_code'      => 
$fields['adr_one_postalcode'],
                                'addr_country'          => 
$fields['adr_one_countryname'],
                                'addr_preferred'        => 'Y',
-               //              'addr_description'      => 'Heime'
+               //              'addr_description'      => 'office'
                        );
                                
                        $locations = array($location);
 
-
                        $type = $contacts->search_contact_type('Persons');
 
                        $comm1 = array
@@ -331,24 +298,49 @@
                        );
 
                        $comms = array($comm1,$comm2);
-/*
-_debug_array($type);
-_debug_array($primary);
-_debug_array($comms);
-_debug_array($locations);
-*/
-                       $person_id = $contacts->add_contact($type, $primary, 
$comms, $locations);
 
-                       $GLOBALS['phpgw']->db->transaction_commit();
-                       $GLOBALS['phpgw']->accounts->set_account($account_id);
-                       $GLOBALS['phpgw']->accounts->read_repository();
 
-                       $account = 
$GLOBALS['phpgw']->accounts->get($account_id);
-                       $account->person_id = $person_id;
-                       
-                       $GLOBALS['phpgw']->accounts->account = $account;
-                       $GLOBALS['phpgw']->accounts->save_repository();
+                       $contact_data = array
+                       (
+                               'type'          => $type,
+                               'primary'       => $primary,
+                               'comms'         => $comms,
+                               'locations'     => $locations   
+                       );
 
+                       if (!$GLOBALS['phpgw']->accounts->exists($account_lid) )
+                       {       
+                               $GLOBALS['phpgw']->db->transaction_begin();
+
+                               $account                        = new 
phpgwapi_user();
+                               $account->lid           = $account_lid;
+                               $account->firstname     = $fields['n_given'];
+                               $account->lastname      = $fields['n_family'];
+                               $account->passwd        = $fields['passwd'];
+                               $account->enabled       = true;
+
+                               if ($this->config['trial_accounts'])
+                               {
+                                       $account->expires = time() + ((60 * 60) 
* ($this->config['days_until_trial_account_expires'] * 24));
+                               }
+                               else
+                               {
+                                       $account->expires = -1;
+                               }
+
+                               $account_id =  
$GLOBALS['phpgw']->accounts->create($account, array($group_id), array(), 
array(), $contact_data);
+                               if($account_id)
+                               {
+                                       
$GLOBALS['phpgw']->log->write(array('text'=>'I-Notification, user created 
%1','p1'=> $account_lid));
+                               }
+                       }
+
+                       if (!$account_id)
+                       {
+                               phpgwapi_cache::message_set("User 
{$account_lid} already exist", 'error');
+                               return false;
+                       }
+
                        if(isset($this->config['messenger_welcome_message']) && 
$this->config['messenger_welcome_message'])
                        {
                                $args = array
@@ -365,14 +357,15 @@
                        {
                                $args = array
                                (
-                                       'location'      => 
'add_location_contact',
+                                       'location'      => 'registration',
                                        'location_code' => 
$fields['location_code'],
-                                       'contact_id'    => $person_id,
+                                       'contact_id'    => 
$GLOBALS['phpgw']->accounts->get($account_id)->person_id,
                                        'account_lid'   => $account_lid
                                );
 
                                $GLOBALS['phpgw']->hooks->single($args, 
'property');
                        }
+                       $GLOBALS['phpgw']->db->transaction_commit();
 
                        return $account_id;
                }

Modified: trunk/registration/inc/class.uipending.inc.php
===================================================================
--- trunk/registration/inc/class.uipending.inc.php      2012-04-04 09:23:01 UTC 
(rev 9103)
+++ trunk/registration/inc/class.uipending.inc.php      2012-04-04 09:47:47 UTC 
(rev 9104)
@@ -219,6 +219,7 @@
 //_debug_array($values);die();
                                if($this->bo->update_pending_user($values))
                                {
+                                       $this->bo->process_users($values);
                                        $message = lang('messages_saved_form');
                                        phpgwapi_cache::message_set($message, 
'message');
                                }

Modified: trunk/registration/templates/base/user_edit.xsl
===================================================================
--- trunk/registration/templates/base/user_edit.xsl     2012-04-04 09:23:01 UTC 
(rev 9103)
+++ trunk/registration/templates/base/user_edit.xsl     2012-04-04 09:47:47 UTC 
(rev 9104)
@@ -48,7 +48,7 @@
                                                        <xsl:value-of 
select="php:function('lang', 'process')" />
                                                </td>
                                                <td>
-                                                       <input type="checkbox" 
name="values[process]" value="1">
+                                                       <input type="checkbox" 
name="values[pending_users][]" value="{value_id}">
                                                                <xsl:attribute 
name="title">
                                                                        
<xsl:value-of select="php:function('lang', 'process approved')"/>
                                                                </xsl:attribute>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]