fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [15338] Syncromind: merge 15305:15337 from trunk


From: sigurdne
Subject: [Fmsystem-commits] [15338] Syncromind: merge 15305:15337 from trunk
Date: Sat, 25 Jun 2016 18:08:09 +0000 (UTC)

Revision: 15338
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15338
Author:   sigurdne
Date:     2016-06-25 18:08:09 +0000 (Sat, 25 Jun 2016)
Log Message:
-----------
Syncromind: merge 15305:15337 from trunk

Modified Paths:
--------------
    branches/dev-syncromind-2/activitycalendar/inc/class.soactivity.inc.php
    branches/dev-syncromind-2/activitycalendar/inc/class.soarena.inc.php
    branches/dev-syncromind-2/activitycalendar/inc/class.socommon.inc.php
    branches/dev-syncromind-2/activitycalendar/inc/class.socontactperson.inc.php
    branches/dev-syncromind-2/activitycalendar/inc/class.sogroup.inc.php
    branches/dev-syncromind-2/activitycalendar/inc/class.soorganization.inc.php
    branches/dev-syncromind-2/activitycalendar/inc/class.uiactivities.inc.php
    branches/dev-syncromind-2/activitycalendar/inc/class.uiarena.inc.php
    branches/dev-syncromind-2/activitycalendar/inc/class.uiorganization.inc.php
    branches/dev-syncromind-2/booking/inc/class.soallocation.inc.php
    branches/dev-syncromind-2/booking/inc/class.soapplication.inc.php
    branches/dev-syncromind-2/booking/inc/class.sobooking.inc.php
    branches/dev-syncromind-2/booking/inc/class.socommon.inc.php
    branches/dev-syncromind-2/booking/inc/class.soevent.inc.php
    branches/dev-syncromind-2/booking/inc/class.soseason.inc.php
    branches/dev-syncromind-2/booking/inc/class.uiapplication.inc.php
    branches/dev-syncromind-2/booking/inc/class.uicommon.inc.php
    branches/dev-syncromind-2/booking/inc/class.uidocument.inc.php
    branches/dev-syncromind-2/booking/inc/class.uidocumentation.inc.php
    branches/dev-syncromind-2/booking/inc/class.uievent.inc.php
    branches/dev-syncromind-2/booking/inc/class.uipermission.inc.php
    branches/dev-syncromind-2/booking/inc/class.uiseason.inc.php
    branches/dev-syncromind-2/booking/js/booking/application.js
    branches/dev-syncromind-2/booking/js/booking/schedule.js
    branches/dev-syncromind-2/booking/setup/phpgw_no.lang
    branches/dev-syncromind-2/booking/templates/base/application.xsl
    branches/dev-syncromind-2/booking/templates/base/application_edit.xsl
    branches/dev-syncromind-2/booking/templates/base/building.xsl
    branches/dev-syncromind-2/booking/templates/base/resource.xsl
    branches/dev-syncromind-2/booking/templates/base/season.xsl
    branches/dev-syncromind-2/bookingfrontend/inc/class.bosearch.inc.php
    branches/dev-syncromind-2/bookingfrontend/js/bookingfrontend/application.js
    branches/dev-syncromind-2/bookingfrontend/js/bookingfrontend/schedule.js
    branches/dev-syncromind-2/bookingfrontend/js/bookingfrontend/search.js
    branches/dev-syncromind-2/phpgwapi/js/jquery/common.js
    branches/dev-syncromind-2/phpgwapi/templates/base/datatable_jquery.xsl
    branches/dev-syncromind-2/property/inc/class.soentity.inc.php
    branches/dev-syncromind-2/property/inc/class.sotts.inc.php
    branches/dev-syncromind-2/sms/inc/class.sosms.inc.php

Property Changed:
----------------
    branches/dev-syncromind-2/
    branches/dev-syncromind-2/booking/
    branches/dev-syncromind-2/bookingfrontend/


Property changes on: branches/dev-syncromind-2
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/dev-syncromind:13653
/branches/stavangerkommune:12743-12875,12986
/trunk:14934-14935,15165-15215,15218-15220,15222-15304
   + /branches/dev-syncromind:13653
/branches/stavangerkommune:12743-12875,12986
/trunk:14934-14935,15165-15215,15218-15220,15222-15304,15306-15337

Modified: 
branches/dev-syncromind-2/activitycalendar/inc/class.soactivity.inc.php
===================================================================
--- branches/dev-syncromind-2/activitycalendar/inc/class.soactivity.inc.php     
2016-06-25 17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/activitycalendar/inc/class.soactivity.inc.php     
2016-06-25 18:08:09 UTC (rev 15338)
@@ -107,6 +107,9 @@
                                //$order = "ORDER BY id $dir";
                                $order = "ORDER BY $sort_field $dir";
                        }
+
+                       $this->sort_field = str_ireplace(" {$dir}", '', 
$sort_field);
+
                        /* else
                          {
                          $dir = $ascending ? 'ASC' : 'DESC';
@@ -1046,7 +1049,7 @@
 
                function get_targetgroups()
                {
-                       $sql = "SELECT * FROM bb_agegroup where active=1 AND 
NOT name like 'Tilskuer%' ORDER BY sort";
+                       $sql = "SELECT * FROM bb_agegroup where active=1 AND 
activity_id = 1 AND NOT name like 'Tilskuer%' ORDER BY sort";
                        $this->db->query($sql, __LINE__, __FILE__);
                        while ($this->db->next_record())
                        {

Modified: branches/dev-syncromind-2/activitycalendar/inc/class.soarena.inc.php
===================================================================
--- branches/dev-syncromind-2/activitycalendar/inc/class.soarena.inc.php        
2016-06-25 17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/activitycalendar/inc/class.soarena.inc.php        
2016-06-25 18:08:09 UTC (rev 15338)
@@ -41,10 +41,10 @@
 
                        //Add columns to this array to include them in the query
                        $columns = array();
+                       $dir = $ascending ? 'ASC' : 'DESC';
 
                        if ($sort_field != null)
                        {
-                               $dir = $ascending ? 'ASC' : 'DESC';
                                if ($sort_field == 'arena_id')
                                {
                                        $sort_field = 'id';
@@ -53,9 +53,10 @@
                        }
                        else if (!$return_count)
                        {
-                               $dir = $ascending ? 'ASC' : 'DESC';
-                               $order = "ORDER BY arena.arena_name $dir";
+                               $sort_field = 'arena.arena_name';
+                               $order = "ORDER BY $sort_field $dir";
                        }
+                       $this->sort_field = str_ireplace(" {$dir}", '', 
$sort_field);
 
                        if ($search_for)
                        {

Modified: branches/dev-syncromind-2/activitycalendar/inc/class.socommon.inc.php
===================================================================
--- branches/dev-syncromind-2/activitycalendar/inc/class.socommon.inc.php       
2016-06-25 17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/activitycalendar/inc/class.socommon.inc.php       
2016-06-25 18:08:09 UTC (rev 15338)
@@ -1,324 +1,14 @@
 <?php
+       phpgw::import_class('rental.socommon');
 
-       abstract class activitycalendar_socommon
+       abstract class activitycalendar_socommon extends rental_socommon
        {
 
-               protected $db;
-               protected $like;
-               protected $join;
-               protected $left_join;
-
                public function __construct()
                {
-                       $this->db = clone $GLOBALS['phpgw']->db;
-                       $this->like = & $this->db->like;
-                       $this->join = & $this->db->join;
-                       $this->left_join = & $this->db->left_join;
+                       parent::__construct();
                }
-
-               /**
-                * Marshal values according to type
-                * @param $value the value
-                * @param $type the type of value
-                * @return database value
-                */
-               protected function marshal( $value, $type )
-               {
-                       if ($value === null)
-                       {
-                               return 'NULL';
-                       }
-                       else if ($type == 'int')
-                       {
-                               if ($value == '')
-                               {
-                                       return 'NULL';
-                               }
-                               return intval($value);
-                       }
-                       else if ($type == 'float')
-                       {
-                               return str_replace(',', '.', $value);
-                       }
-                       else if ($type == 'field')
-                       {
-                               return $this->db->db_addslashes($value);
-                       }
-                       return "'" . $this->db->db_addslashes($value) . "'";
-               }
-
-               /**
-                * Unmarchal database values according to type
-                * @param $value the field value
-                * @param $type a string dictating value type
-                * @return the php value
-                */
-               protected function unmarshal( $value, $type )
-               {
-                       if ($type == 'bool')
-                       {
-                               return (bool)$value;
-                       }
-                       elseif ($type == 'int')
-                       {
-                               return (int)$value;
-                       }
-                       elseif ($value === null || $value == 'NULL')
-                       {
-                               return null;
-                       }
-                       elseif ($type == 'float')
-                       {
-                               return floatval($value);
-                       }
-                       return $value;
-               }
-
-               /**
-                * Get the count of the specified query. Query must return a 
signel column
-                * called count.
-                *
-                * @param $sql the sql query
-                * @return the count value
-                */
-               protected function get_query_count( $sql )
-               {
-                       $result = $this->db->query($sql);
-                       if ($result && $this->db->next_record())
-                       {
-                               return $this->unmarshal($this->db->f('count', 
true), 'int');
-                       }
-               }
-
-               /**
-                * Implementing classes must return an instance of itself.
-                *  
-                * @return the class instance.
-                */
-               public abstract static function get_instance();
-
-               /**
-                * Convenience method for getting one single object. Calls 
get() with the
-                * specified id as a filter.
-                *
-                * @param $id int with id of object to return.
-                * @return object with the specified id, null if not found.
-                */
-               public function get_single( int $id )
-               {
-                       $objects = $this->get(0, 0, '', false, '', '', 
array($this->get_id_field_name() => $id));
-                       if (count($objects) > 0)
-                       {
-                               $keys = array_keys($objects);
-                               return $objects[$keys[0]];
-                       }
-                       return null;
-               }
-
-               /**
-                * Method for retrieving the db-object (security "forgotten")
-                */
-               public function get_db()
-               {
-                       return $this->db;
-               }
-
-               /**
-                * Method for retreiving objects.
-                *
-                * @param $start_index int with index of first object.
-                * @param $num_of_objects int with max number of objects to 
return.
-                * @param $sort_field string representing the object field to 
sort on.
-                * @param $ascending bool true for ascending sort on sort 
field, false
-                * for descending.
-                * @param $search_for string with free text search query.
-                * @param $search_type string with the query type.
-                * @param $filters array with key => value of filters.
-                * @return array of objects. May return an empty
-                * array, never null. The array keys are the respective index 
numbers.
-                */
-               public function get( int $start_index, int $num_of_objects, 
string $sort_field, bool $ascending, string $search_for, string $search_type, 
array $filters )
-               {
-                       $results = array();   // Array to store result objects
-                       $map = array(); // Array to hold number of records per 
target object
-                       $check_map = array();  // Array to hold the actual 
number of record read per target object
-                       $object_ids = array();   // All of the object ids 
encountered
-                       $added_object_ids = array();// All of the added objects 
ids
-                       // Retrieve information about the table name and the 
name and alias of id column
-                       // $break_on_limit -    flag indicating whether to 
break the loop when the number of records
-                       //                                              for all 
the result objects are traversed
-                       $id_field_name_info = $this->get_id_field_name(true);
-                       if (is_array($id_field_name_info))
-                       {
-                               $break_on_limit = true;
-                               $id_field_name = 
$id_field_name_info['translated'];
-                       }
-                       else
-                       {
-                               $break_on_limit = false;
-                               $id_field_name = $id_field_name_info;
-                       }
-
-                       // Special case: Sort on id field. Always changed to 
the id field name.
-                       // $break_when_num_of_objects_reached - flag indicating 
to break the loop when the number of
-                       //              results are reached and we are sure 
that the records are ordered by the id
-                       if ($sort_field == null || $sort_field == 'id' || 
$sort_field == '')
-                       {
-                               $sort_field = $id_field_name;
-                               $break_when_num_of_objects_reached = true;
-                       }
-                       else
-                       {
-                               $break_when_num_of_objects_reached = false;
-                       }
-
-                       // Only allow positive start index
-                       if ($start_index < 0)
-                       {
-                               $start_index = 0;
-                       }
-
-
-                       // test-input for break on ordered queries
-                       $db2 = clone($this->db);
-
-                       $sql = $this->get_query($sort_field, $ascending, 
$search_for, $search_type, $filters, false);
-                       $sql_parts = explode('1=1', $sql); // Split the query 
to insert extra condition on test for break
-                       $this->db->query($sql, __LINE__, __FILE__, false, true);
-
-                       while ($this->db->next_record()) // Runs through all of 
the results
-                       {
-                               $should_populate_object = false; // Default 
value - we won't populate object
-                               $result_id = 
$this->unmarshal($this->db->f($id_field_name), 'int'); // The id of object
-                               if (in_array($result_id, $added_object_ids)) // 
Object with this id already added
-                               {
-                                       $should_populate_object = true; // We 
should populate this object as we already have it in our result array
-                               }
-                               else // Object isn't already added to array
-                               {
-                                       if (!in_array($result_id, $object_ids)) 
// Haven't already added this id
-                                       {
-                                               $object_ids[] = $result_id; // 
We have to add the new id
-                                       }
-                                       // We have to check if we should 
populate this object
-                                       if (count($object_ids) > $start_index) 
// We're at index above start index
-                                       {
-                                               if ($num_of_objects == null || 
count($results) < $num_of_objects) // We haven't found all the objects we're 
looking for
-                                               {
-                                                       $should_populate_object 
= true; // We should populate this object
-                                                       $added_object_ids[] = 
$result_id; // We keep the id
-                                               }
-                                       }
-                               }
-                               if ($should_populate_object)
-                               {
-                                       $result = &$results[$result_id];
-                                       $results[$result_id] = 
$this->populate($result_id, $result);
-                                       $last_result_id = $result_id;
-                                       $map[$result_id] = 
(int)$map[$result_id] + 1;
-                               }
-
-                               //Stop looping when array not sorted on other 
then id and wanted number of results is reached
-                               if (count($results) == $num_of_objects && 
$last_result_id != $result_id && $break_when_num_of_objects_reached)
-                               {
-                                       break;
-                               }
-                               // else stop looping when wanted number of 
results is reached all records for result objects are read
-                               else if ($break_on_limit && (count($results) == 
$num_of_objects) && $last_result_id != $result_id)
-                               {
-                                       $id_ok = 0;
-                                       foreach ($map as $_result_id => $_count)
-                                       {
-                                               if 
(!isset($check_map[$_result_id]))
-                                               {
-                                                       // Query the number of 
records for the specific object in question
-                                                       $sql2 = 
"{$sql_parts[0]} 1=1 AND 
{$id_field_name_info['table']}.{$id_field_name_info['field']} = {$_result_id} 
{$sql_parts[1]}";
-                                                       $db2->query($sql2, 
__LINE__, __FILE__);
-                                                       $db2->next_record();
-                                                       $check_map[$_result_id] 
= $db2->num_rows();
-                                               }
-                                               if ($check_map[$_result_id] == 
$_count)
-                                               {
-                                                       $id_ok++;
-                                               }
-                                       }
-                                       if ($id_ok == $num_of_objects)
-                                       {
-                                               break;
-                                       }
-                               }
-                       }
-                       return $results;
-               }
-
-               /**
-                * Returns count of matching objects.
-                *
-                * @param $search_for string with free text search query.
-                * @param $search_type string with the query type.
-                * @param $filters array with key => value of filters.
-                * @return int with object count.
-                */
-               public function get_count( string $search_for, string 
$search_type, array $filters )
-               {
-                       return $this->get_query_count($this->get_query('', 
false, $search_for, $search_type, $filters, true));
-               }
-
-               /**
-                * Implementing classes must return the name of the field used 
in the query
-                * returned from get_query().
-                * 
-                * @return string with name of id field.
-                */
-               protected abstract function get_id_field_name();
-
-               /**
-                * Returns SQL for retrieving matching objects or object count.
-                *
-                * @param $start_index int with index of first object.
-                * @param $num_of_objects int with max number of objects to 
return.
-                * @param $sort_field string representing the object field to 
sort on.
-                * @param $ascending bool true for ascending sort on sort 
field, false
-                * for descending.
-                * @param $search_for string with free text search query.
-                * @param $search_type string with the query type.
-                * @param $filters array with key => value of filters.
-                * @param $return_count bool telling to return only the count 
of the
-                * matching objects, or the objects themself.
-                * @return string with SQL.
-                */
-               protected abstract function get_query( string $sort_field, bool 
$ascending, string $search_for, string $search_type, array $filters, bool 
$return_count );
-
-               protected abstract function populate( int $object_id, &$object 
);
-
-               protected abstract function add( &$object );
-
-               protected abstract function update( $object );
-
-               /**
-                * Store the object in the database.  If the object has no ID 
it is assumed to be new and
-                * inserted for the first time.  The object is then updated 
with the new insert id.
-                */
-               public function store( &$object )
-               {
-                       if ($object->validates())
-                       {
-                               if ($object->get_id() > 0)
-                               {
-                                       // We can assume this composite came 
from the database since it has an ID. Update the existing row
-                                       return $this->update($object);
-                               }
-                               else
-                               {
-                                       // This object does not have an ID, so 
will be saved as a new DB row
-                                       return $this->add($object);
-                               }
-                       }
-
-                       // The object did not validate
-                       return false;
-               }
-
+       
                protected function generate_secret( $length = 10 )
                {
                        return substr(base64_encode(rand(1000000000, 
9999999999)), 0, $length);

Modified: 
branches/dev-syncromind-2/activitycalendar/inc/class.socontactperson.inc.php
===================================================================
--- 
branches/dev-syncromind-2/activitycalendar/inc/class.socontactperson.inc.php    
    2016-06-25 17:59:05 UTC (rev 15337)
+++ 
branches/dev-syncromind-2/activitycalendar/inc/class.socontactperson.inc.php    
    2016-06-25 18:08:09 UTC (rev 15338)
@@ -49,6 +49,8 @@
                          $order = "ORDER BY id $dir";
                          }
                         */
+//                     $this->sort_field = str_ireplace(" {$dir}", '', 
$sort_field);
+
                        if ($search_for)
                        {
                                $query = $this->marshal($search_for, 'string');

Modified: branches/dev-syncromind-2/activitycalendar/inc/class.sogroup.inc.php
===================================================================
--- branches/dev-syncromind-2/activitycalendar/inc/class.sogroup.inc.php        
2016-06-25 17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/activitycalendar/inc/class.sogroup.inc.php        
2016-06-25 18:08:09 UTC (rev 15338)
@@ -46,8 +46,11 @@
                        if ($sort_field != null)
                        {
                                $dir = $ascending ? 'ASC' : 'DESC';
-                               $order = "ORDER BY bb_group.id $dir";
+                               $sort_field = 'bb_group.id';
+                               $order = "ORDER BY $sort_field $dir";
                        }
+
+                       $this->sort_field = str_ireplace(" {$dir}", '', 
$sort_field);
                        if ($search_for)
                        {
                                $query = $this->marshal($search_for, 'string');

Modified: 
branches/dev-syncromind-2/activitycalendar/inc/class.soorganization.inc.php
===================================================================
--- branches/dev-syncromind-2/activitycalendar/inc/class.soorganization.inc.php 
2016-06-25 17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/activitycalendar/inc/class.soorganization.inc.php 
2016-06-25 18:08:09 UTC (rev 15338)
@@ -47,14 +47,19 @@
 
                        //Add columns to this array to include them in the query
                        $columns = array();
+                       $dir = $ascending ? 'ASC' : 'DESC';
 
                        if ($sort_field != null && !$return_count)
                        {
-                               if ($sort_field == 'identifier')
+                               if ($sort_field == 'identifier' )
                                {
                                        $sort_field = 'org.id';
                                }
-                               $dir = $ascending ? 'ASC' : 'DESC';
+                               else if ( $sort_field == 'organization_number')
+                               {
+                                       $sort_field = 'org.orgno';
+                               }
+
                                $order = "ORDER BY $sort_field $dir";
                        }
                        else if (!$return_count)
@@ -62,6 +67,9 @@
                                $dir = $ascending ? 'ASC' : 'DESC';
                                $order = "ORDER BY org.name $dir";
                        }
+
+                       $this->sort_field = str_ireplace(" {$dir}", '', 
$sort_field);
+
                        if ($search_for)
                        {
                                $query = $this->marshal($search_for, 'string');

Modified: 
branches/dev-syncromind-2/activitycalendar/inc/class.uiactivities.inc.php
===================================================================
--- branches/dev-syncromind-2/activitycalendar/inc/class.uiactivities.inc.php   
2016-06-25 17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/activitycalendar/inc/class.uiactivities.inc.php   
2016-06-25 18:08:09 UTC (rev 15338)
@@ -705,7 +705,6 @@
                        $columns = phpgw::get_var('columns');
 
                        $start_index = phpgw::get_var('start', 'int', 
'REQUEST', 0);
-                       $num_of_objects = (phpgw::get_var('length', 'int') <= 
0) ? $this->user_rows_per_page : phpgw::get_var('length', 'int');
                        $sort_field = ($columns[$order[0]['column']]['data']) ? 
$columns[$order[0]['column']]['data'] : 'id';
                        $sort_ascending = ($order[0]['dir'] == 'desc') ? false 
: true;
                        // Form variables
@@ -716,6 +715,10 @@
                        $result_objects = array();
                        $result_count = 0;
 
+                       $length = phpgw::get_var('length', 'int');
+                       $user_rows_per_page = $length > 0 ? $length : 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $num_of_objects = $length == -1 ? null : 
$user_rows_per_page;
+
                        $export = phpgw::get_var('export', 'bool');
                        if ($export)
                        {

Modified: branches/dev-syncromind-2/activitycalendar/inc/class.uiarena.inc.php
===================================================================
--- branches/dev-syncromind-2/activitycalendar/inc/class.uiarena.inc.php        
2016-06-25 17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/activitycalendar/inc/class.uiarena.inc.php        
2016-06-25 18:08:09 UTC (rev 15338)
@@ -234,7 +234,6 @@
                        $columns = phpgw::get_var('columns');
 
                        $start_index = phpgw::get_var('start', 'int', 
'REQUEST', 0);
-                       $num_of_objects = (phpgw::get_var('length', 'int') <= 
0) ? $this->user_rows_per_page : phpgw::get_var('length', 'int');
                        $sort_field = ($columns[$order[0]['column']]['data']) ? 
$columns[$order[0]['column']]['data'] : 'id';
                        $sort_ascending = ($order[0]['dir'] == 'desc') ? false 
: true;
                        // Form variables
@@ -247,6 +246,10 @@
                        //Retrieve the type of query and perform type specific 
logic
                        $query_type = phpgw::get_var('type');
 
+                       $length = phpgw::get_var('length', 'int');
+                       $user_rows_per_page = $length > 0 ? $length : 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $num_of_objects = $length == -1 ? null : 
$user_rows_per_page;
+
                        $export = phpgw::get_var('export', 'bool');
                        if ($export)
                        {

Modified: 
branches/dev-syncromind-2/activitycalendar/inc/class.uiorganization.inc.php
===================================================================
--- branches/dev-syncromind-2/activitycalendar/inc/class.uiorganization.inc.php 
2016-06-25 17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/activitycalendar/inc/class.uiorganization.inc.php 
2016-06-25 18:08:09 UTC (rev 15338)
@@ -538,7 +538,6 @@
                        $columns = phpgw::get_var('columns');
 
                        $start_index = phpgw::get_var('start', 'int', 
'REQUEST', 0);
-                       $num_of_objects = (phpgw::get_var('length', 'int') <= 
0) ? $this->user_rows_per_page : phpgw::get_var('length', 'int');
                        $sort_field = ($columns[$order[0]['column']]['data']) ? 
$columns[$order[0]['column']]['data'] : 'identifier';
                        $sort_ascending = ($order[0]['dir'] == 'desc') ? false 
: true;
                        // Form variables
@@ -549,6 +548,10 @@
                        $result_objects = array();
                        $result_count = 0;
 
+                       $length = phpgw::get_var('length', 'int');
+                       $user_rows_per_page = $length > 0 ? $length : 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $num_of_objects = $length == -1 ? null : 
$user_rows_per_page;
+
                        $export = phpgw::get_var('export', 'bool');
                        if ($export)
                        {


Property changes on: branches/dev-syncromind-2/booking
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/stavangerkommune/booking:9468-12740,12743-12875,12986
/trunk/booking:14937-15027,15165-15215,15253-15304
   + /branches/stavangerkommune/booking:9468-12740,12743-12875,12986
/trunk/booking:14937-15027,15165-15215,15253-15304,15306-15337

Modified: branches/dev-syncromind-2/booking/inc/class.soallocation.inc.php
===================================================================
--- branches/dev-syncromind-2/booking/inc/class.soallocation.inc.php    
2016-06-25 17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/booking/inc/class.soallocation.inc.php    
2016-06-25 18:08:09 UTC (rev 15338)
@@ -270,6 +270,7 @@
 
                function check_for_booking( $id )
                {
+                       $id = (int) $id;
                        $sql = "SELECT id FROM bb_booking  WHERE allocation_id 
= ($id)";
 
                        $this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
@@ -282,14 +283,16 @@
 
                public function delete_allocation( $id )
                {
+                       $id = (int) $id;
                        $db = $this->db;
+                       $db->transaction_begin();
                        $table_name = $this->table_name . '_resource';
                        $sql = "DELETE FROM $table_name WHERE allocation_id = 
($id)";
                        $db->query($sql, __LINE__, __FILE__);
                        $table_name = $this->table_name;
                        $sql = "DELETE FROM $table_name WHERE id = ($id)";
                        $db->query($sql, __LINE__, __FILE__);
-                       return True;
+                       return  $db->transaction_commit();
                }
 
                public function update_id_string()

Modified: branches/dev-syncromind-2/booking/inc/class.soapplication.inc.php
===================================================================
--- branches/dev-syncromind-2/booking/inc/class.soapplication.inc.php   
2016-06-25 17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/booking/inc/class.soapplication.inc.php   
2016-06-25 18:08:09 UTC (rev 15338)
@@ -304,7 +304,7 @@
                       WHERE ba.id = bar.allocation_id
                       AND bar.resource_id in ($rids)
                       AND ((ba.from_ < '$from_' AND ba.to_ > '$from_')
-                      OR (ba.from_ >= '$from_' AND ba.to_ <= '$to_')
+                      OR (ba.from_ > '$from_' AND ba.to_ < '$to_')
                       OR (ba.from_ < '$to_' AND ba.to_ > '$to_'))
                       UNION
                       SELECT be.id
@@ -313,7 +313,7 @@
                       AND be.id = bed.event_id
                       AND ber.resource_id in ($rids)
                       AND ((bed.from_ < '$from_' AND bed.to_ > '$from_')
-                      OR (bed.from_ >= '$from_' AND bed.to_ <= '$to_')
+                      OR (bed.from_ > '$from_' AND bed.to_ < '$to_')
                       OR (bed.from_ < '$to_' AND bed.to_ > '$to_'))";
 
                        $this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);

Modified: branches/dev-syncromind-2/booking/inc/class.sobooking.inc.php
===================================================================
--- branches/dev-syncromind-2/booking/inc/class.sobooking.inc.php       
2016-06-25 17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/booking/inc/class.sobooking.inc.php       
2016-06-25 18:08:09 UTC (rev 15338)
@@ -165,8 +165,8 @@
                                $this->db->query("SELECT e.id FROM bb_event e 
                                                                        WHERE 
e.active = 1 AND 
                                                                        e.id IN 
(SELECT event_id FROM bb_event_resource WHERE resource_id IN ($rids)) AND
-                                                                       
((e.from_ >= '$start' AND e.from_ < '$end') OR 
-                                                                        (e.to_ 
> '$start' AND e.to_ <= '$end') OR 
+                                                                       
((e.from_ > '$start' AND e.from_ < '$end') OR 
+                                                                        (e.to_ 
> '$start' AND e.to_ < '$end') OR 
                                                                         
(e.from_ < '$start' AND e.to_ > '$end'))", __LINE__, __FILE__);
                                if ($this->db->next_record())
                                {
@@ -176,8 +176,8 @@
                                $this->db->query("SELECT a.id FROM 
bb_allocation a 
                                                                        WHERE 
a.active = 1 AND a.id<>$allocation_id AND 
                                                                        a.id IN 
(SELECT allocation_id FROM bb_allocation_resource WHERE resource_id IN ($rids)) 
AND
-                                                                       
((a.from_ >= '$start' AND a.from_ < '$end') OR 
-                                                                        (a.to_ 
> '$start' AND a.to_ <= '$end') OR 
+                                                                       
((a.from_ > '$start' AND a.from_ < '$end') OR 
+                                                                        (a.to_ 
> '$start' AND a.to_ < '$end') OR 
                                                                         
(a.from_ < '$start' AND a.to_ > '$end'))", __LINE__, __FILE__);
                                if ($this->db->next_record())
                                {
@@ -188,8 +188,8 @@
                                $this->db->query("SELECT b.id FROM bb_booking b 
                                                                        WHERE  
b.active = 1 AND b.id<>$booking_id AND 
                                                                        b.id IN 
(SELECT booking_id FROM bb_booking_resource WHERE resource_id IN ($rids)) AND
-                                                                       
((b.from_ >= '$start' AND b.from_ < '$end') OR 
-                                                                        (b.to_ 
> '$start' AND b.to_ <= '$end') OR 
+                                                                       
((b.from_ > '$start' AND b.from_ < '$end') OR 
+                                                                        (b.to_ 
> '$start' AND b.to_ < '$end') OR 
                                                                         
(b.from_ < '$start' AND b.to_ > '$end'))", __LINE__, __FILE__);
                                if ($this->db->next_record())
                                {
@@ -434,6 +434,7 @@
                public function delete_booking( $id )
                {
                        $db = $this->db;
+                       $db->transaction_begin();
                        $table_name = $this->table_name . '_resource';
                        $sql = "DELETE FROM $table_name WHERE booking_id = 
($id)";
                        $db->query($sql, __LINE__, __FILE__);
@@ -446,15 +447,18 @@
                        $table_name = $this->table_name;
                        $sql = "DELETE FROM $table_name WHERE id = ($id)";
                        $db->query($sql, __LINE__, __FILE__);
+                       return  $db->transaction_commit();
                }
 
                public function delete_allocation( $id )
                {
                        $db = $this->db;
+                       $db->transaction_begin();
                        $sql = "DELETE FROM bb_allocation_resource WHERE 
allocation_id = ($id)";
                        $db->query($sql, __LINE__, __FILE__);
                        $sql = "DELETE FROM bb_allocation WHERE id = ($id)";
                        $db->query($sql, __LINE__, __FILE__);
+                       return  $db->transaction_commit();
                }
 
                public function got_no_allocation( $booking )

Modified: branches/dev-syncromind-2/booking/inc/class.socommon.inc.php
===================================================================
--- branches/dev-syncromind-2/booking/inc/class.socommon.inc.php        
2016-06-25 17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/booking/inc/class.socommon.inc.php        
2016-06-25 18:08:09 UTC (rev 15338)
@@ -289,6 +289,10 @@
 
                function read_single( $id )
                {
+                       if (!$id)
+                       {
+                               return null;
+                       }
                        $row = array();
                        $pk_params = $this->primary_key_conditions($id);
                        $cols_joins = $this->_get_cols_and_joins();
@@ -637,6 +641,7 @@
                {
                        $values = 
$this->marshal_field_values($this->get_table_values($entry, __FUNCTION__));
 
+                       $this->db->transaction_begin();
                        $this->db->query('INSERT INTO ' . $this->table_name . ' 
(' . join(',', array_keys($values)) . ') VALUES(' . join(',', $values) . ')', 
__LINE__, __FILE__);
                        $id = $this->db->get_last_insert_id($this->table_name, 
'id');
                        foreach ($this->fields as $field => $params)
@@ -695,6 +700,9 @@
                                        }
                                }
                        }
+
+                       $this->db->transaction_commit();
+
                        $receipt['id'] = $id;
                        $receipt['message'][] = array('msg' => lang('Entity %1 
has been saved', $receipt['id']));
                        return $receipt;

Modified: branches/dev-syncromind-2/booking/inc/class.soevent.inc.php
===================================================================
--- branches/dev-syncromind-2/booking/inc/class.soevent.inc.php 2016-06-25 
17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/booking/inc/class.soevent.inc.php 2016-06-25 
18:08:09 UTC (rev 15338)
@@ -312,6 +312,10 @@
                public function delete_event( $id )
                {
                        $db = $this->db;
+                       $db->transaction_begin();
+                       $table_name = $this->table_name . '_cost';
+                       $sql = "DELETE FROM $table_name WHERE event_id = ($id)";
+                       $db->query($sql, __LINE__, __FILE__);
                        $table_name = $this->table_name . '_comment';
                        $sql = "DELETE FROM $table_name WHERE event_id = ($id)";
                        $db->query($sql, __LINE__, __FILE__);
@@ -330,7 +334,7 @@
                        $table_name = $this->table_name;
                        $sql = "DELETE FROM $table_name WHERE id = ($id)";
                        $db->query($sql, __LINE__, __FILE__);
-                       return True;
+                       return  $db->transaction_commit();
                }
 
                public function update_id_string()

Modified: branches/dev-syncromind-2/booking/inc/class.soseason.inc.php
===================================================================
--- branches/dev-syncromind-2/booking/inc/class.soseason.inc.php        
2016-06-25 17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/booking/inc/class.soseason.inc.php        
2016-06-25 18:08:09 UTC (rev 15338)
@@ -389,7 +389,9 @@
 
                function delete( $id )
                {
+                       $this->db->transaction_begin();
                        $this->db->query("DELETE FROM 
bb_wtemplate_alloc_resource WHERE allocation_id=" . intval($id), __LINE__, 
__FILE__);
                        $this->db->query("DELETE FROM bb_wtemplate_alloc WHERE 
id=" . intval($id), __LINE__, __FILE__);
+                       return  $this->db->transaction_commit();
                }
        }
\ No newline at end of file

Modified: branches/dev-syncromind-2/booking/inc/class.uiapplication.inc.php
===================================================================
--- branches/dev-syncromind-2/booking/inc/class.uiapplication.inc.php   
2016-06-25 17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/booking/inc/class.uiapplication.inc.php   
2016-06-25 18:08:09 UTC (rev 15338)
@@ -481,7 +481,7 @@
                                $association['link'] = 
self::link(array('menuaction' => 'booking.ui' . $association['type'] . '.edit',
                                                'id' => $association['id']));
                                $association['dellink'] = 
self::link(array('menuaction' => 'booking.ui' . $association['type'] . 
'.delete',
-                                               'event_id' => 
$association['id'], 'application_id' => $association['application_id']));
+                                               'id' => $association['id'], 
'application_id' => $association['application_id']));
                                $association['type'] = 
lang($association['type']);
                        }
                        return $associations;
@@ -955,7 +955,7 @@
                        );
                        foreach ($copy as $f)
                        {
-                               $event[] = array($f, 
htmlentities($application[$f]));
+                               $event[] = array($f, 
htmlentities(html_entity_decode($application[$f])), ENT_QUOTES | 
ENT_SUBSTITUTE);
                        }
                        foreach ($application['agegroups'] as $ag)
                        {

Modified: branches/dev-syncromind-2/booking/inc/class.uicommon.inc.php
===================================================================
--- branches/dev-syncromind-2/booking/inc/class.uicommon.inc.php        
2016-06-25 17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/booking/inc/class.uicommon.inc.php        
2016-06-25 18:08:09 UTC (rev 15338)
@@ -780,28 +780,28 @@
                        $js = <<<JS
 
                        $(function() {
-                                
-                                $.each($('.newaddedpicker'), function(i, v){
-                                var id = v.id;
-                                v.classList.remove('newaddedpicker');
-                                $( "#"+id ).{$type}picker({
-                                    dateFormat: '{$dateformat}',
-                                    showWeek: true,
-                                    changeMonth: true,
-                                    changeYear: true,
-                                    showOn: "button",
-                                    showButtonPanel:true,
-                                    buttonImage: "{$img_cal}",
-                                    buttonText: "{$lang_select_date}",
-                                    buttonImageOnly: true
-                                });
-                            });
 
+                                       $.each($('.newaddedpicker'), 
function(i, v){
+                                       var id = v.id;
+                                       v.classList.remove('newaddedpicker');
+                                       $( "#"+id ).{$type}picker({
+                                               dateFormat: '{$dateformat}',
+                                               showWeek: true,
+                                               changeMonth: true,
+                                               changeYear: true,
+                                               showOn: "button",
+                                               showButtonPanel:true,
+                                               buttonImage: "{$img_cal}",
+                                               buttonText: 
"{$lang_select_date}",
+                                               buttonImageOnly: true
+                                       });
+                               });
+
                                $('#add-date-link').click(function(){
                                        var add = $(this);
                                        var html = '';
                                     
-                                        this.counter = 
$('.date-container').length - 1;
+                                       this.counter = 
$('.date-container').length - 1;
 
                                        if (!this.counter) { this.counter = 0; }
                                     

Modified: branches/dev-syncromind-2/booking/inc/class.uidocument.inc.php
===================================================================
--- branches/dev-syncromind-2/booking/inc/class.uidocument.inc.php      
2016-06-25 17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/booking/inc/class.uidocument.inc.php      
2016-06-25 18:08:09 UTC (rev 15338)
@@ -171,13 +171,13 @@
                                                        'label' => 
lang('Category'),
                                                ),
                                                array(
-                                                       'key' => 'opcion_edit',
+                                                       'key' => 'option_edit',
                                                        'label' => lang('Edit'),
                                                        'formatter' => 
'JqueryPortico.formatLinkGeneric',
                                                        'sortable' => false
                                                ),
                                                array(
-                                                       'key' => 
'opcion_delete',
+                                                       'key' => 
'option_delete',
                                                        'label' => 
lang('Delete'),
                                                        'formatter' => 
'JqueryPortico.formatLinkGeneric',
                                                        'sortable' => false
@@ -214,9 +214,13 @@
 //                             $document['actions'] = $document_actions;
 
                                if ($this->bo->allow_write($document))
-                                       $document['opcion_edit'] = 
$this->get_owner_typed_link('edit', array('id' => $document['id']));
+                               {
+                                       $document['option_edit'] = 
$this->get_owner_typed_link('edit', array('id' => $document['id']));
+                               }
                                if ($this->bo->allow_delete($document))
-                                       $document['opcion_delete'] = 
$this->get_owner_typed_link('delete', array('id' => $document['id']));
+                               {
+                                       $document['option_delete'] = 
$this->get_owner_typed_link('delete', array('id' => $document['id']));
+                               }
                        }
                        if (phpgw::get_var('no_images'))
                        {

Modified: branches/dev-syncromind-2/booking/inc/class.uidocumentation.inc.php
===================================================================
--- branches/dev-syncromind-2/booking/inc/class.uidocumentation.inc.php 
2016-06-25 17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/booking/inc/class.uidocumentation.inc.php 
2016-06-25 18:08:09 UTC (rev 15338)
@@ -62,13 +62,13 @@
                                                        'label' => 
lang('Category'),
                                                ),
                                                array(
-                                                       'key' => 'opcion_edit',
+                                                       'key' => 'option_edit',
                                                        'label' => lang('Edit'),
                                                        'formatter' => 
'JqueryPortico.formatLinkGeneric',
                                                        'sortable' => false
                                                ),
                                                array(
-                                                       'key' => 
'opcion_delete',
+                                                       'key' => 
'option_delete',
                                                        'label' => 
lang('Delete'),
                                                        'formatter' => 
'JqueryPortico.formatLinkGeneric',
                                                        'sortable' => false
@@ -101,9 +101,9 @@
 //                             $document_actions[] = 
 //                             $document_actions[] = 
 
-                               $document['opcion_edit'] = 
self::link(array('menuaction' => $this->module . '.uidocumentation.edit',
+                               $document['option_edit'] = 
self::link(array('menuaction' => $this->module . '.uidocumentation.edit',
                                                'id' => $document['id']));
-                               $document['opcion_delete'] = 
self::link(array('menuaction' => $this->module . '.uidocumentation.delete',
+                               $document['option_delete'] = 
self::link(array('menuaction' => $this->module . '.uidocumentation.delete',
                                                'id' => $document['id']));
                        }
                        return $this->jquery_results($documents);

Modified: branches/dev-syncromind-2/booking/inc/class.uievent.inc.php
===================================================================
--- branches/dev-syncromind-2/booking/inc/class.uievent.inc.php 2016-06-25 
17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/booking/inc/class.uievent.inc.php 2016-06-25 
18:08:09 UTC (rev 15338)
@@ -676,6 +676,10 @@
 
                        list($event, $errors) = 
$this->extract_and_validate($event);
 
+                       if ($event['description'])
+                       {
+                               $event['description'] =  
html_entity_decode($event['description']);
+                       }
                        if ($event['customer_organization_number'])
                        {
                                $orginfo = 
$this->bo->so->get_org($event['customer_organization_number']);
@@ -1023,7 +1027,7 @@
 
                public function delete()
                {
-                       $event_id = phpgw::get_var('event_id', 'int');
+                       $event_id = phpgw::get_var('id', 'int');
                        $application_id = phpgw::get_var('application_id', 
'int');
 
                        if ($GLOBALS['phpgw']->acl->check('admin', 
phpgwapi_acl::ADD, 'booking'))

Modified: branches/dev-syncromind-2/booking/inc/class.uipermission.inc.php
===================================================================
--- branches/dev-syncromind-2/booking/inc/class.uipermission.inc.php    
2016-06-25 17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/booking/inc/class.uipermission.inc.php    
2016-06-25 18:08:09 UTC (rev 15338)
@@ -157,13 +157,13 @@
                                                        'label' => lang('Role'),
                                                ),
                                                array(
-                                                       'key' => 'opcion_edit',
+                                                       'key' => 'option_edit',
                                                        'label' => lang('Edit'),
                                                        'formatter' => 
'JqueryPortico.formatLinkGeneric',
                                                        'sortable' => false
                                                ),
                                                array(
-                                                       'key' => 
'opcion_delete',
+                                                       'key' => 
'option_delete',
                                                        'label' => 
lang('Delete'),
                                                        'formatter' => 
'JqueryPortico.formatLinkGeneric',
                                                        'sortable' => false
@@ -203,10 +203,14 @@
 
                                $permission_actions = array();
                                if ($this->bo->allow_write($permission))
-                                       $permission['opcion_edit'] = 
$this->get_object_typed_link('edit', array('id' => $permission['id']));
+                               {
+                                       $permission['option_edit'] = 
$this->get_object_typed_link('edit', array('id' => $permission['id']));
+                               }
                                if ($this->bo->allow_delete($permission))
-                                       $permission['opcion_delete'] = 
$this->get_object_typed_link('delete', array(
+                               {
+                                       $permission['option_delete'] = 
$this->get_object_typed_link('delete', array(
                                                'id' => $permission['id']));
+                               }
 
                                $account_id = 
$GLOBALS['phpgw']->accounts->name2id($permission['subject_name']);
                                if($account_id)

Modified: branches/dev-syncromind-2/booking/inc/class.uiseason.inc.php
===================================================================
--- branches/dev-syncromind-2/booking/inc/class.uiseason.inc.php        
2016-06-25 17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/booking/inc/class.uiseason.inc.php        
2016-06-25 18:08:09 UTC (rev 15338)
@@ -340,7 +340,18 @@
                        $active_tab = 'generic';
 
                        $season['tabs'] = 
phpgwapi_jquery::tabview_generate($tabs, $active_tab);
+                       //exclude the seconds
+                       if(isset($boundary['from_']))
+                       {
+                               $from_arr = explode(':',$boundary['from_']);
+                               $to_arr = explode(':',$boundary['to_']);
+                               $boundary['from_'] = 
"{$from_arr[0]}:{$from_arr[1]}";
+                               $boundary['to_'] = "{$to_arr[0]}:{$to_arr[1]}";
+                       }
 
+                       $GLOBALS['phpgw']->jqcal->add_listener('field_from', 
'time');
+                       $GLOBALS['phpgw']->jqcal->add_listener('field_to', 
'time');
+
                        self::render_template('season_boundaries', 
array('boundary' => $boundary, 'boundaries' => $boundaries,
                                'season' => $season));
                }

Modified: branches/dev-syncromind-2/booking/js/booking/application.js
===================================================================
--- branches/dev-syncromind-2/booking/js/booking/application.js 2016-06-25 
17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/booking/js/booking/application.js 2016-06-25 
18:08:09 UTC (rev 15338)
@@ -3,6 +3,12 @@
 
 $(document).ready(function ()
 {
+       $("#start_date").change(function ()
+       {
+               $("#end_date").val($("#start_date").val());
+       });
+
+
        
JqueryPortico.autocompleteHelper('bookingfrontend/?menuaction=bookingfrontend.uibuilding.index&phpgw_return_as=json&',
                'field_building_name', 'field_building_id', 
'building_container');
 

Modified: branches/dev-syncromind-2/booking/js/booking/schedule.js
===================================================================
--- branches/dev-syncromind-2/booking/js/booking/schedule.js    2016-06-25 
17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/booking/js/booking/schedule.js    2016-06-25 
18:08:09 UTC (rev 15338)
@@ -12,18 +12,38 @@
        var datestr = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + 
date.getDate();
        url += '&date=' + datestr;
 
-       var lang = {
-               WEEKDAYS_FULL: [
-                       'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 
'Friday', 'Saturday'
-               ],
-               MONTHS_LONG: [
-                       'January', 'February', 'March', 'April', 'May', 'June', 
'July', 'August', 'September', 'October', 'November', 'December'
-               ],
-               LBL_TIME: 'Time',
-               LBL_RESOURCE: 'Resource',
-               LBL_WEEK: 'Week'
-       };
+       var detected_lang = navigator.language || navigator.userLanguage;
+       var lang = {};
 
+       if(detected_lang == 'no' || detected_lang == 'nn' || detected_lang == 
'nb')
+       {
+               lang = {
+                       WEEKDAYS_FULL: [
+                               'Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 
'Torsdag', 'Fredag', 'Lørdag'
+                       ],
+                       MONTHS_LONG: [
+                               'Januar', 'Februar', 'Mars', 'April', 'May', 
'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Desember'
+                       ],
+                       LBL_TIME: 'Tidsrom',
+                       LBL_RESOURCE: 'Ressurs',
+                       LBL_WEEK: 'Uke'
+               };
+       }
+       else
+       {
+               lang = {
+                       WEEKDAYS_FULL: [
+                               'Sunday', 'Monday', 'Tuesday', 'Wednesday', 
'Thursday', 'Friday', 'Saturday'
+                       ],
+                       MONTHS_LONG: [
+                               'January', 'February', 'March', 'April', 'May', 
'June', 'July', 'August', 'September', 'October', 'November', 'December'
+                       ],
+                       LBL_TIME: 'Time',
+                       LBL_RESOURCE: 'Resource',
+                       LBL_WEEK: 'Week'
+               };
+       }
+
        var colDefs = [
                {key: 'time', label: date.getFullYear() + '<br/>' + 
lang['LBL_TIME']}];
        if (includeResource)

Modified: branches/dev-syncromind-2/booking/setup/phpgw_no.lang
===================================================================
--- branches/dev-syncromind-2/booking/setup/phpgw_no.lang       2016-06-25 
17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/booking/setup/phpgw_no.lang       2016-06-25 
18:08:09 UTC (rev 15338)
@@ -588,7 +588,6 @@
 Cancelation of bookings from   booking no      Avbestilling av bookinger fra
 Booking system settings        booking no      Bookingmodul systeminnstillinger
 Frontend users can delete bookings and allocations     booking no      Brukere 
av frontend kan slette bookinger og tildelinger direkte
-All that borrow premises from Stavanger Kommune must verify that they have 
read the terms and conditions, this is usually fire regulations and house 
rules.    booking no      Alle som leier lokaler hos Bergen kommune må bekrefte 
at de har lest betingelsene, dette gjelder som regel brannforskrifter og 
husreglement.
 Delete Information     booking no      Hvis du kun skal slette tildeling på 
valgt dato, velg Slett-knappen nederst og tiden blir vist som ledig i 
kalenderen, og kan tildeles andre klubber/org.
 Delete information2    booking no      Skal du slette flere kan du velge Ut 
sesong eller Slett til og velg en dato, du kan også velge intervall (f.eks. 
annen hver uke).
 Booking Delete information     booking no      Hvis du skal slette booking på 
valgt dato, velg Slett-knappen nederst.
@@ -682,4 +681,5 @@
 Mail text for comment added    booking no      Ekstra epost tekst for kommentar
 organzations_ids_description   booking no      Her kan du legge inn en komma 
separert liste med organisasjons IDer som vil få epost viss noen avbestiller 
denne ressursen.
 organzations_ids       booking no      Organisasjons IDer
-cost history   booking no      Prishistorikk
\ No newline at end of file
+cost history   booking no      Prishistorikk
+extra info     booking no      Tileggsinformasjon
\ No newline at end of file

Modified: branches/dev-syncromind-2/booking/templates/base/application.xsl
===================================================================
--- branches/dev-syncromind-2/booking/templates/base/application.xsl    
2016-06-25 17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/booking/templates/base/application.xsl    
2016-06-25 18:08:09 UTC (rev 15338)
@@ -205,12 +205,14 @@
                                                                        
<xsl:value-of select="application/description"/>
                                                                </span>
                                                        </div>
-                                                       <!--<div 
class="pure-control-group">
+                                                       <div 
class="pure-control-group">
                                                                <label>
-                                                                       
<h4><xsl:value-of select="config/application_equipment"/></h4>
+                                                                       <h4>
+                                                                               
<xsl:value-of select="php:function('lang', 'Extra info')" />
+                                                                       </h4>
                                                                </label>
                                                                <xsl:value-of 
select="application/equipment"/>
-                                                       </div>-->
+                                                       </div>
                                                </div>
 
                                                <div class="pure-u-1 
pure-u-md-1-2 pure-u-lg-1-3">
@@ -450,9 +452,11 @@
                                                                </legend>
                                                        </div>
                                                        <div 
class="pure-control-group">
-                                                               <p>
-                                                                       
<xsl:value-of select="php:function('lang', 'All that borrow premises from 
Stavanger Kommune must verify that they have read the terms and conditions, 
this is usually fire regulations and house rules.')" />
-                                                               </p>
+                                                               <xsl:if 
test="config/application_terms">
+                                                                       <p>
+                                                                               
<xsl:value-of select="config/application_terms"/>
+                                                                       </p>
+                                                               </xsl:if>
                                                                <br />
                                                                <div 
id='regulation_documents'>&nbsp;</div>
                                                                <br />

Modified: branches/dev-syncromind-2/booking/templates/base/application_edit.xsl
===================================================================
--- branches/dev-syncromind-2/booking/templates/base/application_edit.xsl       
2016-06-25 17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/booking/templates/base/application_edit.xsl       
2016-06-25 18:08:09 UTC (rev 15338)
@@ -95,8 +95,13 @@
                                                        </div>
                                                        <div 
class="pure-control-group">
                                                                <label 
for="field_equipment">
-                                                                       
<xsl:value-of select="php:function('lang', 'Equipment')" />
+                                                                       
<xsl:value-of select="php:function('lang', 'Extra info')" />
                                                                </label>
+                                                               <xsl:if 
test="config/application_equipment">
+                                                                       <p>
+                                                                               
<xsl:value-of select="config/application_equipment"/>
+                                                                       </p>
+                                                               </xsl:if>
                                                                <textarea 
id="field_equipment" class="full-width pure-u-1 pure-u-sm-1-2 pure-u-lg-1-3" 
name="equipment">
                                                                        
<xsl:value-of select="application/equipment"/>
                                                                </textarea>

Modified: branches/dev-syncromind-2/booking/templates/base/building.xsl
===================================================================
--- branches/dev-syncromind-2/booking/templates/base/building.xsl       
2016-06-25 17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/booking/templates/base/building.xsl       
2016-06-25 18:08:09 UTC (rev 15338)
@@ -192,8 +192,8 @@
         var permissionsURL   = 
'index.php?menuaction=booking.uipermission_building.index&sort=name&filter_object_id='
 + building_id + '&phpgw_return_as=json&';
         ]]>
                var colDefsResources = [{key: 'sort', label: lang['Sort 
order']},{key: 'name', label: lang['Name'], formatter: genericLink}, {key: 
'type', label: lang['Resource Type']}];
-               var colDefsDocuments = [{key: 'name', label: lang['Name'], 
formatter: genericLink}, {key: 'category', label: lang['Category']}, {key: 
'actions', label: lang['Actions'], formatter: genericLink(lang['Edit'], 
lang['Delete'])}];
-               var colDefsPermissions = [{key: 'subject_name', label: 
lang['Account']}, {key: 'role', label: lang['Role']}, {key: 'actions', label: 
lang['Actions'], formatter: genericLink({name: 'edit', label: 'Edit'}, 
lang['Delete'])}];
+               var colDefsDocuments = [{key: 'name', label: lang['Name'], 
formatter: genericLink}, {key: 'category', label: lang['Category']}, {key: 
'actions', label: lang['Actions'], formatter: genericLink({name: 'edit', 
label:lang['Edit']}, {name: 'delete', label:lang['Delete']})}];
+               var colDefsPermissions = [{key: 'subject_name', label: 
lang['Account']}, {key: 'role', label: lang['Role']}, {key: 'actions', label: 
lang['Actions'], formatter: genericLink({name: 'edit', label: 'Edit'}, {name: 
'delete', label:lang['Delete']})}];
 
                
createTable('resources_container',resourcesURL,colDefsResources);
                
createTable('documents_container',documentsURL,colDefsDocuments);

Modified: branches/dev-syncromind-2/booking/templates/base/resource.xsl
===================================================================
--- branches/dev-syncromind-2/booking/templates/base/resource.xsl       
2016-06-25 17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/booking/templates/base/resource.xsl       
2016-06-25 18:08:09 UTC (rev 15338)
@@ -123,12 +123,12 @@
                var colDefsDocuments = [
                {key: 'name', label: lang['Name'], formatter: genericLink},
                {key: 'category', label: lang['Category']},
-               {key: 'actions', label: lang['Actions'], formatter: 
genericLink(lang['Edit'], lang['Delete'])}
+               {key: 'actions', label: lang['Actions'], formatter: 
genericLink({name: 'edit', label:lang['Edit']}, {name: 'delete', 
label:lang['Delete']})}
                ];
                var colDefsPermissions = [
                {key: 'subject_name', label: lang['Account']},
                {key: 'role', label: lang['Role']},
-               {key: 'actions', label: lang['Actions'], formatter: 
genericLink(lang['Edit'], lang['Delete'])}
+               {key: 'actions', label: lang['Actions'], formatter: 
genericLink({name: 'edit', label:lang['Edit']}, {name: 'delete', 
label:lang['Delete']})}
                ];
 
                
createTable('documents_container',documentsURL,colDefsDocuments);

Modified: branches/dev-syncromind-2/booking/templates/base/season.xsl
===================================================================
--- branches/dev-syncromind-2/booking/templates/base/season.xsl 2016-06-25 
17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/booking/templates/base/season.xsl 2016-06-25 
18:08:09 UTC (rev 15338)
@@ -93,7 +93,7 @@
                var colDefsPermissions = [
                {key: 'subject_name', label: lang['Account']},
                {key: 'role', label: lang['Role']},
-               {key: 'actions', label: lang['Actions'], formatter: 
genericLink(lang['Edit'], lang['Delete'])}
+               {key: 'actions', label: lang['Actions'], formatter: 
genericLink({name: 'edit', label:lang['Edit']}, {name: 'delete', 
label:lang['Delete']})}
                ];
                createTable('resources_container', resourcesURL, 
colDefsRespurces);
                createTable('permissions_container', permissionsURL, 
colDefsPermissions);


Property changes on: branches/dev-syncromind-2/bookingfrontend
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/stavangerkommune/bookingfrontend:9468-12740,12986
/trunk/bookingfrontend:14937-15027,15253-15304
   + /branches/stavangerkommune/bookingfrontend:9468-12740,12986
/trunk/bookingfrontend:14937-15027,15253-15304,15306-15337

Modified: branches/dev-syncromind-2/bookingfrontend/inc/class.bosearch.inc.php
===================================================================
--- branches/dev-syncromind-2/bookingfrontend/inc/class.bosearch.inc.php        
2016-06-25 17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/bookingfrontend/inc/class.bosearch.inc.php        
2016-06-25 18:08:09 UTC (rev 15338)
@@ -184,7 +184,7 @@
                                        $res_result['total_records'] ++;
                                        $res_result['results'][] = $res;
                                }
-
+/*
                                if (isset($bui_result['total_records']) && 
$bui_result['total_records'] > 0)
                                {
                                        $_bui_result = array(
@@ -203,7 +203,10 @@
                                        }
                                        $bui_result = $_bui_result;
                                }
+ */
                        }
+
+
                        if (!in_array('building', $types))
                        {
                                $bui_result = array();

Modified: 
branches/dev-syncromind-2/bookingfrontend/js/bookingfrontend/application.js
===================================================================
--- branches/dev-syncromind-2/bookingfrontend/js/bookingfrontend/application.js 
2016-06-25 17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/bookingfrontend/js/bookingfrontend/application.js 
2016-06-25 18:08:09 UTC (rev 15338)
@@ -3,6 +3,11 @@
 
 $(document).ready(function ()
 {
+       $("#start_date").change(function ()
+       {
+               $("#end_date").val($("#start_date").val());
+       });
+
        JqueryPortico.autocompleteHelper(phpGWLink('bookingfrontend/', 
{menuaction: 'bookingfrontend.uibuilding.index'}, true), 'field_building_name', 
'field_building_id', 'building_container');
 
        $("#field_activity").change(function ()

Modified: 
branches/dev-syncromind-2/bookingfrontend/js/bookingfrontend/schedule.js
===================================================================
--- branches/dev-syncromind-2/bookingfrontend/js/bookingfrontend/schedule.js    
2016-06-25 17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/bookingfrontend/js/bookingfrontend/schedule.js    
2016-06-25 18:08:09 UTC (rev 15338)
@@ -10,18 +10,38 @@
        var datestr = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + 
date.getDate();
        url += '&date=' + datestr;
 
-       var lang = {
-               WEEKDAYS_FULL: [
-                       'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 
'Friday', 'Saturday'
-               ],
-               MONTHS_LONG: [
-                       'January', 'February', 'March', 'April', 'May', 'June', 
'July', 'August', 'September', 'October', 'November', 'December'
-               ],
-               LBL_TIME: 'Time',
-               LBL_RESOURCE: 'Resource',
-               LBL_WEEK: 'Week'
-       };
+       var detected_lang = navigator.language || navigator.userLanguage;
+       var lang = {};
 
+       if(detected_lang == 'no' || detected_lang == 'nn' || detected_lang == 
'nb')
+       {
+               lang = {
+                       WEEKDAYS_FULL: [
+                               'Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 
'Torsdag', 'Fredag', 'Lørdag'
+                       ],
+                       MONTHS_LONG: [
+                               'Januar', 'Februar', 'Mars', 'April', 'May', 
'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Desember'
+                       ],
+                       LBL_TIME: 'Tidsrom',
+                       LBL_RESOURCE: 'Ressurs',
+                       LBL_WEEK: 'Uke'
+               };
+       }
+       else
+       {
+               lang = {
+                       WEEKDAYS_FULL: [
+                               'Sunday', 'Monday', 'Tuesday', 'Wednesday', 
'Thursday', 'Friday', 'Saturday'
+                       ],
+                       MONTHS_LONG: [
+                               'January', 'February', 'March', 'April', 'May', 
'June', 'July', 'August', 'September', 'October', 'November', 'December'
+                       ],
+                       LBL_TIME: 'Time',
+                       LBL_RESOURCE: 'Resource',
+                       LBL_WEEK: 'Week'
+               };
+       }
+
        var colDefs = [
                {key: 'time', label: date.getFullYear() + '<br/>' + 
lang['LBL_TIME']}];
        if (includeResource)

Modified: branches/dev-syncromind-2/bookingfrontend/js/bookingfrontend/search.js
===================================================================
--- branches/dev-syncromind-2/bookingfrontend/js/bookingfrontend/search.js      
2016-06-25 17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/bookingfrontend/js/bookingfrontend/search.js      
2016-06-25 18:08:09 UTC (rev 15338)
@@ -32,6 +32,16 @@
        {
                update_search(selected_criteria, true);
        });
+
+       $('#field_searchterm').keydown(function (event)
+       {
+               var keypressed = event.keyCode || event.which;
+               if (keypressed == 13)
+               {
+                       update_search(selected_criteria, true);
+               }
+       });
+
        $("#search_type :checkbox").on('click', function ()
        {
                update_search(selected_criteria, true);

Modified: branches/dev-syncromind-2/phpgwapi/js/jquery/common.js
===================================================================
--- branches/dev-syncromind-2/phpgwapi/js/jquery/common.js      2016-06-25 
17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/phpgwapi/js/jquery/common.js      2016-06-25 
18:08:09 UTC (rev 15338)
@@ -86,12 +86,12 @@
        }
 
        var data = oData[key];
-       if (key == 'opcion_edit')
+       if (key == 'option_edit')
        {
                var link = data;
                var name = 'Edit';
        }
-       else if (key == 'opcion_delete')
+       else if (key == 'option_delete')
        {
                var link = data;
                var name = 'Delete';
@@ -1124,11 +1124,11 @@
                                                                }
                                                                if (label_name 
== 'Edit' || label_name == 'edit')
                                                                {
-                                                                       vcfLink 
= 'opcion_edit';
+                                                                       vcfLink 
= 'option_edit';
                                                                }
                                                                else if 
(label_name == 'Delete' || label_name == 'delete')
                                                                {
-                                                                       vcfLink 
= 'opcion_delete';
+                                                                       vcfLink 
= 'option_delete';
                                                                }
                                                                else if 
(label_name == 'dellink')
                                                                {
@@ -1611,4 +1611,4 @@
        {
                return "<a onclick='return confirm(\"Er du sikker på at du vil 
slette denne?\")' href='" + link + "'>" + name + "</a>";
        }
-}
\ No newline at end of file
+}

Modified: branches/dev-syncromind-2/phpgwapi/templates/base/datatable_jquery.xsl
===================================================================
--- branches/dev-syncromind-2/phpgwapi/templates/base/datatable_jquery.xsl      
2016-06-25 17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/phpgwapi/templates/base/datatable_jquery.xsl      
2016-06-25 18:08:09 UTC (rev 15338)
@@ -657,7 +657,7 @@
                                                },
                                        </xsl:when>
                                </xsl:choose>
-                               'excelHtml5',
+                               'csvHtml5',
                                <xsl:choose>
                                        <xsl:when test="download">
                                                ,{
@@ -682,8 +682,26 @@
                                                                var iframe = 
document.createElement('iframe');
                                                                
iframe.style.height = "0px";
                                                                
iframe.style.width = "0px";
+                                                               
console.log(oParams);
+
+                                                               
if(typeof(oParams.order[0]) != 'undefined')
+                                                               {
+                                                                       var 
column = oParams.order[0].column;
+                                                                       var dir 
= oParams.order[0].dir;
+                                                                       var 
column_to_keep = oParams.columns[column];
+                                                                       delete 
oParams.columns;
+                                                                       
oParams.columns = {};
+                                                                       
if(JqueryPortico.columns[column]['orderable'] == true)
+                                                                       {
+                                                                               
oParams.columns[column] = column_to_keep;
+                                                                       }
+                                                               }
+                                                               else
+                                                               {
+                                                                               
delete oParams.columns;
+                                                               }
+
                                                                iframe.src = 
sUrl+"&"+$.param(oParams) + "&export=1" + "&query=" + $('div.dataTables_filter 
input').val();
-
                                                                
if(confirm("This will take some time..."))
                                                                {
                                                                        
document.body.appendChild( iframe );

Modified: branches/dev-syncromind-2/property/inc/class.soentity.inc.php
===================================================================
--- branches/dev-syncromind-2/property/inc/class.soentity.inc.php       
2016-06-25 17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/property/inc/class.soentity.inc.php       
2016-06-25 18:08:09 UTC (rev 15338)
@@ -126,7 +126,7 @@
                        {
                                return;
                        }
-               
+
                        $acl = & $GLOBALS['phpgw']->acl;
                        $grants = 
$acl->get_grants2($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}");
 
@@ -483,7 +483,7 @@
                        {
                                $location_id = 
$GLOBALS['phpgw']->locations->get_id($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}");
                        }
-               
+
                        $acl = & $GLOBALS['phpgw']->acl;
                        $acl->set_account_id($this->account);
                        $grants = 
$acl->get_grants2($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}");
@@ -532,9 +532,11 @@
                        }
 
                        $bypass_acl_at_entity = false;
+                       $acl_group_join = "{$this->join} phpgw_group_map ON 
phpgw_accounts.account_id = phpgw_group_map.account_id ";
                        if 
(isset($_config->config_data['bypass_acl_at_entity']) && 
is_array($_config->config_data['bypass_acl_at_entity']) && in_array($entity_id, 
$_config->config_data['bypass_acl_at_entity']))
                        {
                                $bypass_acl_at_entity = true;
+                               $acl_group_join = '';
                        }
 
                        unset($_config);
@@ -778,7 +780,7 @@
 
                        $sql = "SELECT fm_bim_item.* __XML-ORDER__ FROM 
fm_bim_item {$this->join} fm_bim_type ON (fm_bim_item.type = fm_bim_type.id)"
                                . " {$this->join} phpgw_accounts ON 
$entity_table.user_id = phpgw_accounts.account_id"
-                               . " {$this->join} phpgw_group_map ON 
phpgw_accounts.account_id = phpgw_group_map.account_id ";
+                               . " {$acl_group_join}";
                        $join_control = "controller_control_component_list ON 
(fm_bim_item.id = controller_control_component_list.component_id  AND 
controller_control_component_list.location_id = fm_bim_type.location_id)";
 
                        if ($control_registered)
@@ -926,6 +928,20 @@
                                $sql = str_replace("SELECT fm_bim_item.*", 
"SELECT fm_bim_item.* {$sql_custom_field}", $sql);
                                $sql .= " GROUP BY 
fm_bim_item.location_id,fm_bim_item.id,fm_bim_item.type{$sql_custom_group}";
                        }
+
+                       if(!$bypass_acl_at_entity)
+                       {
+                               $sql = str_replace("SELECT fm_bim_item.*", 
"SELECT DISTINCT fm_bim_item.location_id,"
+                                       . 
"fm_bim_item.id,fm_bim_item.type,fm_bim_item.guid,"
+                                       . 
"fm_bim_item.model,fm_bim_item.p_location_id,"
+                                       . 
"fm_bim_item.p_id,fm_bim_item.location_code,"
+                                       . 
"fm_bim_item.loc1,fm_bim_item.address,"
+                                       . 
"fm_bim_item.entry_date,fm_bim_item.user_id,"
+                                       . 
"fm_bim_item.org_unit_id,fm_bim_item.entity_group_id,"
+                                       . 
"fm_bim_item.modified_by,fm_bim_item.modified_on", $sql);
+                       }
+
+
 //_debug_array($sql);
                        static $cache_attributes = array();
 
@@ -953,7 +969,18 @@
 //_debug_array($uicols);
                        while ($this->db->next_record())
                        {
-                               $xmldata = $this->db->f('xml_representation');
+                               if($bypass_acl_at_entity)
+                               {
+                                       $xmldata = 
$this->db->f('xml_representation');
+                               }
+                               else
+                               {
+                                       $id = (int)$this->db->f('id');
+                                       $type = (int)$this->db->f('type');
+                                       $this->db2->query("SELECT 
xml_representation FROM fm_bim_item WHERE type = {$type} AND id = {$id}", 
__LINE__, __FILE__);
+                                       $this->db2->next_record();
+                                       $xmldata = 
$this->db2->f('xml_representation');
+                               }
                                $xml = new DOMDocument('1.0', 'utf-8');
                                $xml->loadXML($xmldata);
 
@@ -963,8 +990,7 @@
                                        {
                                                $value = $this->db->f($field, 
true);
                                        }
-                                       $dataset[$j][$field] = array
-                                               (
+                                       $dataset[$j][$field] = array(
                                                'value' => $value,
                                                'datatype' => 
$uicols['datatype'][$key],
                                                'attrib_id' => 
$uicols['cols_return_extra'][$key]['attrib_id'],
@@ -1471,7 +1497,7 @@
                        {
                                return;
                        }
-               
+
                        $acl = & $GLOBALS['phpgw']->acl;
                        $acl->set_account_id($this->account);
                        $grants = 
$acl->get_grants2($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}");

Modified: branches/dev-syncromind-2/property/inc/class.sotts.inc.php
===================================================================
--- branches/dev-syncromind-2/property/inc/class.sotts.inc.php  2016-06-25 
17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/property/inc/class.sotts.inc.php  2016-06-25 
18:08:09 UTC (rev 15338)
@@ -141,14 +141,14 @@
 
 
                        $result_order_field = array();
-                       $order_join = "{$this->join} phpgw_accounts ON 
fm_tts_tickets.user_id=phpgw_accounts.account_id";
+                       $order_join = " {$this->join} phpgw_accounts ON 
fm_tts_tickets.user_id=phpgw_accounts.account_id";
 
                        if ($order)
                        {
                                if ($order == 'assignedto')
                                {
                        //              $result_order_field = 
array('account_lastname' => 'account_lastname');
-                       //              $order_join = "LEFT OUTER JOIN 
phpgw_accounts ON fm_tts_tickets.assignedto=phpgw_accounts.account_id";
+                       //              $order_join = " LEFT OUTER JOIN 
phpgw_accounts ON fm_tts_tickets.assignedto=phpgw_accounts.account_id";
                        //              $order = 'account_lastname';
                                }
                                else if ($order == 'user')
@@ -163,7 +163,6 @@
                        {
                                $ordermethod = ' ORDER BY id DESC';
                        }
-                       $order_join .= " {$this->join} phpgw_group_map ON 
(phpgw_accounts.account_id = phpgw_group_map.account_id)";
                        $union_select = false;
                        $filtermethod = '';
 
@@ -171,8 +170,9 @@
 
                        $config = $GLOBALS['phpgw']->config->read();
 
-                       if (!isset($config['bypass_acl_at_tickets']) || 
!$config['bypass_acl_at_tickets'])
+                       if (!$start_date && 
(!isset($config['bypass_acl_at_tickets']) || !$config['bypass_acl_at_tickets']))
                        {
+                               $order_join .= " {$this->join} phpgw_group_map 
ON (phpgw_accounts.account_id = phpgw_group_map.account_id)";
                                
$GLOBALS['phpgw']->acl->set_account_id($this->account);
                                $grants = 
$GLOBALS['phpgw']->acl->get_grants2('property', '.ticket');
 
@@ -421,7 +421,7 @@
                                        $start_period = date('Ym', $start_date);
                                        $end_period = date('Ym', $end_date);
 //                                     $filtermethod .= " OR 
(fm_tts_payments.period >= {$start_period} AND fm_tts_payments.period <= 
{$end_period})";
-                                       $date_cost_join = "LEFT OUTER JOIN 
fm_tts_payments ON ( fm_tts_tickets.id=fm_tts_payments.ticket_id AND 
fm_tts_payments.period >= $start_period AND fm_tts_payments.period <= 
$end_period )";
+                                       $date_cost_join = " LEFT OUTER JOIN 
fm_tts_payments ON ( fm_tts_tickets.id=fm_tts_payments.ticket_id AND 
fm_tts_payments.period >= $start_period AND fm_tts_payments.period <= 
$end_period )";
 //                                     $actual_cost_field = 
'SUM(fm_tts_payments.amount) AS actual_cost';
                                        $actual_cost_field = 
array('SUM(actual_cost) AS actual_cost' => 'fm_tts_payments.amount as 
actual_cost');
 
@@ -430,7 +430,7 @@
                                        $start_budget_period = date('Y', 
$start_date) . '00';
                                        $end_budget_period = date('Y', 
$end_date) . '13';
 //                                     $filtermethod .= " OR 
(fm_tts_budget.period >= {$start_budget_period} AND fm_tts_budget.period <= 
{$end_budget_period}))";
-                                       $date_budget_join = "LEFT OUTER JOIN 
fm_tts_budget ON ( fm_tts_tickets.id=fm_tts_budget.ticket_id AND 
fm_tts_budget.period >= $start_budget_period AND fm_tts_budget.period <= 
$end_budget_period )";
+                                       $date_budget_join = " LEFT OUTER JOIN 
fm_tts_budget ON ( fm_tts_tickets.id=fm_tts_budget.ticket_id AND 
fm_tts_budget.period >= $start_budget_period AND fm_tts_budget.period <= 
$end_budget_period )";
 //                                     $budget_field = 
'SUM(fm_tts_budget.amount) AS budget';
                                        $budget_field = array('SUM(budget) AS 
budget' => 'fm_tts_budget.amount as budget');
                                        $budget_group_field = '';

Modified: branches/dev-syncromind-2/sms/inc/class.sosms.inc.php
===================================================================
--- branches/dev-syncromind-2/sms/inc/class.sosms.inc.php       2016-06-25 
17:59:05 UTC (rev 15337)
+++ branches/dev-syncromind-2/sms/inc/class.sosms.inc.php       2016-06-25 
18:08:09 UTC (rev 15338)
@@ -40,6 +40,8 @@
                        $allrows = isset($data['allrows']) ? $data['allrows'] : 
'';
                        $acl_location = isset($data['acl_location']) ? 
$data['acl_location'] : '';
 
+                       $filtermethod = '';
+
 //                     if ($acl_location)
 //                     {
 //                             
$GLOBALS['phpgw']->acl->set_account_id($this->account);
@@ -108,12 +110,49 @@
                        $allrows = isset($data['allrows']) ? $data['allrows'] : 
'';
                        $acl_location = isset($data['acl_location']) ? 
$data['acl_location'] : '';
 
-//                     if ($acl_location)
-//                     {
-//                             
$GLOBALS['phpgw']->acl->set_account_id($this->account);
-//                             $grants = 
$GLOBALS['phpgw']->acl->get_grants2('sms', $acl_location);
-//                     }
+                       $table = 'phpgw_sms_tblsmsoutgoing';
+                       $where = 'WHERE';
+                       $filtermethod = '';
+                       if ($acl_location)
+                       {
+                               
$GLOBALS['phpgw']->acl->set_account_id($this->account);
+                               $grants = 
$GLOBALS['phpgw']->acl->get_grants2('sms', $acl_location);
 
+                               $public_user_list = array();
+                               if (is_array($grants['accounts']) && 
$grants['accounts'])
+                               {
+                                       foreach ($grants['accounts'] as $user 
=> $right)
+                                       {
+                                               $public_user_list[] = $user;
+                                       }
+                                       unset($user);
+
+                                       reset($public_user_list);
+                                       $filtermethod .= " $where ( $table.uid 
IN(" . implode(',', $public_user_list) . ")";
+
+                                       $where = 'AND';
+                               }
+
+                               $public_group_list = array();
+                               if (is_array($grants['groups']) && 
$grants['groups'])
+                               {
+                                       foreach($grants['groups'] as $user => 
$_right)
+                                       {
+                                               $public_group_list[] = $user;
+                                       }
+                                       unset($user);
+                                       reset($public_group_list);
+                                       $where = $public_user_list ? 'OR' : 
$where;
+                                       $filtermethod .= " $where 
phpgw_group_map.group_id IN(" . implode(',', $public_group_list) . "))";
+                                       $where = 'AND';
+                               }
+                               if($public_user_list && !$public_group_list)
+                               {
+                                       $filtermethod .=')';
+                               }
+
+                       }
+
                        if ($order)
                        {
                                $ordermethod = " ORDER BY $order $sort";
@@ -123,23 +162,6 @@
                                $ordermethod = ' ORDER BY smslog_id DESC';
                        }
 
-                       $table = 'phpgw_sms_tblsmsoutgoing';
-
-
-                       $where = 'WHERE';
-
-//                     if (is_array($grants))
-//                     {
-//                             while (list($user) = each($grants))
-//                             {
-//                                     $public_user_list[] = $user;
-//                             }
-//                             reset($public_user_list);
-//                             $filtermethod = " $where ( $table.uid IN(" . 
implode(',', $public_user_list) . "))";
-//
-//                             $where = 'AND';
-//                     }
-
                        $querymethod = '';
                        if ($query)
                        {
@@ -148,11 +170,17 @@
                                $querymethod = " AND p_dst $this->like 
'%$query%' OR p_msg $this->like '%$query%'";
                        }
 
-                       $sql = "SELECT * FROM $table $filtermethod $querymethod 
AND flag_deleted='0'";
+                       $sql = "SELECT DISTINCT {$table}.* FROM {$table}"
+                               . " {$this->join} phpgw_accounts ON 
{$table}.uid=phpgw_accounts.account_id"
+                               . " {$this->join} phpgw_group_map ON 
(phpgw_accounts.account_id = phpgw_group_map.account_id)"
+                               . " {$filtermethod} {$querymethod} {$where} 
flag_deleted='0'";
 
-                       $this->db->query($sql, __LINE__, __FILE__);
-                       $this->total_records = $this->db->num_rows();
+                       $sql_cnt = "SELECT COUNT(*) as cnt FROM ({$sql}) as t";
 
+                       $this->db->query($sql_cnt, __LINE__, __FILE__);
+                       $this->db->next_record();
+                       $this->total_records = $this->db->f('cnt');
+
                        if (!$allrows)
                        {
                                $this->db->limit_query($sql . $ordermethod, 
$start, __LINE__, __FILE__);




reply via email to

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