[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [6630] patched after savannah downtime:
From: |
Erik Holm-Larsen |
Subject: |
[Fmsystem-commits] [6630] patched after savannah downtime: |
Date: |
Thu, 02 Dec 2010 14:23:51 +0000 |
Revision: 6630
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6630
Author: erikhl
Date: 2010-12-02 14:23:51 +0000 (Thu, 02 Dec 2010)
Log Message:
-----------
patched after savannah downtime:
added period-search on composites
added status for composites
fixed mail-sending when delegating
Modified Paths:
--------------
trunk/rental/inc/class.bofellesdata.inc.php
trunk/rental/inc/class.socomposite.inc.php
trunk/rental/inc/class.uicomposite.inc.php
trunk/rental/inc/class.uiresultunit.inc.php
trunk/rental/inc/model/class.composite.inc.php
Modified: trunk/rental/inc/class.bofellesdata.inc.php
===================================================================
--- trunk/rental/inc/class.bofellesdata.inc.php 2010-12-02 13:14:13 UTC (rev
6629)
+++ trunk/rental/inc/class.bofellesdata.inc.php 2010-12-02 14:23:51 UTC (rev
6630)
@@ -189,7 +189,7 @@
$tables = "V_ORG_ENHET";
$joins = "LEFT JOIN V_ORG_PERSON_ENHET ON
(V_ORG_ENHET.ORG_ENHET_ID = V_ORG_PERSON_ENHET.ORG_ENHET_ID AND
V_ORG_PERSON_ENHET.prioritet = 1) ".
"LEFT JOIN V_ORG_PERSON ON
(V_ORG_PERSON.ORG_PERSON_ID = V_ORG_PERSON_ENHET.ORG_PERSON_ID)";
- $sql = "SELECT $columns FROM $tables $joins WHERE
V_ORG_ENHET.ORG_NIVAA = 4";
+ $sql = "SELECT $columns FROM $tables $joins WHERE
V_ORG_ENHET.ORG_NIVAA > 1";
if($search_for){
$selector = "";
switch($search_type){
Modified: trunk/rental/inc/class.socomposite.inc.php
===================================================================
--- trunk/rental/inc/class.socomposite.inc.php 2010-12-02 13:14:13 UTC (rev
6629)
+++ trunk/rental/inc/class.socomposite.inc.php 2010-12-02 14:23:51 UTC (rev
6630)
@@ -68,19 +68,28 @@
}
$special_query = false; //specify if the query should use
distinct on rental_composite.id (used for selecting composites that has an
active or inactive contract)
$ts_query = strtotime(date('Y-m-d')); // timestamp for query
(today)
- if(isset($filters['availability_date']) &&
$filters['availability_date'] != ''){
- $availability_date =
strtotime($filters['availability_date']);
+ if(isset($filters['availability_date_from']) &&
$filters['availability_date_from'] != ''){
+ $availability_date_from =
strtotime($filters['availability_date_from']);
}
else{
- $availability_date = $ts_query;
+ $availability_date_from = $ts_query;
}
+ if(isset($filters['availability_date_to']) &&
$filters['availability_date_to'] != ''){
+ $availability_date_to =
strtotime($filters['availability_date_to']);
+ }
+ else{
+ $availability_date_to = $ts_query;
+ }
switch($filters['has_contract']){
case "has_contract":
- $filter_clauses[] = "(NOT
rental_contract_composite.contract_id IS NULL AND (NOT
rental_contract.date_start IS NULL AND rental_contract.date_start <
$availability_date AND (rental_contract.date_end IS NULL OR (NOT
rental_contract.date_end IS NULL AND rental_contract.date_end >
$availability_date))))";
+ $filter_clauses[] = "(NOT
rental_contract_composite.contract_id IS NULL AND (NOT
rental_contract.date_start IS NULL AND rental_contract.date_start >
$availability_date_from OR rental_contract.date_start < $availability_date_to
AND (rental_contract.date_end IS NULL OR (rental_contract.date_end >
$availability_date_from OR rental_contract.date_end <
$availability_date_to))))";
+ //$filter_clauses[] = "(NOT
rental_contract_composite.contract_id IS NULL AND (NOT
rental_contract.date_start IS NULL AND rental_contract.date_start <
$availability_date_from AND ((rental_contract.date_end IS NULL OR (NOT
rental_contract.date_end IS NULL AND rental_contract.date_end >
$availability_date_from)) OR (rental_contract.date_start >
$availability_date_to AND (rental_contract.date_end IS NULL OR (NOT
rental_contract.date_end IS NULL AND rental_contract.date_end <
$availability_date_to))))))";
+ //$filter_clauses[] = "(NOT
rental_contract_composite.contract_id IS NULL AND (NOT
rental_contract.date_start IS NULL AND rental_contract.date_start <
$availability_date_from AND (rental_contract.date_end IS NULL OR (NOT
rental_contract.date_end IS NULL AND rental_contract.date_end >
$availability_date_from))))";
$special_query=true;
break;
case "has_no_contract":
- $filter_clauses[] =
"(rental_contract_composite.contract_id IS NULL OR NOT rental_composite.id IN
(SELECT rental_composite.id FROM rental_composite LEFT JOIN
rental_contract_composite ON (rental_contract_composite.composite_id =
rental_composite.id) LEFT JOIN rental_contract ON (rental_contract.id =
rental_contract_composite.contract_id) WHERE 1=1 AND rental_composite.is_active
= TRUE AND (NOT rental_contract_composite.contract_id IS NULL AND (NOT
rental_contract.date_start IS NULL AND rental_contract.date_start <
$availability_date AND (rental_contract.date_end IS NULL OR (NOT
rental_contract.date_end IS NULL AND rental_contract.date_end >
$availability_date))))))";
+ //$filter_clauses[] =
"(rental_contract_composite.contract_id IS NULL OR NOT rental_composite.id IN
(SELECT rental_composite.id FROM rental_composite LEFT JOIN
rental_contract_composite ON (rental_contract_composite.composite_id =
rental_composite.id) LEFT JOIN rental_contract ON (rental_contract.id =
rental_contract_composite.contract_id) WHERE 1=1 AND rental_composite.is_active
= TRUE AND (NOT rental_contract_composite.contract_id IS NULL AND (NOT
rental_contract.date_start IS NULL AND rental_contract.date_start <
$availability_date_from AND (rental_contract.date_end IS NULL OR (NOT
rental_contract.date_end IS NULL AND rental_contract.date_end >
$availability_date_from))))))";
+ $filter_clauses[] =
"(rental_contract_composite.contract_id IS NULL OR NOT rental_composite.id IN
(SELECT rental_composite.id FROM rental_composite LEFT JOIN
rental_contract_composite ON (rental_contract_composite.composite_id =
rental_composite.id) LEFT JOIN rental_contract ON (rental_contract.id =
rental_contract_composite.contract_id) WHERE 1=1 AND rental_composite.is_active
= TRUE AND (NOT rental_contract_composite.contract_id IS NULL AND (NOT
rental_contract.date_start IS NULL AND ((rental_contract.date_start >
$availability_date_from OR rental_contract.date_start < $availability_date_to
AND (NOT rental_contract.date_end IS NULL AND rental_contract.date_end >
$availability_date_from OR rental_contract.date_end <
$availability_date_to)))))))";
$special_query=true;
break;
case "both":
@@ -116,6 +125,28 @@
$joins = " {$this->left_join} rental_unit ON
(rental_composite.id = rental_unit.composite_id)";
$joins .= " {$this->left_join} rental_contract_composite ON
(rental_contract_composite.composite_id = rental_composite.id)";
$joins .= " {$this->left_join} rental_contract ON
(rental_contract.id = rental_contract_composite.contract_id)";
+
+ if(isset($filters['availability_date_from']) &&
$filters['availability_date_from'] != ''){
+ $availability_date_from =
strtotime($filters['availability_date_from']);
+ }
+ else
+ {
+ $availability_date_from = strtotime(date('Y-m-d'));
+ }
+ if(isset($filters['availability_date_to']) &&
$filters['availability_date_to'] != ''){
+ $availability_date_to =
strtotime($filters['availability_date_to']);
+ }
+ else
+ {
+ if(isset($filters['availability_date_from']) &&
$filters['availability_date_from'] != ''){
+ $availability_date_to =
strtotime($filters['availability_date_from']);
+ }
+ else{
+ $availability_date_to =
strtotime(date('Y-m-d'));
+ }
+ }
+
+
if($return_count) // We should only return a count
{
$cols = 'COUNT(DISTINCT(rental_composite.id)) AS count';
@@ -124,16 +155,17 @@
{
if($special_query)
{
- $cols = 'DISTINCT(rental_composite.id) AS
composite_id, rental_unit.id AS unit_id, rental_unit.location_code,
rental_composite.name, rental_composite.has_custom_address,
rental_composite.address_1, rental_composite.house_number,
rental_composite.address_2, rental_composite.postcode, rental_composite.place,
rental_composite.is_active, rental_composite.area';
+ $cols = "DISTINCT(rental_composite.id) AS
composite_id, rental_unit.id AS unit_id, rental_unit.location_code,
rental_composite.name, rental_composite.has_custom_address,
rental_composite.address_1, rental_composite.house_number,
rental_composite.address_2, rental_composite.postcode, rental_composite.place,
rental_composite.is_active, rental_composite.area, CASE WHEN (NOT
rental_contract_composite.contract_id IS NULL AND (NOT
rental_contract.date_start IS NULL AND rental_contract.date_start >
$availability_date_from OR rental_contract.date_start < $availability_date_to
AND (rental_contract.date_end IS NULL OR (rental_contract.date_end >
$availability_date_from OR rental_contract.date_end < $availability_date_to))))
THEN 'Ikke ledig' ELSE 'Ledig' END as status";
}
else
{
- $cols = 'rental_composite.id AS composite_id,
rental_unit.id AS unit_id, rental_unit.location_code, rental_composite.name,
rental_composite.has_custom_address, rental_composite.address_1,
rental_composite.house_number, rental_composite.address_2,
rental_composite.postcode, rental_composite.place, rental_composite.is_active,
rental_composite.area';
+ $cols = "rental_composite.id AS composite_id,
rental_unit.id AS unit_id, rental_unit.location_code, rental_composite.name,
rental_composite.has_custom_address, rental_composite.address_1,
rental_composite.house_number, rental_composite.address_2,
rental_composite.postcode, rental_composite.place, rental_composite.is_active,
rental_composite.area, CASE WHEN (NOT rental_contract_composite.contract_id IS
NULL AND (NOT rental_contract.date_start IS NULL AND rental_contract.date_start
> $availability_date_from OR rental_contract.date_start < $availability_date_to
AND (rental_contract.date_end IS NULL OR (rental_contract.date_end >
$availability_date_from OR rental_contract.date_end < $availability_date_to))))
THEN 'Ikke ledig' ELSE 'Ledig' END as status";
}
}
$dir = $ascending ? 'ASC' : 'DESC';
$order = $sort_field ? "ORDER BY {$this->marshal($sort_field,
'field')} $dir ": '';
+ //var_dump("SELECT {$cols} FROM {$tables} {$joins} WHERE
{$condition} {$order}");
return "SELECT {$cols} FROM {$tables} {$joins} WHERE
{$condition} {$order}";
}
@@ -157,6 +189,7 @@
$composite->set_custom_postcode($this->unmarshal($this->db->f('postcode',
true), 'string'));
$composite->set_custom_place($this->unmarshal($this->db->f('place', true),
'string'));
$composite->set_area($this->unmarshal($this->db->f('area', true), 'float'));
+
$composite->set_status($this->unmarshal($this->db->f('status', true),
'string'));
}
// Location code
$location_code = $this->unmarshal($this->db->f('location_code',
true), 'string');
Modified: trunk/rental/inc/class.uicomposite.inc.php
===================================================================
--- trunk/rental/inc/class.uicomposite.inc.php 2010-12-02 13:14:13 UTC (rev
6629)
+++ trunk/rental/inc/class.uicomposite.inc.php 2010-12-02 14:23:51 UTC (rev
6630)
@@ -85,7 +85,7 @@
phpgwapi_cache::session_set('rental',
'composite_search_type', $search_type);
phpgwapi_cache::session_set('rental',
'composite_status', phpgw::get_var('is_active'));
phpgwapi_cache::session_set('rental',
'composite_status_contract', phpgw::get_var('has_contract'));
- $filters = array('is_active' =>
phpgw::get_var('is_active'), 'is_vacant' => phpgw::get_var('occupancy'),
'has_contract' => phpgw::get_var('has_contract'), 'availability_date' =>
phpgw::get_var('availability_date_hidden'));
+ $filters = array('is_active' =>
phpgw::get_var('is_active'), 'is_vacant' => phpgw::get_var('occupancy'),
'has_contract' => phpgw::get_var('has_contract'), 'availability_date_from' =>
phpgw::get_var('availability_date_from_hidden'), 'availability_date_to' =>
phpgw::get_var('availability_date_to_hidden'));
$result_objects =
rental_socomposite::get_instance()->get($start_index, $num_of_objects,
$sort_field, $sort_ascending, $search_for, $search_type, $filters);
$object_count =
rental_socomposite::get_instance()->get_count($search_for, $search_type,
$filters);
break;
Modified: trunk/rental/inc/class.uiresultunit.inc.php
===================================================================
--- trunk/rental/inc/class.uiresultunit.inc.php 2010-12-02 13:14:13 UTC (rev
6629)
+++ trunk/rental/inc/class.uiresultunit.inc.php 2010-12-02 14:23:51 UTC (rev
6630)
@@ -187,7 +187,39 @@
return false;
}
}
- return frontend_bofrontend::add_delegate($account_id,
null, $org_unit_id, $org_name);
+
+ $success =
frontend_bofrontend::add_delegate($account_id, null, $org_unit_id, $org_name);
+ if($success)
+ {
+ //Retrieve the usernames
+ $user_account =
$GLOBALS['phpgw']->accounts->get($account_id);
+ $owner_account =
$GLOBALS['phpgw']->accounts->get($GLOBALS['phpgw_info']['user']['account_id']);
+ $user_name = $user_account->__get('lid');
+ $owner_name = $owner_account->__get('lid');
+ $org_name_string = $org_name;
+
+ //If the usernames are set retrieve account
data from Fellesdata
+ if(isset($user_name) && $user_name != '' &&
$owner_name && $owner_name != '')
+ {
+ $fellesdata_user =
frontend_bofellesdata::get_instance()->get_user($user_name);
+ $fellesdata_owner =
frontend_bofellesdata::get_instance()->get_user($owner_name);
+
+ if($fellesdata_user &&
$fellesdata_owner)
+ {
+ //Send email notification to
delegate
+ $email =
$fellesdata_user['email'];
+ if(isset($email) && $email !=
'')
+ {
+
+ $title =
lang('email_add_delegate_title');
+ $message =
lang('email_add_delegate_message',$fellesdata_user['firstname'],$fellesdata_user['lastname'],$fellesdata_owner['firstname'],$fellesdata_owner['lastname'],$org_name_string);
+
frontend_bofrontend::send_system_message($email,$title,$message);
+ return true;
+ }
+ }
+ }
+ }
+ return false;
}
public function remove_delegate()
Modified: trunk/rental/inc/model/class.composite.inc.php
===================================================================
--- trunk/rental/inc/model/class.composite.inc.php 2010-12-02 13:14:13 UTC
(rev 6629)
+++ trunk/rental/inc/model/class.composite.inc.php 2010-12-02 14:23:51 UTC
(rev 6630)
@@ -21,6 +21,7 @@
protected $custom_place;
protected $object_type_id;
protected $area;
+ protected $status;
protected $units;
@@ -201,6 +202,14 @@
public function get_area() {
return $this->area;
}
+
+ public function set_status($status) {
+ $this->status = $status;
+ }
+
+ public function get_status() {
+ return $this->status;
+ }
/**
* Return a string representation of the composite.
@@ -244,7 +253,8 @@
'address' => $addresses,
'gab_id' => $gab_ids,
'area_gros' => $this->get_area_gros(),
- 'area_net' => $this->get_area_net()
+ 'area_net' => $this->get_area_net(),
+ 'status' => $this->get_status()
);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [6630] patched after savannah downtime:,
Erik Holm-Larsen <=