Changeset 3299


Ignore:
Timestamp:
09/28/10 14:25:33 (14 years ago)
Author:
niltonneto
Message:

Ticket #566 - Implementada opção para editar e bloquear fone residencial (homePhone).

Location:
branches/2.2
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/expressoAdmin1_2/inc/class.functions.inc.php

    r3251 r3299  
    855855                        // Com restrição apenas na edição do Tel. Celular               => $acl=2; 
    856856                        // Com restrição na edição do Tel. Comercial e Celular  => $acl=3;                       
     857                        // Com restricao apenas na edicao do Tel. Residencial   => $acl=4; 
     858                        // .... 
     859                        // Com restricao de edição em todos os campos pessoais  => $acl=7; 
    857860                         
    858861                        $personal_data_fields = array(   
    859862                                        array("text" => lang("%1 telephone number", lang("Commercial")) , "acl" => 1), 
    860                                         array("text" => lang("%1 telephone number", lang("Mobile"))             , "acl" => 2)); 
     863                                        array("text" => lang("%1 telephone number", lang("Mobile"))             , "acl" => 2), 
     864                                        array("text" => lang("%1 telephone number", lang("Home"))               , "acl" => 4)); 
    861865                        $list_personal_data = "<tr>"; 
    862866                                                 
  • branches/2.2/phpgwapi/inc/class.accounts_ldap.inc.php

    r3234 r3299  
    6363                        { 
    6464                                /* jakjr: using justthese with ldap_search */ 
    65                                 $justthese = array("uidnumber", "gidnumber", "uid", "cn", "givenname", "sn", "mail", "phpgwaccountstatus", "phpgwaccountexpires", "phpgwaccounttype", "phpgwlastpasswdchange","phpgwagreeterm","telephonenumber","mobile"); 
     65                                $justthese = array("uidnumber", "gidnumber", "uid", "cn", "givenname", "sn", "mail", "phpgwaccountstatus", "phpgwaccountexpires", "phpgwaccounttype", "phpgwlastpasswdchange","phpgwagreeterm","telephonenumber","mobile","homephone"); 
    6666                                $sri = @ldap_search($this->ds, $this->user_context, ("(&(uidnumber=" . (int)$this->account_id.")(phpgwaccounttype=u))"), $justthese); 
    6767                        } 
     
    9191                                $this->data['telephonenumber']   = $allValues[0]['telephonenumber'][0]; 
    9292                                $this->data['mobile']   = $allValues[0]['mobile'][0]; 
     93                                $this->data['homephone']   = $allValues[0]['homephone'][0];                              
    9394                                /* jakjr: this is not used for expressoLivre */ 
    9495                                /* 
  • branches/2.2/preferences/changepersonaldata.php

    r3234 r3299  
    4242        lang('Observation') . ': ' . lang('This telephone number will apear in searches for your name, and it will be visible for all ExpressoLivre Users') . '.'); 
    4343        $GLOBALS['phpgw']->template->set_var('lang_mobile_telephonenumber',lang('%1 telephone number',lang('Mobile'))); 
     44        $GLOBALS['phpgw']->template->set_var('lang_homephone_telephonenumber',lang('%1 telephone number',lang('Home'))); 
    4445        $GLOBALS['phpgw']->template->set_var('lang_change',lang('Change')); 
    4546        $GLOBALS['phpgw']->template->set_var('lang_cancel',lang('Cancel')); 
     
    4849        /* Get telephone number from ldap or from post */ 
    4950        $ldap_conn = $GLOBALS['phpgw']->common->ldapConnect(); 
    50         $result = ldap_search($ldap_conn, $GLOBALS['phpgw_info']['server']['ldap_context'], 'uid='.$GLOBALS['phpgw_info']['user']['account_lid'], array('telephonenumber','mobile')); 
     51        $result = ldap_search($ldap_conn, $GLOBALS['phpgw_info']['server']['ldap_context'], 'uid='.$GLOBALS['phpgw_info']['user']['account_lid'], array('telephonenumber','mobile','homephone')); 
    5152        $entrie = ldap_get_entries($ldap_conn, $result); 
    5253 
     
    5455        $disabledTelephoneNumber = false; 
    5556        $disabledMobile = false; 
    56           
     57        $disabledHomePhone = false; 
    5758        if ($GLOBALS['phpgw']->acl->check('blockpersonaldata',1)) { 
    5859                $disabledTelephoneNumber = '"disabled=true"'; 
     
    6162                $disabledMobile = '"disabled=true"'; 
    6263        } 
     64        if ($GLOBALS['phpgw']->acl->check('blockpersonaldata',4)) { 
     65                $disabledHomePhone = '"disabled=true"'; 
     66        } 
    6367        /* END ACL Check for Personal Data Fields.*/ 
    6468         
    6569        $GLOBALS['phpgw']->template->set_var('telephonenumber',($_POST['telephonenumber'] ? $_POST['telephonenumber'] : $entrie[0]['telephonenumber'][0]).$disabledTelephoneNumber); 
    6670        $GLOBALS['phpgw']->template->set_var('mobile',($_POST['mobile'] ? $_POST['mobile'] : $entrie[0]['mobile'][0]).$disabledMobile); 
     71        $GLOBALS['phpgw']->template->set_var('homephone',($_POST['homephone'] ? $_POST['homephone'] : $entrie[0]['homephone'][0]).$disabledHomePhone); 
     72         
    6773 
    6874        ldap_close($ldap_conn); 
     
    7581        if ($_POST['change']) 
    7682        { 
    77                 if ($_POST['telephonenumber'] != $GLOBALS['phpgw_info']['user']['telephonenumber'] || $_POST['mobile'] != $GLOBALS['phpgw_info']['user']['mobile']) 
     83                if ($_POST['telephonenumber'] != $GLOBALS['phpgw_info']['user']['telephonenumber'] || $_POST['mobile'] != $GLOBALS['phpgw_info']['user']['mobile'] 
     84                 || $_POST['homephone'] != $GLOBALS['phpgw_info']['user']['homephone']) 
    7885                { 
    7986                        $pattern = '/\([0-9]{2,3}\)[0-9]{4}-[0-9]{4}$/'; 
     
    8592                        { 
    8693                                $errors[] = lang('Format of %1 telephone number is invalid.', lang("Mobile")); 
     94                        } 
     95                        if ((strlen($_POST['homephone']) != 0) && (!preg_match($pattern, $_POST['homephone']))) 
     96                        { 
     97                                $errors[] = lang('Format of %1 telephone number is invalid.', lang("Home")); 
    8798                        } 
    8899                        if(!is_array($errors)) 
     
    132143                                                $result = @ldap_mod_replace($ldap_conn, $GLOBALS['phpgw_info']['user']['account_dn'], $info); 
    133144                                        } 
     145                                        unset($info['mobile']); 
     146                                } 
     147                                if (!$disabledHomePhone && ($_POST['homephone'] != $GLOBALS['phpgw_info']['user']['homephone'])) { 
     148                                        if (strlen($_POST['homephone']) == 0) { 
     149                                                $info['homephone'] = $GLOBALS['phpgw_info']['user']['homephone']; 
     150                                                $result = @ldap_mod_del($ldap_conn, $GLOBALS['phpgw_info']['user']['account_dn'], $info); 
     151                                        } 
     152                                        elseif(strlen($GLOBALS['phpgw_info']['user']['homephone']) == 0) { 
     153                                                $info['homephone'] = $_POST['homephone']; 
     154                                                $result = @ldap_mod_add($ldap_conn, $GLOBALS['phpgw_info']['user']['account_dn'], $info); 
     155                                        } 
     156                                        else { 
     157                                                $info['homephone'] = $_POST['homephone']; 
     158                                                $result = @ldap_mod_replace($ldap_conn, $GLOBALS['phpgw_info']['user']['account_dn'], $info); 
     159                                        } 
     160                                        unset($info['homephone']); 
    134161                                } 
    135162                                ldap_close($ldap_conn);  
  • branches/2.2/preferences/templates/default/changepersonaldata.tpl

    r3234 r3299  
    2828     </tr> 
    2929     <tr> 
     30       <td> 
     31        {lang_homephone_telephonenumber}: 
     32       </td> 
     33       <td> 
     34        <input type="input" autocomplete="off" name="homephone" size=12 value="{homephone}" maxlength="13" onkeyUp="FormatTelephoneNumber(event, this);">&nbsp;(xx)xxxx-xxxx 
     35       </td> 
     36     </tr> 
     37        <tr><td colspan=2 height="20px"></td></tr> 
     38      
     39     <tr> 
    3040       <td colspan="3"> 
    3141        <table cellspacing="0"><tr><br> 
Note: See TracChangeset for help on using the changeset viewer.