fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7834] update som text fields + sortorder on search a


From: Kjell Arne Espedal
Subject: [Fmsystem-commits] [7834] update som text fields + sortorder on search and bug fix on listing of system messages
Date: Thu, 06 Oct 2011 08:41:34 +0000

Revision: 7834
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7834
Author:   kjell
Date:     2011-10-06 08:41:33 +0000 (Thu, 06 Oct 2011)
Log Message:
-----------
update som text fields + sortorder on search and bug fix on listing of system 
messages

Modified Paths:
--------------
    trunk/booking/inc/class.bosystem_message.inc.php
    trunk/booking/inc/class.uidashboard.inc.php
    trunk/booking/inc/class.uisystem_message.inc.php
    trunk/booking/setup/phpgw_no.lang
    trunk/booking/templates/base/application_new.xsl
    trunk/bookingfrontend/inc/class.bosearch.inc.php
    trunk/bookingfrontend/setup/phpgw_no.lang

Modified: trunk/booking/inc/class.bosystem_message.inc.php
===================================================================
--- trunk/booking/inc/class.bosystem_message.inc.php    2011-10-05 13:53:10 UTC 
(rev 7833)
+++ trunk/booking/inc/class.bosystem_message.inc.php    2011-10-06 08:41:33 UTC 
(rev 7834)
@@ -8,82 +8,4 @@
                        parent::__construct();
                        $this->so = CreateObject('booking.sosystem_message');
                }
-               /**
-               * Returns an array of application ids from applications 
assocciated with buildings
-               * which the given user has access to
-               *
-               * @param int $user_id
-               */
-
-               function read_message_data($for_case_officer_id = null)
-               {
-                       $this->db = & $GLOBALS['phpgw']->db;
-                       $messages =  array(); 
-
-#                      if ($type = phpgw::get_var('type', 'string', 'GET', 
false) != 'not') {
-#                    $params['filters']['type'] = phpgw::get_var('type');      
 
-#            }
-
-#                      if ($status = phpgw::get_var('status', 'string', 'GET', 
false) != 'not') {
-#                    $params['filters']['status'] = phpgw::get_var('status');  
     
-#            }
-
-#            if (is_set($params['filters']['type'])) {
-#                $filter = " WHERE type = ".$params['filters']['type']." ";
-#                if (is_set($params['filters']['status'])) {
-#                    $filter = $filter." AND ".$params['filters']['status']." 
";
-#                }
-#            } elseif  (is_set($params['filters']['status'])) {
-#            if  (is_set($params['filters']['status'])) {
-#                $filter = " WHERE status = '".$params['filters']['status']."' 
";
-#            } else {
-               $filter = "";
-#            }
-            
-
-                       $sql = "SELECT id, type, status, title, name, created, 
building_id FROM bb_system_message ".$filter." ORDER BY id DESC";
-
-                       ob_start();
-                       $myFile = "/tmp/debug2.txt";
-                       $fh = fopen($myFile, 'w') or die("can't open file");
-                       echo "<pre>\ntestdata:\n";print_r($sql);
-                       $op = ob_get_contents();
-                       fwrite($fh, $op);
-                       fclose($fh);
-                       ob_end_clean();
-
-                       $external_site_address = 
isset($config->config_data['external_site_address']) && 
$config->config_data['external_site_address'] ? 
$config->config_data['external_site_address'] : 
$GLOBALS['phpgw_info']['server']['webserver_url'];
-                       $this->db->query($sql);
-                       $data = $this->db->resultSet;
-                       while ($messagedata = array_shift($data)) {
-                               $building_case_officers_data =  array(); 
-                               $building_case_officers =  array(); 
-                               $sql = "SELECT account_id, account_lid, 
account_firstname, account_lastname FROM phpgw_accounts WHERE account_id IN 
(SELECT subject_id FROM bb_permission WHERE 
object_id=".$messagedata['building_id']." AND role='case_officer')";
-                               $this->db->query($sql);
-                               while ($record = 
array_shift($this->db->resultSet)) {
-                                        $building_case_officers_data[] = 
array('account_id' => $record['account_id'], 'account_lid' => 
$record['account_lid'],'account_name' => $record['account_firstname']." 
".$record['account_lastname']);
-                                        $building_case_officers[] = 
$record['account_id'];
-                               }
-
-                               if(in_array($for_case_officer_id, 
$building_case_officers, true) || is_null($for_case_officer_id)) {
-                                       $message =      array('id' =>  
$messagedata['id'],
-                                               'type' => 
lang($messagedata['type']),
-                           'status' => lang($messagedata['status']),
-                           'created' => 
pretty_timestamp($messagedata['created']),
-                           'modified' => '',
-                           'activity_name' => '',
-                           'contact_name' => $messagedata['name'],             
            
-                                               'case_officer_name' => 
$for_case_officer_id,
-                           'what' => $messagedata['title'],
-                           'link' => 
$external_site_address."/index.php?menuaction=booking.uisystem_message.show&amp;id=".$messagedata['id']."&amp;");
                 
-
-                                               while($case_officer = 
array_shift($building_case_officers_data)) {
-                                                       if 
($message['case_officer_name'] = $case_officer['account_id'])
-                                                               
$message['case_officer_name'] = $case_officer['account_name'];
-                                               }
-                                       $messages[] = $message;
-                               }
-                       }
-                       return $messages;
-               }
        }

Modified: trunk/booking/inc/class.uidashboard.inc.php
===================================================================
--- trunk/booking/inc/class.uidashboard.inc.php 2011-10-05 13:53:10 UTC (rev 
7833)
+++ trunk/booking/inc/class.uidashboard.inc.php 2011-10-06 08:41:33 UTC (rev 
7834)
@@ -116,11 +116,6 @@
                                                                'value' => 
$this->show_all_dashboard_applications() ? lang('Show only applications 
assigned to me') : lang('Show all applications'),
                                                                'href' => 
self::link(array('menuaction' => 
$this->url_prefix.'.toggle_show_all_dashboard_applications'))
                                                        ),
-                                                       array(
-                                                               'type' => 
'link',
-                                                               'value' => 
lang('Show messages'),
-                                                               'href' => 
self::link(array('menuaction' => 'booking.uisystem_message.index'))
-                                                       ),
                                                )
                                        ),
                                ),
@@ -205,19 +200,6 @@
                        }
                        array_walk($applications["results"], array($this, 
"_add_links"), "booking.uiapplication.show");
 
-#                      $messages = 
$this->system_message_bo->read_message_data($this->show_all_dashboard_messages()
 ? null : $this->current_account_id());
-
-#                      if ($this->show_all_dashboard_messages() || 
$this->show_all_dashboard_applications())
-#                      {
-#                              if ($this->show_all_dashboard_messages()) {
-#                                      $applications['results'] = $messages;
-#                              }
-#                      } else {
-#                              foreach($messages as $message)
-#                              {
-#                                      $applications['results'][] = $message;  
        
-#                              } 
-#                      }
                        return $this->yui_results($applications);
                }
 

Modified: trunk/booking/inc/class.uisystem_message.inc.php
===================================================================
--- trunk/booking/inc/class.uisystem_message.inc.php    2011-10-05 13:53:10 UTC 
(rev 7833)
+++ trunk/booking/inc/class.uisystem_message.inc.php    2011-10-06 08:41:33 UTC 
(rev 7834)
@@ -8,11 +8,9 @@
                        'index'                 =>      true,
                        'show'                  =>      true,
                        'edit'                  =>      true,
-                       'toggle_show_all_dashboard_messages' => true,
                        'toggle_show_inactive'  =>      true,
                );
 
-               const SHOW_ALL_DASHBOARD_MESSAGES_SESSION_KEY = 
"show_all_dashboard_messages";
 
         protected $module;
                public function __construct()
@@ -25,21 +23,6 @@
             $this->module = 'booking';
                }
 
-               public function toggle_show_all_dashboard_messages()
-               {
-                       if($this->show_all_dashboard_messages())
-                       {
-                               
unset($_SESSION[self::SHOW_ALL_DASHBOARD_MESSAGES_SESSION_KEY]);
-                       } else {
-                               
$_SESSION[self::SHOW_ALL_DASHBOARD_MESSAGES_SESSION_KEY] = true;
-                       }
-                       $this->redirect(array('menuaction' => 
$this->url_prefix.'.index'));
-               }
-               
-               public function show_all_dashboard_messages() {
-                       return 
array_key_exists(self::SHOW_ALL_DASHBOARD_MESSAGES_SESSION_KEY, $_SESSION);
-               }
-               
                public function index()
                {
                        if(phpgw::get_var('phpgw_return_as') == 'json') {
@@ -54,42 +37,42 @@
                                'form' => array(
                                        'toolbar' => array(
                                                'item' => array(
-#                                                      array('type' => 
'filter', 
-#                                                              'name' => 
'status',
-#                                'text' => lang('Status').':',
-#                                'list' => array(
-#                                    array(
-#                                        'id' => 'not',
-#                                        'name' => lang('Not selected')
-#                                    ), 
-#                                    array(
-#                                        'id' => 'NEW',
-#                                        'name' => lang('NEW')
-#                                    ), 
-#                                    array(
-#                                        'id' => 'CLOSED',
-#                                        'name' => lang('CLOSED')
-#                                    )
-#                                )
-#                            ),
-#                                                      array('type' => 
'filter', 
-#                                                              'name' => 
'type',
-#                                'text' => lang('Type').':',
-#                                'list' => array(
-#                                    array(
-#                                        'id' => 'not',
-#                                        'name' => lang('Not selected')
-#                                    ), 
-#                                    array(
-#                                        'id' => 'message',
-#                                        'name' => lang('Message')
-#                                    ), 
-#                                    array(
-#                                        'id' => 'cancelation',
-#                                        'name' => lang('Cancelation')
-#                                    ), 
-#                                )
-#                            ),
+                                                       array('type' => 
'filter', 
+                                                               'name' => 
'status',
+                                'text' => lang('Status').':',
+                                'list' => array(
+                                    array(
+                                        'id' => '',
+                                        'name' => lang('Not selected')
+                                    ), 
+                                    array(
+                                        'id' => 'NEW',
+                                        'name' => lang('NEW')
+                                    ), 
+                                    array(
+                                        'id' => 'CLOSED',
+                                        'name' => lang('CLOSED')
+                                    )
+                                )
+                            ),
+                                                       array('type' => 
'filter', 
+                                                               'name' => 
'type',
+                                'text' => lang('Type').':',
+                                'list' => array(
+                                    array(
+                                        'id' => '',
+                                        'name' => lang('Not selected')
+                                    ), 
+                                    array(
+                                        'id' => 'message',
+                                        'name' => lang('Message')
+                                    ), 
+                                    array(
+                                        'id' => 'cancelation',
+                                        'name' => lang('Cancelation')
+                                    ), 
+                                )
+                            ),
                                                        array('type' => 
'autocomplete', 
                                                                'name' => 
'building',
                                                                'ui' => 
'building',
@@ -105,14 +88,9 @@
                                                        ),
                                                        array(
                                                                'type' => 
'link',
-                                                               'value' => 
lang('Show applications') ,
-                                                               'href' => 
self::link(array('menuaction' => 'booking.uidashboard.index'))
+                                                               'value' => 
$_SESSION['showall'] ? lang('Show only messages assigned to me') : lang('Show 
all messages'),
+                                                               'href' => 
self::link(array('menuaction' => $this->url_prefix.'.toggle_show_inactive'))
                                                        ),
-                                                       array(
-                                                               'type' => 
'link',
-                                                               'value' => 
$this->show_all_dashboard_messages() ? lang('Show only messages assigned to 
me') : lang('Show all messages'),
-                                                               'href' => 
self::link(array('menuaction' => 
$this->url_prefix.'.toggle_show_all_dashboard_messages'))
-                                                       ),
                                                )
                                        ),
                                ),
@@ -168,18 +146,45 @@
 
                public function index_json()
                {
-                       $this->db = $GLOBALS['phpgw']->db;
+                       $this->db = & $GLOBALS['phpgw']->db;
 
-                       if ( 
!isset($GLOBALS['phpgw_info']['user']['apps']['admin']) &&
-                            
!$this->bo->has_role(booking_sopermission::ROLE_MANAGER) )
-                       {
-                               $filters['id'] = 
$this->bo->accessable_applications($GLOBALS['phpgw_info']['user']['id']);
+                       $current_user = $this->current_account_id();
+                       $current_user_building_data = array();
+                       $sql = "select object_id from bb_permission where 
subject_id=".$current_user." and role='case_officer';";
+                       $this->db->query($sql);
+                       while ($record = array_shift($this->db->resultSet)) {
+                               $current_user_building_data[] = 
$record['object_id'];
                        }
-                       $filters['status'] = 'NEW';
+                       $filters['building_id'] = $current_user_building_data;
+
                        if(isset($_SESSION['showall']))
                        {
-                               $filters['status'] = array('NEW', 'CLOSED');
-                       }
+                               unset($filters['building_id']);
+                       unset($filters['building_name']);
+                       unset($filters['type']);
+                       unset($filters['status']);
+                       } else {
+
+                $testdata =  phpgw::get_var('filter_building_id', 'int', 
'REQUEST', null);
+                if ($testdata != 0) {
+                    $filters['building_name'] = 
$this->bo->so->get_building(phpgw::get_var('filter_building_id', 'int', 
'REQUEST', null));        
+                } else {
+                    unset($filters['building_name']);                
+                }
+                $testdata2 =  phpgw::get_var('type', 'str', 'REQUEST');
+                if ($testdata2 != '') {
+                    $filters['type'] = phpgw::get_var('type', 'str', 
'REQUEST');        
+                } else {
+                    unset($filters['type']);
+                }
+                $testdata2 =  phpgw::get_var('status', 'str', 'REQUEST');
+                if ($testdata2 != '') {
+                    $filters['status'] = phpgw::get_var('status', 'str', 
'REQUEST');        
+                } else {
+                    unset($filters['status']);
+                }
+            }
+            
                        $params = array(
                                'start' => phpgw::get_var('startIndex', 'int', 
'REQUEST', 0),
                                'results' => phpgw::get_var('results', 'int', 
'REQUEST', null),
@@ -189,22 +194,41 @@
                                'filters' => $filters
                        );
 
-                       $system_messages = $this->bo->read();
+                       $system_messages = $this->bo->so->read($params);
+                       array_walk($system_messages["results"], array($this, 
"_add_links"), "booking.uisystem_message.show");
 
-                       foreach($system_messages["results"] as 
&$system_message) {
+
+                       foreach($system_messages['results'] as &$system_message)
+                       {
+                               $building_case_officers_data =  array(); 
+                               $building_case_officers =  array(); 
+                               $sql = "SELECT account_id, account_lid, 
account_firstname, account_lastname FROM phpgw_accounts WHERE account_id IN 
(SELECT subject_id FROM bb_permission WHERE 
object_id=".$system_message['building_id']." AND role='case_officer')";
+                               $this->db->query($sql);
+                               while ($record = 
array_shift($this->db->resultSet)) {
+                                        $building_case_officers_data[] = 
array('account_id' => $record['account_id'], 'account_lid' => 
$record['account_lid'],'account_name' => $record['account_firstname']." 
".$record['account_lastname']);
+                                        $building_case_officers[] = 
$record['account_id'];
+                               }
+
                                $system_message['created'] = 
pretty_timestamp($system_message['created']);
                                $system_message['type'] = 
lang($system_message['type']);
                                $system_message['status'] = 
lang($system_message['status']);
+                               $system_message['modified'] = '';
+                               $system_message['activity_name'] = '';
+                               $system_message['contact_name'] = 
$system_message['name'];
+                               $system_message['case_officer_name'] = 
$for_case_officer_id;
+                               $system_message['what'] = 
$system_message['title'];
+                               if (strstr($system_message['what'],"%")){
+                                       $search = array('%2C','%C3%85', 
'%C3%A5', '%C3%98', '%C3%B8', '%C3%86', '%C3%A6');
+                                       $replace = array 
(',','Å','å','Ø','ø','Æ','æ');
+                                       $system_message['what'] = 
str_replace($search, $replace, $system_message['what']);
+                               }
+
+                               while($case_officer = 
array_shift($building_case_officers_data)) {
+                                       if 
($system_message['case_officer_name'] = $case_officer['account_id'])
+                                               
$system_message['case_officer_name'] = $case_officer['account_name'];
+                               }
                        }
-                       array_walk($system_messages['results'], array($this, 
'_add_links'), $this->module.'.uisystem_message.show');
-
-            $messages = 
$this->bo->read_message_data($this->show_all_dashboard_messages() ? null : 
$this->current_account_id());
-
-               $system_messages['results'] = $messages;
-
-                       $results = $this->yui_results($system_messages);
-                       
-                       return $results;
+                       return $this->yui_results($system_messages);
                }
 
                public function edit()

Modified: trunk/booking/setup/phpgw_no.lang
===================================================================
--- trunk/booking/setup/phpgw_no.lang   2011-10-05 13:53:10 UTC (rev 7833)
+++ trunk/booking/setup/phpgw_no.lang   2011-10-06 08:41:33 UTC (rev 7834)
@@ -162,7 +162,7 @@
 planning       booking no      Planlegging
 prev   booking no      Forrige
 preview        booking no      Forhåndsvisning
-previous week  booking no      Forige uke
+previous week  booking no      Forrige uke
 price list     booking no      Prisliste
 primary admin  booking no      Kontaktperson 1
 primary contact        booking no      Kontaktperson 1
@@ -418,7 +418,7 @@
 Information about the event    booking no      Informasjon om arrangementet
 Short description. For public events, activities and training under the 
direction of organizations and clubs, this information will be displayed on the 
internet       booking no      Gi en kort beskrivelse av arrangementet. For 
åpne arrangement, aktiviteter og trening i regi av organisasjoner og klubber 
vises denne informasjonen på internett
 To borrow premises you must verify that you have read terms and conditions     
booking no      For å låne lokaler må du bekrefte at du har lest juridiske 
betingelser
-In order to send the invoice we need information about either customer 
organization number or norwegian social security number booking no      For å 
kunne sende faktura trenger vi opplysninger om organisasjonsnr. eller fødselsnr.
+In order to send the invoice we need information about either customer 
organization number or norwegian social security number booking no      For å 
kunne sende faktura trenger vi opplysninger om organisasjonsnr. eller 
fødselsnr. Organisasjonsnr. finner du her: www.brreg.no
 Event type     booking no      Arrangementstype
 Private event  booking no      Privat arrangement
 Public event   booking no      Offentlig arrangement

Modified: trunk/booking/templates/base/application_new.xsl
===================================================================
--- trunk/booking/templates/base/application_new.xsl    2011-10-05 13:53:10 UTC 
(rev 7833)
+++ trunk/booking/templates/base/application_new.xsl    2011-10-06 08:41:33 UTC 
(rev 7834)
@@ -21,7 +21,7 @@
                                For åpne arrangement, aktiviteter og trening i 
regi av 
                                organisasjoner og klubber vises denne 
informasjonen på internett. 
                                For faste aktiviteter oppgi intervall og til 
dato, 
-                               f.eks. torsdager kl.19-20 frem til 23/6.</p>
+                               f.eks. torsdager kl.19-20 frem til 23/6. Oppgi 
arrangør og gi en kort beskrivelse av arrangementet. For åpne arrangement, 
aktiviteter og trening i regi av organisasjoner og klubber vises denne 
informasjonen på internett</p>
                        </dt>
                        <dd>
                                <select name="activity_id" id="field_activity">

Modified: trunk/bookingfrontend/inc/class.bosearch.inc.php
===================================================================
--- trunk/bookingfrontend/inc/class.bosearch.inc.php    2011-10-05 13:53:10 UTC 
(rev 7833)
+++ trunk/bookingfrontend/inc/class.bosearch.inc.php    2011-10-06 08:41:33 UTC 
(rev 7834)
@@ -17,7 +17,7 @@
             $bui_result = $org_result = $res_result = array();
 
             if (!$type || $type == "building") {
-                $bui_result = 
$this->sobuilding->read(array("query"=>$searchterm, "filters" => array("active" 
=> "1")));
+                $bui_result = 
$this->sobuilding->read(array("query"=>$searchterm, "sort"  => "name", "dir" => 
"asc",  "filters" => array("active" => "1")));
                 foreach($bui_result['results'] as &$bui)
                 {
                     $bui['type'] = "building";
@@ -31,7 +31,7 @@
                 }
             }
             if (!$type || $type == "organization") {
-                $org_result = 
$this->soorganization->read(array("query"=>$searchterm, "filters" => 
array("active" => "1")));
+                $org_result = 
$this->soorganization->read(array("query"=>$searchterm, "sort"  => "name", 
"dir" => "asc", "filters" => array("active" => "1")));
                 foreach($org_result['results'] as &$org)
                 {
                     $org['type'] = "organization";
@@ -44,7 +44,7 @@
                 }
             }
             if(!$type || $type == "resource") {
-                $res_result = 
$this->soresource->read(array("query"=>$searchterm, "filters" => array("active" 
=> "1")));
+                $res_result = 
$this->soresource->read(array("query"=>$searchterm, "sort"  => "name", "dir" => 
"asc",  "filters" => array("active" => "1")));
                 foreach($res_result['results'] as &$res)
                 {
                     $res['name'] = $res['building_name']. ' / ' . $res['name'];

Modified: trunk/bookingfrontend/setup/phpgw_no.lang
===================================================================
--- trunk/bookingfrontend/setup/phpgw_no.lang   2011-10-05 13:53:10 UTC (rev 
7833)
+++ trunk/bookingfrontend/setup/phpgw_no.lang   2011-10-06 08:41:33 UTC (rev 
7834)
@@ -278,7 +278,7 @@
 Information about the event    bookingfrontend no      Informasjon om 
arrangementet
 Short description. For public events, activities and training under the 
direction of organizations and clubs, this information will be displayed on the 
internet       bookingfrontend no      Gi en kort beskrivelse av arrangementet. 
For åpne arrangement, aktiviteter og trening i regi av organisasjoner og 
klubber vises denne informasjonen på internett
 To borrow premises you must verify that you have read terms and conditions     
bookingfrontend no      For å låne lokaler må du bekrefte at du har lest 
juridiske betingelser
-In order to send the invoice we need information about either customer 
organization number or norwegian social security number bookingfrontend no      
For å kunne sende faktura trenger vi opplysninger om organisasjonsnr. eller 
fødselsnr.
+In order to send the invoice we need information about either customer 
organization number or norwegian social security number bookingfrontend no      
For å kunne sende faktura trenger vi opplysninger om organisasjonsnr. eller 
fødselsnr. Organisasjonsnr. finner du her: www.brreg.no
 Private event  bookingfrontend no      Privat arrangement
 Mass update    bookingfrontend no      Masseoppdatering
 You are now about to update all bookings from this date and to the end of the 
season.  bookingfrontend no      Du er nå i ferd med å oppdatere alle bookinger 
fra dagens dato og ut sesongen.




reply via email to

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