fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [6538] Rental: Added delegate functionality for backe


From: Joakim Hop
Subject: [Fmsystem-commits] [6538] Rental: Added delegate functionality for backend users
Date: Thu, 04 Nov 2010 07:15:45 +0000

Revision: 6538
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6538
Author:   joakim_hop
Date:     2010-11-04 07:15:45 +0000 (Thu, 04 Nov 2010)
Log Message:
-----------
Rental: Added delegate functionality for backend users

Modified Paths:
--------------
    trunk/rental/inc/class.bofellesdata.inc.php
    trunk/rental/inc/class.uidelegate.inc.php
    trunk/rental/inc/class.uiresultunit.inc.php
    trunk/rental/templates/base/delegate_list.php
    trunk/rental/templates/base/resultunit.php
    trunk/rental/templates/base/resultunit_list_partial.php

Modified: trunk/rental/inc/class.bofellesdata.inc.php
===================================================================
--- trunk/rental/inc/class.bofellesdata.inc.php 2010-11-03 14:34:48 UTC (rev 
6537)
+++ trunk/rental/inc/class.bofellesdata.inc.php 2010-11-04 07:15:45 UTC (rev 
6538)
@@ -157,19 +157,55 @@
                        return $result_units;
                }
                
-               public function get_result_units_with_leader($search_for, 
$search_type)
+               public function get_result_unit_with_leader($org_unit_id)
                {
+                       $columns = "V_ORG_ENHET.ORG_ENHET_ID, 
V_ORG_ENHET.ORG_NAVN, V_ORG_PERSON.FORNAVN, V_ORG_PERSON.ETTERNAVN, 
V_ORG_PERSON.BRUKERNAVN";
+                       $tables = "V_ORG_ENHET";
+                       $joins =        "LEFT JOIN V_ORG_PERSON_ENHET ON 
(V_ORG_ENHET.ORG_ENHET_ID = V_ORG_PERSON_ENHET.ORG_ENHET_ID AND 
V_ORG_PERSON_ENHET.prioritet = 1) ".
+                                               "LEFT JOIN V_ORG_PERSON ON 
(V_ORG_PERSON.ORG_PERSON_ID = V_ORG_PERSON_ENHET.ORG_PERSON_ID)";
+                       $sql = "SELECT $columns FROM $tables $joins WHERE 
V_ORG_ENHET.ORG_NIVAA = 4 AND V_ORG_ENHET.ORG_ENHET_ID = {$org_unit_id}";
+                       $db = $this->get_db();
+                       $db->query($sql,__LINE__,__FILE__);
+               
+                       if($db->next_record())
+                       {
+                               $full_name = $db->f('FORNAVN')." 
".$db->f('ETTERNAVN');
+                               
+                               return array(
+                                               "ORG_UNIT_ID" => 
(int)$db->f('ORG_ENHET_ID'),
+                                               "ORG_UNIT_NAME" => 
$db->f('ORG_NAVN'),
+                                               "LEADER_FIRSTNAME" => 
$db->f('FORNAVN'),
+                                               "LEADER_LASTNAME" => 
$db->f('ETTERNAVN'),
+                                               "LEADER_FULLNAME" => $full_name,
+                                               "LEADER_USERNAME" => 
$db->f('BRUKERNAVN')
+                                       );
+                       }
+               }
+               
+               public function get_result_units_with_leader($start_index, 
$num_of_objects, $sort_field, $sort_ascending,$search_for, $search_type)
+               {
                        
                        $columns = "V_ORG_ENHET.ORG_ENHET_ID, 
V_ORG_ENHET.ORG_NAVN, V_ORG_PERSON.FORNAVN, V_ORG_PERSON.ETTERNAVN, 
V_ORG_PERSON.BRUKERNAVN";
-                       $tables = "V_ORG_ENHET, V_ORG_PERSON";
-                       $joins =        "LEFT JOIN V_ORG_PERSON_ENHET ON 
(V_ORG_PERSON_ENHET.ORG_ENHET_ID = V_ORG_ENHET.ORG_ENHET_ID) ".
-                                       "LEFT JOIN V_ORG_PERSON ON 
(V_ORG_PERSON.ORG_PERSON_ID = V_ORG_PERSON_ENHET.ORG_PERSON_ID)";
+                       $tables = "V_ORG_ENHET";
+                       $joins =        "LEFT JOIN V_ORG_PERSON_ENHET ON 
(V_ORG_ENHET.ORG_ENHET_ID = V_ORG_PERSON_ENHET.ORG_ENHET_ID AND 
V_ORG_PERSON_ENHET.prioritet = 1) ".
+                                               "LEFT JOIN V_ORG_PERSON ON 
(V_ORG_PERSON.ORG_PERSON_ID = V_ORG_PERSON_ENHET.ORG_PERSON_ID)";
                        $sql = "SELECT $columns FROM $tables $joins WHERE 
V_ORG_ENHET.ORG_NIVAA = 4";
                        if($search_for){
                                $selector = "";
                                switch($search_type){
                                        case 'unit_leader':
-                                                       $selector = "";
+                                                       $search_words = split(' 
', $search_for);
+                                                       $count = 0;
+                                                       $selector = "(";
+                                                       foreach($search_words 
as $search_word){
+                                                               $selector = 
$selector." (FORNAVN LIKE '%$search_word%' OR ".
+                                                                               
"ETTERNAVN LIKE '%$search_word%' OR ".
+                                                                               
"BRUKERNAVN LIKE '%$search_word%')";
+                                                               if($count < 
(count($search_words)-1)) $selector = $selector." OR ";
+                                                               $count = 
($count + 1);
+                                                       }
+                                                       $selector = 
$selector.")";
+                                                       
                                                break;
                                        default:
                                                        $selector = "ORG_NAVN 
LIKE '%".$search_for."%'";
@@ -177,18 +213,34 @@
                                }
                                $sql = "$sql AND $selector";
                        }
-                       $order_by = "ORDER BY V_ORG_ENHET.RESULTATENHET ASC";
+                       
+                       $dir = $sort_ascending ? 'ASC' : 'DESC';
+                       
+                       switch($sort_field){
+                               case "ORG_UNIT_ID":
+                                       $order_by = "ORDER BY 
V_ORG_ENHET.ORG_ENHET_ID $dir";
+                                       break;
+                               case "ORG_UNIT_NAME":
+                                       $order_by = "ORDER BY 
V_ORG_ENHET.ORG_NAVN $dir";
+                                       break;
+                               case "LEADER_FULLNAME":
+                                       $order_by = "ORDER BY 
V_ORG_PERSON.FORNAVN $dir, V_ORG_PERSON.ETTERNAVN $dir";
+                                       break;
+                               default:
+                                       $order_by = "ORDER BY 
V_ORG_ENHET.ORG_ENHET_ID $dir";
+                                       break;
+                       }
                        $sql = "$sql $order_by";
                        
                        
                        $db = $this->get_db();
-                       $db->query($sql,__LINE__,__FILE__);                     
-               
+                       
$db->limit_query($sql,$start_index,__LINE__,__FILE__,$num_of_objects);
+                       
                        $result_units = array();
                        while($db->next_record())
                        {
                                
-                               $full_name = $db->f('FORNAVN'). 
$db->f('ETTERNAVN');
+                               $full_name = $db->f('FORNAVN')." 
".$db->f('ETTERNAVN');
                                
                                $result_units[] = array(
                                                "ORG_UNIT_ID" => 
(int)$db->f('ORG_ENHET_ID'),
@@ -202,7 +254,48 @@
                        return $result_units;
                }
                
+               public function get_result_units_count($search_for, 
$search_type){
+                       $columns = "count(*)";
+                       $tables = "V_ORG_ENHET";
+                       $joins =        "LEFT JOIN V_ORG_PERSON_ENHET ON 
(V_ORG_ENHET.ORG_ENHET_ID = V_ORG_PERSON_ENHET.ORG_ENHET_ID AND 
V_ORG_PERSON_ENHET.prioritet = 1) ".
+                                               "LEFT JOIN V_ORG_PERSON ON 
(V_ORG_PERSON.ORG_PERSON_ID = V_ORG_PERSON_ENHET.ORG_PERSON_ID)";
+                       $sql = "SELECT $columns FROM $tables $joins WHERE 
V_ORG_ENHET.ORG_NIVAA = 4";
+                       if($search_for){
+                               $selector = "";
+                               switch($search_type){
+                                       case 'unit_leader':
+                                                       $search_words = split(' 
', $search_for);
+                                                       $count = 0;
+                                                       $selector = "(";
+                                                       foreach($search_words 
as $search_word){
+                                                               $selector = 
$selector." (FORNAVN LIKE '%$search_word%' OR ".
+                                                                               
"ETTERNAVN LIKE '%$search_word%' OR ".
+                                                                               
"BRUKERNAVN LIKE '%$search_word%')";
+                                                               if($count < 
(count($search_words)-1)) $selector = $selector." OR ";
+                                                               $count = 
($count + 1);
+                                                       }
+                                                       $selector = 
$selector.")";
+                                                       
+                                               break;
+                                       default:
+                                                       $selector = "ORG_NAVN 
LIKE '%".$search_for."%'";
+                                               break; 
+                               }
+                               $sql = "$sql AND $selector";
+                       }
+                       
+                       $db = $this->get_db();
+                       $db->query($sql);
+                       
+                       if($db->next_record())
+                       {
+                               return $db->f('count(*)');
+                       }
+                       return 0;
+               }
                
+               
+               
                public function is_connected()
                {
                        return $this->connected;

Modified: trunk/rental/inc/class.uidelegate.inc.php
===================================================================
--- trunk/rental/inc/class.uidelegate.inc.php   2010-11-03 14:34:48 UTC (rev 
6537)
+++ trunk/rental/inc/class.uidelegate.inc.php   2010-11-04 07:15:45 UTC (rev 
6538)
@@ -28,117 +28,32 @@
                        
                        if (isset($unit_id) && $unit_id > 0) {
                                $delegates_per_org_unit = 
frontend_bofrontend::get_delegates($unit_id);
-                       
-                       
+
                                $delegates_data = array('results' => 
$delegates_per_org_unit, 'total_records' => count($delegates_per_org_unit));
                                
                                $editable = phpgw::get_var('editable') == 
'true' ? true : false;
-                       }
+                               array_walk(
+                                                       
$delegates_data['results'], 
+                                                       array($this, 
'add_actions'),
+                                                       array(                  
// Parameters (non-object pointers)
+                                                                       
$unit_id        // [1] The unit id
+                                       ));
                        
+                       }
+
                        return $this->yui_results($delegates_data, 
'total_records', 'results');
                }
                
                public function index(){
-                       if(isset($_POST['search']))
-                       {
-                               $username = phpgw::get_var('username');
-                               if(!isset($username))
-                               {
-                                       $msglog['error'][] = array('msg' => 
lang('lacking_username'));
-                               }
-                               else if($username == 
$GLOBALS['phpgw_info']['user']['account_lid'])
-                               {
-                                       $msglog['error'][] = array('msg' => 
lang('searching_for_self'));
-                               }
-                               else
-                               {
-                                       $account_id = 
frontend_bofrontend::delegate_exist($username);
-                                       if($account_id)
-                                       {
-                                               $search = 
frontend_bofrontend::get_account_info($account_id);
-                                               $msglog['message'][] = 
array('msg' => lang('user_found_in_PE'));
-                                       }
-                                       else
-                                       {
-                                               $fellesdata_user = 
frontend_bofellesdata::get_instance()->get_user($username);
-                                               if($fellesdata_user)
-                                               {
-                                                       $search = 
$fellesdata_user;
-                                                       $msglog['message'][] = 
array('msg' => lang('user_found_in_Fellesdata'));
-                                               }
-                                               else
-                                               {
-                                                       $msglog['error'][] = 
array('msg' => lang('no_hits'));
-                                               }
-                                       }
-                               }
-                       } 
-                       else if(isset($_POST['add']))
-                       {
-                               $account_id = phpgw::get_var('account_id');
-                               
-                               $org_units = 
frontend_bofellesdata::get_instance()->get_result_units($GLOBALS['phpgw_info']['user']['account_lid']);
-                               
-                               //Parameter to delegate access to only a single 
organisational unit
-                               $org_unit_id = 
$this->header_state['selected_org_unit'];
-                               $success = true;
-                               
-                               foreach($org_units as $org_unit)
-                               {
-                                       if($org_unit_id == 'all' || 
$org_unit['ORG_UNIT_ID'] == $org_unit_id)
-                                       {
-                                               $res = 
$this->add_delegate($account_id,$org_unit['ORG_UNIT_ID'],$org_unit['ORG_NAME']);
-                                               if(!$res)
-                                               {
-                                                       $msglog['error'][] = 
array('msg' => lang('error_delegating_unit',$org_unit['ORG_NAME']));
-                                               }
-                                               $success = $success  && $res;
-                                       }
-                               }
-                               
-                               if($success)
-                               {
-                                       $msglog['message'][] = array('msg' => 
lang('delegation_successful'));   
-                               }
-                               else
-                               {
-                                       $msglog['error'][] = array('msg' => 
lang('delegation_error'));  
-                               }
-                       }
-                       
-                       
-                       
-                       
-                       
                        $this->render('delegate_list.php');
                }
                
-               public function add_delegate(int $account_id, $org_unit_id, 
$org_name)
+               public function add_actions(&$value, $key, $params)
                {
-                       if(!isset($account_id) || $account_id == '')
-                       {
-                               //User is only registered in Fellesdata
-                               $username = phpgw::get_var('username'); 
-                               $firstname = phpgw::get_var('firstname'); 
-                               $lastname = phpgw::get_var('lastname'); 
-                               $password = 'TEst1234';
-                               
-                               $account_id = 
frontend_bofrontend::create_delegate_account($username, $firstname, $lastname, 
$password);
-                               
-                               if(isset($account_id) && 
!is_numeric($account_id))
-                               {
-                                       return false;
-                               }
-                       }       
-                       return frontend_bofrontend::add_delegate($account_id, 
null, $org_unit_id, $org_name);
-               }
-               
-               public function remove_delegate()
-               {
-                       $account_id = phpgw::get_var('account_id'); 
-                       $owner_id = phpgw::get_var('owner_id');
+                       $unit_id = $params[0];
                        
-                       
frontend_bofrontend::remove_delegate($account_id,$owner_id);
-                       $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'rental.uiresultunit.edit'));
+                       $value['ajax'][] = false;
+                       $value['actions'][] = 
html_entity_decode(link(array('menuaction' => 
'rental.uiresultunit.remove_delegate', 'id' => $unit_id, 'account_id' => 
$value['account_id'], 'owner_id' => $value['owner_id'])));
+                       $value['labels'][] = lang('remove_delegate');
                }
        }
\ No newline at end of file

Modified: trunk/rental/inc/class.uiresultunit.inc.php
===================================================================
--- trunk/rental/inc/class.uiresultunit.inc.php 2010-11-03 14:34:48 UTC (rev 
6537)
+++ trunk/rental/inc/class.uiresultunit.inc.php 2010-11-04 07:15:45 UTC (rev 
6538)
@@ -2,6 +2,7 @@
        phpgw::import_class('rental.uicommon');
        phpgw::import_class('rental.bofellesdata');
        phpgw::import_class('frontend.bofrontend');
+       phpgw::import_class('frontend.bofellesdata');
        
        class rental_uiresultunit extends rental_uicommon
        {
@@ -9,7 +10,8 @@
                (
                        'index'                         => true,
                        'edit'                          => true,
-                       'query'                         => true
+                       'query'                         => true,
+                       'remove_delegate'       => true
                );
                
                public function __construct()
@@ -31,6 +33,7 @@
                        }
                        // YUI variables for paging and sorting
                        $start_index    = phpgw::get_var('startIndex', 'int');
+                       if(!$start_index) $start_index = 0;
                        $num_of_objects = phpgw::get_var('results', 'int', 
'GET', $user_rows_per_page);
                        $sort_field             = phpgw::get_var('sort', 
'string', 'GET', 'identifier');
                        $sort_ascending = phpgw::get_var('dir') == 'desc' ? 
false : true;
@@ -38,24 +41,23 @@
                        $search_for     = phpgw::get_var('query');
                        $search_type    = phpgw::get_var('search_option');
                        
-                       phpgwapi_cache::session_set('rental', 
'composite_query', $search_for);
-                       phpgwapi_cache::session_set('rental', 
'composite_search_type', $search_type);
+                       phpgwapi_cache::session_set('rental', 
'resultunit_query', $search_for);
+                       phpgwapi_cache::session_set('rental', 
'resultunit_search_type', $search_type);
                        
                        // Create an empty result set
                        $result_count = 0;
-                       
-                       
                        // get all result unit from fellesdata
                        $bofelles = rental_bofellesdata::get_instance();
 
-                       $result_units = 
$bofelles->get_result_units_with_leader($search_for, $search_type);
-
-                       foreach($result_units as &$unit) {
-                               $delegates_per_org_unit = 
frontend_bofrontend::get_delegates($unit['ORG_UNIT_ID']);
-                               $unit['UNIT_NO_OF_DELEGATES'] = 
count($delegates_per_org_unit);
+                       $result_units = 
$bofelles->get_result_units_with_leader($start_index,$num_of_objects,$sort_field,
 $sort_ascending, $search_for, $search_type);
+                       
+                       $result_count = 
$bofelles->get_result_units_count($search_for, $search_type);
+                       
+                       foreach($result_units as &$unit){
+                               $unit['UNIT_NO_OF_DELEGATES'] = 
count(frontend_bofrontend::get_delegates($unit['ORG_UNIT_ID']));
                        }
                        
-                       $resultunit_data = array('results' => $result_units, 
'total_records' => count($result_units));
+                       $resultunit_data = array('results' => $result_units, 
'total_records' => $result_count);
                        
                        $editable = phpgw::get_var('editable') == 'true' ? true 
: false;
                        
@@ -81,7 +83,7 @@
                public function add_actions(&$value)
                {
                        $value['ajax'][] = false;
-                       $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 'rental.uiresultunit.edit', 
'id' => $value['ORG_UNIT_ID'], 'initial_load' => 'no')));
+                       $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 'rental.uiresultunit.edit', 
'id' => $value['ORG_UNIT_ID'])));
                        $value['labels'][] = lang('edit_delegate');
                }
                
@@ -92,14 +94,113 @@
                        
                        if (isset($unit_id) && $unit_id > 0) {
                                
+                               $msglog['error']['msg'] = 
phpgw::get_var('error');
+                               $msglog['message']['msg'] = 
phpgw::get_var('message');
                                
+                               if(isset($_POST['search']))
+                               {
+                                       $username = phpgw::get_var('username');
+                                       if(!isset($username))
+                                       {
+                                               $msglog['error']['msg'] = 
lang('lacking_username');
+                                       }
+                                       else
+                                       {
+                                               $account_id = 
frontend_bofrontend::delegate_exist($username);
+                                               if($account_id)
+                                               {
+                                                       $search_result = 
frontend_bofrontend::get_account_info($account_id);
+                                                       
$msglog['message']['msg'] = lang('user_found_in_PE');
+                                               }
+                                               else
+                                               {
+                                                       $fellesdata_user = 
frontend_bofellesdata::get_instance()->get_user($username);
+                                                       if($fellesdata_user)
+                                                       {
+                                                               $search_result 
= $fellesdata_user;
+                                                               
$msglog['message']['msg'] = lang('user_found_in_Fellesdata');
+                                                       }
+                                                       else
+                                                       {
+                                                               
$msglog['error']['msg'] = lang('no_hits');
+                                                       }
+                                               }
+                                       }
+                               }
+                               else if(isset($_POST['add']))
+                               {
+                                       $account_id = 
phpgw::get_var('account_id');
+                                       
+                                       
+                                       $bofelles = 
rental_bofellesdata::get_instance();
+                                       $unit = 
$bofelles->get_result_unit($unit_id);
+                                       if($account_id){
+                                               $res = 
$this->add_delegate($account_id,$unit['ORG_UNIT_ID'],$unit['ORG_NAME']);
+                                               if(!$res)
+                                               {
+                                                       $msglog['error']['msg'] 
= lang('delegation_error');
+                                               }
+                                               else
+                                               {
+                                                       
$msglog['message']['msg'] = lang('delegation_successful');
+                                               }
+                                       }
+                                       else{
+                                               $msglog['error']['msg'] = 
lang('unknown_user'); 
+                                       }
+                               }
+                               
                                $bofelles = rental_bofellesdata::get_instance();
-                               $unit = $bofelles->get_result_unit($unit_id);
+                               $unit = 
$bofelles->get_result_unit_with_leader($unit_id);
                                
                                $delegates_per_org_unit = 
frontend_bofrontend::get_delegates($unit_id);
                                $unit['UNIT_NO_OF_DELEGATES'] = 
count($delegates_per_org_unit);
                                
-                               $this->render('resultunit.php', array ('unit' 
=> $unit));
+                               $form_action = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction' => 
'rental.uiresultunit.edit', 'id' => $unit_id));
+                               
+                               $this->render('resultunit.php', array ('unit' 
=> $unit, 
+                                                                               
                                'form_action' => $form_action,
+                                                                               
                                'search_result' => isset($search_result) ? 
$search_result : array(),
+                                                                               
                                'msglog' => $msglog,
+                                                                               
                                'cancel_link' => self::link(array('menuaction' 
=> 'rental.uiresultunit.index', 'populate_form' => 'yes'))));
                        }
                }
+               
+               public function add_delegate(int $account_id, $org_unit_id, 
$org_name)
+               {
+                       if(!isset($account_id) || $account_id == '')
+                       {
+                               //User is only registered in Fellesdata
+                               $username = phpgw::get_var('username'); 
+                               $firstname = phpgw::get_var('firstname'); 
+                               $lastname = phpgw::get_var('lastname'); 
+                               $password = 'TEst1234';
+                               
+                               $account_id = 
frontend_bofrontend::create_delegate_account($username, $firstname, $lastname, 
$password);
+                               
+                               if(isset($account_id) && 
!is_numeric($account_id))
+                               {
+                                       return false;
+                               }
+                       }       
+                       return frontend_bofrontend::add_delegate($account_id, 
null, $org_unit_id, $org_name);
+               }
+               
+               public function remove_delegate()
+               {
+                       $unit_id = phpgw::get_var('id'); 
+                       $account_id = phpgw::get_var('account_id'); 
+                       
+                       $result = 
frontend_bofrontend::remove_delegate($account_id,null,$unit_id);
+                       
+                       $args = array('menuaction' => 
'rental.uiresultunit.edit', 'id' => $unit_id);
+                       
+                       if($result){
+                               $args['message'] = lang('delegate_removed');
+                       }
+                       else{
+                               $args['error'] = 
lang('failed_removing_delegate');
+                       }
+                       $GLOBALS['phpgw']->redirect_link('/index.php', $args);
+               }
        }
\ No newline at end of file

Modified: trunk/rental/templates/base/delegate_list.php
===================================================================
--- trunk/rental/templates/base/delegate_list.php       2010-11-03 14:34:48 UTC 
(rev 6537)
+++ trunk/rental/templates/base/delegate_list.php       2010-11-04 07:15:45 UTC 
(rev 6538)
@@ -38,8 +38,8 @@
        setDataSource(
                
'index.php?menuaction=rental.uidelegate.query&amp;phpgw_return_as=json<?php 
echo $url_add_on; ?>&amp;editable=<?php echo isset($editable) && $editable ? 
"true" : "false"; ?>',
                columnDefs,
-               '<?php echo $list_id ?>_form',
-               '<?php echo $list_id ?>_ctrl_search_query',
+               '',
+               '',
                '<?php echo $list_id ?>_container',
                '<?php echo $list_id ?>_paginator',
                '<?php echo $list_id ?>',
@@ -52,20 +52,20 @@
        if($list_form)
        {
 ?>
-<form id="<?php echo $list_id ?>_form" method="GET">
+<form id="<?php echo $list_id ?>_form" method="POST" action="<?php echo 
$form_action?>">
        <fieldset>
-               <input type="hidden" name="account_id" 
value="{search/account_id}"/>
+               <input type="hidden" name="account_id" value="<?php echo 
$search_result['account_id'];?>"/>
                <label><?php echo lang('username') ?> </label>
-               <input type="text" name="username" 
value="{search/username}"/><input type="submit" name="search" value="<?php echo 
lang('btn_search') ?>"/>
+               <input type="text" name="username" value="<?php echo 
$search_result['username'];?>"/><input type="submit" name="search" value="<?php 
echo lang('btn_search') ?>"/>
                <br/>
                <label><?php echo lang('firstname') ?> </label>
-               <input type="text" name="firstname" readonly="" 
value="{search/firstname}" style="background-color: #CCCCCC;"/>
+               <input type="text" name="firstname" readonly="" value="<?php 
echo $search_result['firstname'];?>" style="background-color: #CCCCCC;"/>
                <br/>
                <label><?php echo lang('lastname') ?> </label>
-               <input type="text" name="lastname" readonly="" 
value="{search/lastname}" style="background-color: #CCCCCC;"/>
+               <input type="text" name="lastname" readonly="" value="<?php 
echo $search_result['lastname'];?>" style="background-color: #CCCCCC;"/>
                <br/>
                <label><?php echo lang('email') ?> </label>
-               <input type="text" name="email" readonly="" 
value="{search/email}" style="background-color: #CCCCCC;"/>
+               <input type="text" name="email" readonly="" value="<?php echo 
$search_result['email'];?>" style="background-color: #CCCCCC;"/>
                <br/>
                <input type="submit" name="add" value="<?php echo 
lang('btn_add') ?>"/>
        </fieldset>

Modified: trunk/rental/templates/base/resultunit.php
===================================================================
--- trunk/rental/templates/base/resultunit.php  2010-11-03 14:34:48 UTC (rev 
6537)
+++ trunk/rental/templates/base/resultunit.php  2010-11-04 07:15:45 UTC (rev 
6538)
@@ -6,9 +6,8 @@
        $config->read();
 ?>
 
-<!--  ?php echo rental_uicommon::get_page_error($error) ?-->
-<!--  ?php echo 
rental_uicommon::get_page_warning($contract->get_validation_warnings()) ?-->
-<!--  ?php echo rental_uicommon::get_page_message($message) ?-->
+<?php echo rental_uicommon::get_page_error($error)?>
+<?php echo rental_uicommon::get_page_message($message)?>
 
 <!-- HOPPET OVER WARNINGS FORELØPIG -->
 
@@ -22,7 +21,7 @@
                } ?>
                <br/>
                <label><?php echo lang('unit_name'); ?></label>
-               <?php echo $unit["ORG_NAME"]; ?>
+               <?php echo $unit["ORG_UNIT_NAME"]; ?>
                 <br/>
                <label><?php echo lang('unit_leader_name'); ?></label>
                <?php echo $unit["LEADER_FULLNAME"]; ?>
@@ -50,7 +49,16 @@
                <?php if($unit["ORG_UNIT_ID"] > 0) {?>
                        <div id="delegates">
                                <h3><?php echo lang('related_delegates') ?></h3>
+                               <?php if($msglog['error']['msg']){?>
+                                       <div class="error"><?php echo 
$msglog['error']['msg']?></div>
+                               <?php 
+                                       }
+                                       if($msglog['message']['msg']){
+                               ?>
+                                       <div class="msg_good"><?php echo 
$msglog['message']['msg']?></div>
                                <?php
+                                       }
+                               
                                        $list_form = true;
                                        $list_id = 'included_delegates';
                                        $url_add_on = 
'&amp;type=included_delegates&amp;unit_id='.$unit["ORG_UNIT_ID"];

Modified: trunk/rental/templates/base/resultunit_list_partial.php
===================================================================
--- trunk/rental/templates/base/resultunit_list_partial.php     2010-11-03 
14:34:48 UTC (rev 6537)
+++ trunk/rental/templates/base/resultunit_list_partial.php     2010-11-04 
07:15:45 UTC (rev 6538)
@@ -24,12 +24,12 @@
                {
                        key: "LEADER_FULLNAME",
                        label: "<?php echo lang('unit_leader_name') ?>",
-                   sortable: true
+                       sortable: true
                },
                {
                        key: "UNIT_NO_OF_DELEGATES",
                        label: "<?php echo lang('unit_no_of_delegates') ?>",
-                   sortable: true
+                   sortable: false
                },
                {
                        key: "actions",




reply via email to

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