fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [8372] bkbooking: nsf update s?\195?\184k


From: Kjell Arne Espedal
Subject: [Fmsystem-commits] [8372] bkbooking: nsf update s?\195?\184k
Date: Mon, 19 Dec 2011 14:52:09 +0000

Revision: 8372
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8372
Author:   kjell
Date:     2011-12-19 14:52:09 +0000 (Mon, 19 Dec 2011)
Log Message:
-----------
bkbooking: nsf update s?\195?\184k

Modified Paths:
--------------
    branches/dev-thomasez/booking/inc/class.soresource.inc.php
    branches/dev-thomasez/bookingfrontend/inc/class.bosearch.inc.php

Modified: branches/dev-thomasez/booking/inc/class.soresource.inc.php
===================================================================
--- branches/dev-thomasez/booking/inc/class.soresource.inc.php  2011-12-19 
14:39:01 UTC (rev 8371)
+++ branches/dev-thomasez/booking/inc/class.soresource.inc.php  2011-12-19 
14:52:09 UTC (rev 8372)
@@ -136,6 +136,8 @@
                                'sort'                  => null,
                                'dir'                   => 'asc'
                        );
+
+
                }
                
                public static function allowed_types()

Modified: branches/dev-thomasez/bookingfrontend/inc/class.bosearch.inc.php
===================================================================
--- branches/dev-thomasez/bookingfrontend/inc/class.bosearch.inc.php    
2011-12-19 14:39:01 UTC (rev 8371)
+++ branches/dev-thomasez/bookingfrontend/inc/class.bosearch.inc.php    
2011-12-19 14:52:09 UTC (rev 8372)
@@ -16,11 +16,94 @@
                        $type = phpgw::get_var('type', 'GET');
             $bui_result = $org_result = $res_result = array();
 
-            if ((!$type || $type == "building") && $resource['res'] == 
'House') {
+            if ((!$type || $type == "building") && 
in_array($resource['res'],array('House','Boat','Location'))) {
                
-                               $conditions = '(bedspaces > 10 and bedspaces < 
25)';
-                $bui_result = 
$this->sobuilding->read(array("query"=>$searchterm, "filters" => array('where' 
=> $conditions,"active" => "1")));
+                                       
+                                       if ($resource['region'] == 'east') {
+                                               $regions = 
"('akerhus','oslo','ostfold','vestfold','hedemark','oppland','buskerud','telemark')";
+                                       }
+                                       elseif ($resource['region'] == 'south') 
{
+                                               $regions = 
"('vestagder','austagder')";
+                                       }                                       
+                                       elseif ($resource['region'] == 'west') {
+                                               $regions = 
"('rogaland','hordaland','sognogfjordane','moreogromsdal')";
+                                       }                                       
+                                       elseif ($resource['region'] == 
'middle') {
+                                               $regions = 
"('nordtrodelag','sortrondelag')";
+                                       }                                       
+                                       elseif ($resource['region'] == 'north') 
{
+                                               $regions = 
"('finnmark','nordland','troms')";
+                                       } else {
+                                               $regions = '';
+                                       }                               
+                                       if( $resource['fylke'] != '') {
+                                               $fylke = $resource['fylke'];
+                                       } else {
+                                               $fylke = '';
+                                       }
+                                       if ($resource['res'] != ''){
+                                               $ressurs = $resource['res'];
+                                               
if(in_array($ressurs,array('House','Boat','Location'))) {
+                                                       if 
($resource['beds']=='one') {
+                                                               $sengeplasser = 
'(bedspaces >= 1 and bedspaces <= 10)';
+                                                       } 
+                                                       elseif 
($resource['beds']=='two') {
+                                                               $sengeplasser = 
'bedspaces >= 10 AND bedspaces <= 25';
+                                                       }
+                                                       elseif 
($resource['beds']=='three') {
+                                                               $sengeplasser = 
'bedspaces >= 25 AND bedspaces <= 50';
+                                                       }
+                                                       elseif 
($resource['beds']=='four') {
+                                                               $sengeplasser = 
'bedspaces >= 50 AND bedspaces <= 100';
+                                                       }
+                                                       elseif 
($resource['beds']=='five') {
+                                                               $sengeplasser = 
'bedspaces >= 100 AND bedspaces <= 300';
+                                                       }
+                                                       elseif 
($resource['beds']=='six') {
+                                                               $sengeplasser = 
'bedspaces >= 300';
+                                                       }
+                                                       $teltplasser = '';
+                                               } 
elseif(in_array($ressurs,array('Campsite'))) {
+                                                       if 
($resource['campsite'] != '') {
+                                                               $teltplasser = 
'campsites > '.$resource['campsite'];
+                                                               $sengeplasser = 
'';
+                                                       } else {
+                                                               $teltplasser = 
'';
+                                                               $sengeplasser = 
'';
+                                                       }
+                                               } else {
+                                                       $teltplasser = '';
+                                                       $sengeplasser = '';
+                                               }
 
+                                       } else {
+                                               $ressurs = '';
+                                               $teltplasser = '';
+                                               $sengeplasser = '';
+                                       }
+
+                                       $wclause = 'active = 1';
+
+                                       if($regions != '') {
+                                               $wclause .= " AND district IN 
".$regions;                       
+                                       }                                       
+                                       if($fylke != '') {
+                                               $wclause .= " AND district = 
'".$fylke."'";                                             
+                                       }                                       
+#                                      if($ressurs != '') {
+#                                              $wclause .= " AND type = 
'".$ressurs."'";                                               
+#                                      }                                       
+                                       if($teltplasser != '') {
+                                               $wclause .= ' AND 
'.$teltplasser;                                               
+                                       }                                       
+                                       if($sengeplasser != '') {
+                                               $wclause .= ' AND 
'.$sengeplasser;                                              
+                                       }                                       
+
+#                              echo "<pre>";print_r($wclause);exit;
+
+                $bui_result = 
$this->sobuilding->read(array("query"=>$searchterm, "filters" => array('where' 
=> $wclause)));
+
                 foreach($bui_result['results'] as &$bui)
                 {
 




reply via email to

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