[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [6626] merge 6612:6625 from trunk
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [6626] merge 6612:6625 from trunk |
Date: |
Mon, 22 Nov 2010 13:33:58 +0000 |
Revision: 6626
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6626
Author: sigurdne
Date: 2010-11-22 13:33:58 +0000 (Mon, 22 Nov 2010)
Log Message:
-----------
merge 6612:6625 from trunk
Modified Paths:
--------------
branches/Version-1_0-branch/bookingfrontend/inc/class.uibooking.inc.php
branches/Version-1_0-branch/bookingfrontend/setup/phpgw_no.lang
branches/Version-1_0-branch/bookingfrontend/templates/base/booking_edit.xsl
branches/Version-1_0-branch/property/inc/class.bocommon.inc.php
branches/Version-1_0-branch/property/inc/class.bodocument.inc.php
branches/Version-1_0-branch/property/inc/class.boevent.inc.php
branches/Version-1_0-branch/property/inc/class.boinvoice.inc.php
branches/Version-1_0-branch/property/inc/class.bolookup.inc.php
branches/Version-1_0-branch/property/inc/class.boproject.inc.php
branches/Version-1_0-branch/property/inc/class.botts.inc.php
branches/Version-1_0-branch/property/inc/class.boworkorder.inc.php
branches/Version-1_0-branch/property/inc/class.custom_fields.inc.php
branches/Version-1_0-branch/property/inc/class.menu.inc.php
branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php
branches/Version-1_0-branch/property/inc/class.uiXport.inc.php
branches/Version-1_0-branch/property/inc/class.uiadmin_location.inc.php
branches/Version-1_0-branch/property/inc/class.uiinvoice.inc.php
branches/Version-1_0-branch/property/inc/class.uilocation.inc.php
branches/Version-1_0-branch/property/inc/class.uilookup.inc.php
branches/Version-1_0-branch/property/inc/class.uipricebook.inc.php
branches/Version-1_0-branch/property/inc/hook_settings.inc.php
branches/Version-1_0-branch/property/js/yahoo/invoice.list_sub.js
branches/Version-1_0-branch/property/js/yahoo/property.js
branches/Version-1_0-branch/property/templates/base/invoice.xsl
branches/Version-1_0-branch/rental/inc/class.soinvoice.inc.php
branches/Version-1_0-branch/rental/inc/class.uibilling.inc.php
branches/Version-1_0-branch/rental/templates/base/adjustment.php
branches/Version-1_0-branch/rental/templates/base/billing_step2.php
Added Paths:
-----------
branches/Version-1_0-branch/bookingfrontend/templates/base/booking_edit_preview.xsl
branches/Version-1_0-branch/property/inc/class.bogeneric.inc.php
branches/Version-1_0-branch/property/inc/class.sogeneric.inc.php
branches/Version-1_0-branch/property/inc/class.uigeneric.inc.php
branches/Version-1_0-branch/property/js/yahoo/generic.index.js
branches/Version-1_0-branch/property/koble_bygg_gatetabell.php
branches/Version-1_0-branch/property/templates/base/generic.xsl
Removed Paths:
-------------
branches/Version-1_0-branch/property/inc/class.boactor.inc.php
branches/Version-1_0-branch/property/inc/class.bocategory.inc.php
branches/Version-1_0-branch/property/inc/class.soactor.inc.php
branches/Version-1_0-branch/property/inc/class.socategory.inc.php
branches/Version-1_0-branch/property/inc/class.uiactor.inc.php
branches/Version-1_0-branch/property/inc/class.uicategory.inc.php
branches/Version-1_0-branch/property/js/yahoo/actor.index.js
branches/Version-1_0-branch/property/js/yahoo/category.index.js
branches/Version-1_0-branch/property/templates/base/actor.xsl
branches/Version-1_0-branch/property/templates/base/category.xsl
Property Changed:
----------------
branches/Version-1_0-branch/
Property changes on: branches/Version-1_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
-
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611
+
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625
Modified:
branches/Version-1_0-branch/bookingfrontend/inc/class.uibooking.inc.php
===================================================================
--- branches/Version-1_0-branch/bookingfrontend/inc/class.uibooking.inc.php
2010-11-22 13:18:11 UTC (rev 6625)
+++ branches/Version-1_0-branch/bookingfrontend/inc/class.uibooking.inc.php
2010-11-22 13:33:58 UTC (rev 6626)
@@ -300,29 +300,131 @@
public function edit()
{
+
$id = intval(phpgw::get_var('id', 'GET'));
$booking = $this->bo->read_single($id);
$booking['building'] =
$this->building_bo->so->read_single($booking['building_id']);
$booking['building_name'] =
$booking['building']['name'];
$allocation =
$this->allocation_bo->read_single($booking['allocation_id']);
$errors = array();
+ $update_count = 0;
+ $today = getdate();
+ $step = intval(phpgw::get_var('step', 'POST'));
+
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
- array_set_default($_POST, 'resources', array());
- $booking = array_merge($booking,
extract_values($_POST, $this->fields));
- $this->agegroup_bo->extract_form_data($booking);
- $errors = $this->bo->validate($booking);
- if(!$errors)
+
+ if (!($_POST['recurring'] == 'on' ||
$_POST['outseason'] == 'on')){
+
+ array_set_default($_POST, 'resources',
array());
+ $booking = array_merge($booking,
extract_values($_POST, $this->fields));
+
$this->agegroup_bo->extract_form_data($booking);
+ $errors = $this->bo->validate($booking);
+
+ if (strtotime($_POST['from_']) <
($today[0]-60*60*24*7*2))
+ {
+ $errors['booking'] = lang('You
cant edit a booking that is older than 2 weeks');
+ }
+ if (!$errors) {
+ $receipt =
$this->bo->update($booking);
+
$this->redirect(array('menuaction' => 'bookingfrontend.uibuilding.schedule',
'id'=>$booking['building_id']));
+ }
+ }
+ else
{
- $receipt = $this->bo->update($booking);
- $this->redirect(array('menuaction' =>
'bookingfrontend.uibuilding.schedule', 'id'=>$booking['building_id']));
+ $step++;
+
+ if (strtotime($_POST['from_']) <
($today[0]-60*60*24*7*2) && $step != 3)
+ {
+ $errors['booking'] = lang('You
cant update bookings that is older than 2 weeks');
+ }
+
+ if (!$booking['allocation_id'] &&
$_POST['outseason'] == 'on')
+ {
+ $errors['booking'] = lang('This
booking is not connected to a season');
+ }
+
+ if (!$errors)
+ {
+
+ if ($_POST['recurring'] ==
'on') {
+ $repeat_until =
strtotime($_POST['repeat_until'])+60*60*24;
+ }
+ else
+ {
+ $repeat_until =
strtotime($season['to_'])+60*60*24;
+ $_POST['repeat_until']
= $season['to_'];
+ }
+
+ $max_dato =
strtotime($_POST['to_']); // highest date from input
+
+ $season =
$this->season_bo->read_single($booking['season_id']);
+
+ $where_clauses[] =
sprintf("bb_booking.from_ >= '%s 00:00:00'", date('Y-m-d',
strtotime($_POST['from_'])));
+ if ($_POST['recurring'] ==
'on') {
+ $where_clauses[] =
sprintf("bb_booking.to_ < '%s 00:00:00'", date('Y-m-d', $repeat_until));
+ }
+ $params['filters']['where'] =
$where_clauses;
+ $params['filters']['season_id']
= $booking['season_id'];
+ $params['filters']['group_id']
= $booking['group_id'];
+
+ $bookings =
$this->bo->so->read($params);
+
+ if ($step == 2)
+ {
+
+ $_SESSION['audience'] =
$_POST['audience'];
+ $_SESSION['male'] =
$_POST['male'];
+ $_SESSION['female'] =
$_POST['female'];
+
+ }
+
+ if ($step == 3)
+ {
+
foreach($bookings['results'] as $b)
+ {
+ //reformatting
the post variable to fit the booking object
+ $temp_agegroup
= array();
+ $sexes =
array('male', 'female');
+ foreach($sexes
as $sex)
+ {
+ $i = 0;
+
foreach($_SESSION[$sex] as $agegroup_id => $value)
+ {
+
$temp_agegroup[$i]['agegroup_id'] = $agegroup_id;
+
$temp_agegroup[$i][$sex] = $value;
+
$i++;
+ }
+ }
+
+ $b['agegroups']
= $temp_agegroup;
+ $b['audience']
= $_SESSION['audience'];
+ $b['group_id']
=$_POST['group_id'];
+
$b['activity_id'] = $_POST['activity_id'];
+ $errors =
$this->bo->validate($b);
+ if(!$errors)
+ {
+
+
$receipt = $this->bo->update($b);
+
$update_count++;
+
+ }
+ }
+
unset($_SESSION['female']);
+
unset($_SESSION['male']);
+
unset($_SESSION['audience']);
+
+ }
+ }
}
}
$this->flash_form_errors($errors);
self::add_javascript('bookingfrontend',
'bookingfrontend', 'booking.js');
- $booking['resources_json'] =
json_encode(array_map('intval', $booking['resources']));
+ if ($step < 2) {
+ $booking['resources_json'] =
json_encode(array_map('intval', $booking['resources']));
+ $booking['organization_name'] =
$group['organization_name'];
+ }
$booking['cancel_link'] = self::link(array('menuaction'
=> 'bookingfrontend.uibuilding.schedule', 'id' => $booking['building_id']));
- $booking['update_link'] = self::link(array('menuaction'
=> 'bookingfrontend.uibooking.massupdate', 'id' => $booking['id']));
$agegroups = $this->agegroup_bo->fetch_age_groups();
$agegroups = $agegroups['results'];
$audience = $this->audience_bo->fetch_target_audience();
@@ -332,8 +434,37 @@
$group =
$this->group_bo->so->read_single($booking['group_id']);
$groups =
$this->group_bo->so->read(array('filters'=>array('organization_id'=>$group['organization_id'],
'active'=>1)));
$groups = $groups['results'];
- $booking['organization_name'] =
$group['organization_name'];
- self::render_template('booking_edit', array('booking'
=> $booking, 'activities' => $activities, 'agegroups' => $agegroups, 'audience'
=> $audience, 'groups' => $groups));
+ if ($step < 2)
+ {
+ self::render_template('booking_edit',
array('booking' => $booking,
+ 'activities' => $activities,
+ 'agegroups' => $agegroups,
+ 'audience' => $audience,
+ 'groups' => $groups,
+ 'step' => $step,
+ 'repeat_until' =>
$_POST['repeat_until'],
+ 'recurring' => $_POST['recurring'],
+ 'outseason' => $_POST['outseason'],
+ )
+ );
+ }
+ else if ($step >= 2)
+ {
+ self::render_template('booking_edit_preview',
array('booking' => $booking,
+ 'bookings' => $bookings,
+ 'agegroups' => $agegroups,
+ 'audience' => $audience,
+ 'groups' => $groups,
+ 'activities' => $activities,
+ 'step' => $step,
+ 'repeat_until' =>
$_POST['repeat_until'],
+ 'recurring' => $_POST['recurring'],
+ 'outseason' => $_POST['outseason'],
+ 'group_id' => $_POST['group_id'],
+ 'activity_id' => $_POST['activity_id'],
+ 'update_count' => $update_count)
+ );
+ }
}
public function massupdate()
Modified: branches/Version-1_0-branch/bookingfrontend/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/bookingfrontend/setup/phpgw_no.lang
2010-11-22 13:18:11 UTC (rev 6625)
+++ branches/Version-1_0-branch/bookingfrontend/setup/phpgw_no.lang
2010-11-22 13:33:58 UTC (rev 6626)
@@ -320,3 +320,4 @@
Confirm e-mail address bookingfrontend no Bekreft e-postadressen
The e-mail addresses you entered do not match bookingfrontend no
E-postadressene er ikke like
Lengt of shortname is to long, max 11 characters long bookingfrontend no
Kortnavn er for langt, maks 11 tegn
+Go back to calendar bookingfrontend no Tilbake til kalender
Modified:
branches/Version-1_0-branch/bookingfrontend/templates/base/booking_edit.xsl
===================================================================
--- branches/Version-1_0-branch/bookingfrontend/templates/base/booking_edit.xsl
2010-11-22 13:18:11 UTC (rev 6625)
+++ branches/Version-1_0-branch/bookingfrontend/templates/base/booking_edit.xsl
2010-11-22 13:33:58 UTC (rev 6626)
@@ -10,6 +10,7 @@
<form action="" method="POST">
<input type="hidden" name="season_id"
value="{booking/season_id}"/>
<input type="hidden" name="allocation_id"
value="{booking/allocation_id}"/>
+ <input type="hidden" name="step" value="1"/>
<dl class="form-col">
<dt><label for="field_active"><xsl:value-of
select="php:function('lang', 'Active')"/></label></dt>
<dd>
@@ -88,6 +89,32 @@
</input>
</div>
</dd>
+ <dt><label for="field_repeat_until"><xsl:value-of
select="php:function('lang', 'Recurring booking')" /></label></dt>
+ <dd>
+ <label>
+ <input type="checkbox" name="outseason"
id="outseason">
+ <xsl:if test="outseason='on'">
+ <xsl:attribute
name="checked">checked</xsl:attribute>
+ </xsl:if>
+ </input>
+ <xsl:value-of
select="php:function('lang', 'Out season')" />
+ </label>
+ </dd>
+ <dd>
+ <label>
+ <input type="checkbox" name="recurring"
id="recurring">
+ <xsl:if test="recurring='on'">
+ <xsl:attribute
name="checked">checked</xsl:attribute>
+ </xsl:if>
+ </input>
+ <xsl:value-of
select="php:function('lang', 'Repeat until')" />
+ </label>
+ </dd>
+ <dd class="date-picker">
+ <input id="field_repeat_until"
name="repeat_until" type="text">
+ <xsl:attribute
name="value"><xsl:value-of select="repeat_until"/></xsl:attribute>
+ </input>
+ </dd>
</dl>
<dl class="form-col">
<dt><label for="field_from"><xsl:value-of
select="php:function('lang', 'Target audience')" /></label></dt>
@@ -130,11 +157,6 @@
</tr>
</xsl:for-each>
</table>
- (<a href="javascript:
void(0)"
- onclick="window.open('{booking/update_link}',
- '',
- 'width=1000, height=600,
scrollbars=yes');
- return
false;"><xsl:value-of select="php:function('lang', 'Mass update')" /></a>)
</dd>
</dl>
<div class="form-buttons">
Copied:
branches/Version-1_0-branch/bookingfrontend/templates/base/booking_edit_preview.xsl
(from rev 6625, trunk/bookingfrontend/templates/base/booking_edit_preview.xsl)
===================================================================
---
branches/Version-1_0-branch/bookingfrontend/templates/base/booking_edit_preview.xsl
(rev 0)
+++
branches/Version-1_0-branch/bookingfrontend/templates/base/booking_edit_preview.xsl
2010-11-22 13:33:58 UTC (rev 6626)
@@ -0,0 +1,54 @@
+<xsl:template match="data" xmlns:php="http://php.net/xsl">
+ <div id="content">
+
+ <dl class="form">
+ <dt class="heading"><xsl:value-of
select="php:function('lang', 'Mass update')"/></dt>
+ </dl>
+ <xsl:call-template name="msgbox"/>
+ <xsl:call-template name="yui_booking_i18n"/>
+ <xsl:choose>
+ <xsl:when test="step = 2">
+ <p>
+ <xsl:value-of
select="php:function('lang', '%1 bookings will be updated.',
count(bookings/results))" />
+ </p>
+ <form action="" method="POST">
+ <input type="hidden"
name="repeat_until" value="{repeat_until}"/>
+ <input type="hidden" name="recurring"
value="{recurring}"/>
+ <input type="hidden" name="outseason"
value="{outseason}"/>
+ <input type="hidden" name="season_id"
value="{booking/season_id}"/>
+ <input type="hidden" name="step"
value="{step}"/>
+ <input type="hidden" name="group_id"
value="{group_id}"/>
+ <input type="hidden" name="activity_id"
value="{activity_id}"/>
+ <input type="hidden" name="building_id"
value="{booking/building_id}"/>
+ <select size="10">
+ <xsl:for-each
select="bookings/results">
+ <option>
+ <xsl:attribute
name="value"><xsl:value-of select="id"/></xsl:attribute>
+ <xsl:value-of
select="from_"/> - <xsl:value-of select="to_"/>
+ </option>
+ </xsl:for-each>
+ </select>
+ <xsl:if test="count(bookings/results)
> 0">
+ <div class="form-buttons">
+ <input type="submit"
style="float: right;">
+ <xsl:attribute
name="value"><xsl:value-of select="php:function('lang',
'Update')"/></xsl:attribute>
+ </input>
+ </div>
+ </xsl:if>
+ </form>
+ </xsl:when>
+ <xsl:when test="step = 3">
+ <p>
+ <xsl:value-of
select="php:function('lang', '%1 bookings were updated.', update_count)" />
+ <div class="form-buttons">
+ <a class="cancel">
+ <xsl:attribute name="href"><xsl:value-of
select="booking/cancel_link"/></xsl:attribute>
+ <xsl:value-of select="php:function('lang', 'Go
back to calendar')" />
+ </a>
+ </div>
+ </p>
+
+ </xsl:when>
+ </xsl:choose>
+ </div>
+</xsl:template>
Deleted: branches/Version-1_0-branch/property/inc/class.boactor.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.boactor.inc.php
2010-11-22 13:18:11 UTC (rev 6625)
+++ branches/Version-1_0-branch/property/inc/class.boactor.inc.php
2010-11-22 13:33:58 UTC (rev 6626)
@@ -1,264 +0,0 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software
Foundation, Inc. http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
- * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
- * @package property
- * @subpackage admin
- * @version $Id$
- */
-
- /**
- * Description
- * @package property
- */
-
- class property_boactor
- {
- var $start;
- var $query;
- var $filter;
- var $sort;
- var $order;
- var $cat_id;
- var $role;
- var $member_id;
-
- protected $valid_role = array(
- 'tenant'=>true,
- 'owner' =>true,
- 'vendor'=>true
- );
-
- /**
- * @var object $custom reference to custom fields object
- */
- protected $custom;
-
- var $public_functions = array
- (
- 'read' => true,
- 'read_single' => true,
- 'save' => true,
- 'delete' => true,
- 'check_perms' => true
- );
-
- function __construct($session=false)
- {
- $this->so =
CreateObject('property.soactor');
- $this->bocommon = & $this->so->bocommon;
- $this->custom = & $this->so->custom;
-
- if ($session)
- {
- $this->read_sessiondata();
- $this->use_session = true;
- }
-
- $start = phpgw::get_var('start', 'int',
'REQUEST', 0);
- $query = phpgw::get_var('query');
- $sort = phpgw::get_var('sort');
- $order = phpgw::get_var('order');
- $filter = phpgw::get_var('filter', 'int');
- $cat_id = phpgw::get_var('cat_id', 'int');
- $allrows = phpgw::get_var('allrows', 'bool');
- $role = phpgw::get_var('role');
- $member_id = phpgw::get_var('member_id', 'int');
-
- $this->role = $role;
- $this->so->role = $role;
-
- if ($start)
- {
- $this->start=$start;
- }
- else
- {
- $this->start=0;
- }
-
- if(isset($query))
- {
- $this->query = $query;
- }
- if(!empty($filter))
- {
- $this->filter = $filter;
- }
- if(isset($sort))
- {
- $this->sort = $sort;
- }
- if(isset($order))
- {
- $this->order = $order;
- }
- if(isset($cat_id) && !empty($cat_id))
- {
- $this->cat_id = $cat_id;
- }
- else
- {
- $this->cat_id = '';
- }
- if(isset($allrows))
- {
- $this->allrows = $allrows;
- }
- if(isset($member_id))
- {
- $this->member_id = $member_id;
- }
- }
-
- function save_sessiondata($data)
- {
- if ($this->use_session)
- {
-
$GLOBALS['phpgw']->session->appsession('session_data','actor_' .
$this->role,$data);
- }
- }
-
- public function check_valid_role($role)
- {
- return $this->valid_role[$role];
- }
-
- function read_sessiondata()
- {
- $data =
$GLOBALS['phpgw']->session->appsession('session_data','actor_' . $this->role);
-
- //_debug_array($data);
-
- $this->start = $data['start'];
- $this->query = $data['query'];
- $this->filter = $data['filter'];
- $this->sort = $data['sort'];
- $this->order = $data['order'];
- $this->cat_id = $data['cat_id'];
- $this->member_id= $data['member_id'];
- $this->allrows = $data['allrows'];
- }
-
- function check_perms($has, $needed)
- {
- return (!!($has & $needed) == true);
- }
-
- function read($dry_run='')
- {
- $actor = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'filter' => $this->filter,'cat_id' =>
$this->cat_id,'allrows'=>$this->allrows,
-
'member_id'=>$this->member_id, 'dry_run' => $dry_run));
- $this->total_records = $this->so->total_records;
-
- $this->uicols = $this->so->uicols;
-
- for ($i=0; $i<count($actor); $i++)
- {
- if(isset($actor[$i]['entry_date']) &&
$actor[$i]['entry_date'])
- {
- $actor[$i]['entry_date'] =
$GLOBALS['phpgw']->common->show_date($actor[$i]['entry_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- }
- }
- return $actor;
- }
-
- function read_single($data)
- {
- $values['attributes'] =
$this->custom->find('property','.' . $this->role, 0, '', 'ASC', 'attrib_sort',
true, true);
- if(isset($data['actor_id']) && $data['actor_id'])
- {
- $values =
$this->so->read_single($data['actor_id'], $values);
- }
-
- $values = $this->custom->prepare($values,
'property','.' . $this->role, $data['view']);
- return $values;
- }
-
- /**
- * Arrange attributes within groups
- *
- * @param string $location the name of the location of the
attribute
- * @param array $attributes the array of the attributes to be
grouped
- *
- * @return array the grouped attributes
- */
-
- public function get_attribute_groups($location, $attributes =
array())
- {
- return $this->custom->get_attribute_groups('property',
$location, $attributes);
- }
-
- function save($actor,$values_attribute='')
- {
- if(is_array($values_attribute))
- {
- $values_attribute =
$this->custom->convert_attribute_save($values_attribute);
- }
-
- if ($actor['actor_id'])
- {
- if ($actor['actor_id'] != 0)
- {
- $actor_id = $actor['actor_id'];
-
$receipt=$this->so->edit($actor,$values_attribute);
- }
- }
- else
- {
- $receipt =
$this->so->add($actor,$values_attribute);
- }
- return $receipt;
- }
-
- function delete($actor_id)
- {
- $this->so->delete($actor_id);
- }
-
- function column_list($selected='',$allrows='')
- {
- if(!$selected)
- {
-
$selected=$GLOBALS['phpgw_info']['user']['preferences']['property']["actor_columns_"
. $this->role];
- }
- $filter = array('list' => ''); // translates to "list
IS NULL"
- $columns = $this->custom->find('property','.' .
$this->role, 0, '','','',true, false, $filter);
-
$column_list=$this->bocommon->select_multi_list($selected,$columns);
-
- return $column_list;
- }
-
- /**
- * Preserve attribute values from post in case of an error
- *
- * @param array $values_attribute attribute definition and
values from posting
- * @param array $values value set with
- * @return array Array with attribute definition and values
- */
- function preserve_attribute_values($values,$values_attribute)
- {
- return
$this->bocommon->preserve_attribute_values($values,$values_attribute);
- }
- }
Deleted: branches/Version-1_0-branch/property/inc/class.bocategory.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.bocategory.inc.php
2010-11-22 13:18:11 UTC (rev 6625)
+++ branches/Version-1_0-branch/property/inc/class.bocategory.inc.php
2010-11-22 13:33:58 UTC (rev 6626)
@@ -1,230 +0,0 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003,2004,2005,2006,2007,2008,2009 Free
Software Foundation, Inc. http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
- * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
- * @package property
- * @subpackage admin
- * @version $Id$
- */
-
- /**
- * Description
- * @package property
- */
-
- class property_bocategory
- {
- var $start;
- var $query;
- var $filter;
- var $sort;
- var $order;
- var $cat_id;
- var $location_info = array();
-
- var $soap_functions = array(
- 'list' => array(
- 'in' =>
array('int','int','struct','string','int'),
- 'out' => array('array')
- ),
- 'read' => array(
- 'in' => array('int','struct'),
- 'out' => array('array')
- ),
- 'save' => array(
- 'in' => array('int','struct'),
- 'out' => array()
- ),
- 'delete' => array(
- 'in' => array('int','struct'),
- 'out' => array()
- )
- );
-
- function __construct($session=false)
- {
- $this->so =
CreateObject('property.socategory');
- $this->custom = & $this->so->custom;
- $this->bocommon =
CreateObject('property.bocommon');
-
- $start =
phpgw::get_var('start', 'int', 'REQUEST', 0);
- $query =
phpgw::get_var('query');
- $sort =
phpgw::get_var('sort');
- $order =
phpgw::get_var('order');
- $filter =
phpgw::get_var('filter', 'int');
- $cat_id =
phpgw::get_var('cat_id', 'int');
- $allrows =
phpgw::get_var('allrows', 'bool');
- $type =
phpgw::get_var('type');
- $type_id =
phpgw::get_var('type_id', 'int');
-
- $this->type_id = $type;
- $this->type_id = $type_id;
-
- if ($session)
- {
- $this->read_sessiondata($type);
- $this->use_session = true;
- }
-
- $this->start = $start ? $start : 0;
- $this->query = isset($_REQUEST['query']) ?
$query : $this->query;
- $this->sort =
isset($_REQUEST['sort']) ? $sort : $this->sort;
- $this->order = isset($_REQUEST['order']) &&
$_REQUEST['order'] ? $order : $this->order;
- $this->filter = isset($_REQUEST['filter']) ?
$filter : $this->filter;
- $this->cat_id = isset($_REQUEST['cat_id']) ?
$cat_id : $this->cat_id;
- $this->allrows = isset($allrows) ? $allrows :
false;
-
- $this->location_info =
$this->so->get_location_info($type, $type_id);
-
- }
-
- public function save_sessiondata($data)
- {
- if ($this->use_session)
- {
-
$GLOBALS['phpgw']->session->appsession('session_data',"generic_{$data['type']}",$data);
- }
- }
-
- function read_sessiondata($type)
- {
- $data =
$GLOBALS['phpgw']->session->appsession('session_data',"generic_{$type}");
-
- // _debug_array($data);
-
- $this->start = $data['start'];
- $this->query = $data['query'];
- $this->filter = $data['filter'];
- $this->sort = $data['sort'];
- $this->order = $data['order'];
- $this->cat_id = $data['cat_id'];
- $this->allrows = $data['allrows'];
- }
-
- public function get_location_info($type,$type_id)
- {
- return $this->so->get_location_info($type,$type_id);
- }
-
- function column_list($selected='',$allrows='')
- {
- if(!$selected)
- {
- $selected =
$GLOBALS['phpgw_info']['user']['preferences']['property']["generic_columns_{$this->type}_{$this->type_id}"];
- }
- $filter = array('list' => ''); // translates to "list
IS NULL"
- $columns =
$this->custom->find('property',$this->location_info['acl_location'], 0,
'','','',true, false, $filter);
-
$column_list=$this->bocommon->select_multi_list($selected,$columns);
-
- return $column_list;
- }
-
- public function read($filter = array())
- {
- if (! $filter )
- {
- foreach ( $this->location_info['fields'] as
$field )
- {
- if (isset($field['filter']) &&
$field['filter'])
- {
- $filter[$field['name']] =
phpgw::get_var($field['name']);
- }
- }
- }
-
- $values = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'allrows'=>$this->allrows),$filter);
-
- $this->total_records = $this->so->total_records;
- $this->uicols = $this->so->uicols;
-
- return $values;
- }
-
- public function read_single($data=array())
- {
- $custom_fields = false;
-
if($GLOBALS['phpgw']->locations->get_attrib_table('property',
$this->location_info['acl_location']))
- {
- $custom_fields = true;
- $values = array();
- $values['attributes'] =
$this->custom->find('property', $this->location_info['acl_location'], 0, '',
'ASC', 'attrib_sort', true, true);
- }
-
- if(isset($data['id']) && $data['id'])
- {
- $values = $this->so->read_single($data,
$values);
- }
- if($custom_fields)
- {
- $values = $this->custom->prepare($values,
'property',$this->location_info['acl_location'], $data['view']);
- }
- return $values;
- }
-
- public function save($data,$action='',$values_attribute =
array())
- {
- if(is_array($values_attribute))
- {
- $values_attribute =
$this->custom->convert_attribute_save($values_attribute);
- }
-
- if ($action=='edit')
- {
- if ($data['id'] != '')
- {
-
- $receipt =
$this->so->edit($data,$values_attribute);
- }
- }
- else
- {
- $receipt =
$this->so->add($data,$values_attribute);
- }
-
- return $receipt;
- }
-
- /**
- * Get a list from and tag the selected item
- *
- * @param array $data
- *
- * @return array with information to include in forms
- */
-
- public function get_list($data)
- {
- $values = $this->so->get_list($data);
- foreach ($values as &$entry)
- {
- $entry['selected'] = isset($data['selected'])
&& trim($data['selected']) == trim($entry['id']) ? 1 : 0;
- }
- return $values;
- }
-
- public function delete($id)
- {
- $this->so->delete($id);
- }
- }
Modified: branches/Version-1_0-branch/property/inc/class.bocommon.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.bocommon.inc.php
2010-11-22 13:18:11 UTC (rev 6625)
+++ branches/Version-1_0-branch/property/inc/class.bocommon.inc.php
2010-11-22 13:33:58 UTC (rev 6626)
@@ -556,12 +556,13 @@
if(isset($data['vendor_id']) && $data['vendor_id'] &&
!$data['vendor_name'])
{
- $contacts =
CreateObject('property.soactor');
- $contacts->role='vendor';
+ $contacts =
CreateObject('property.sogeneric');
+ $contacts->get_location_info('vendor',false);
+
$custom =
createObject('property.custom_fields');
$vendor_data['attributes'] =
$custom->find('property','.vendor', 0, '', 'ASC', 'attrib_sort', true, true);
- $vendor_data =
$contacts->read_single($data['vendor_id'],$vendor_data);
+ $vendor_data =
$contacts->read_single(array('id' => $data['vendor_id']),$vendor_data);
if(is_array($vendor_data))
{
foreach($vendor_data['attributes'] as
$attribute)
@@ -651,11 +652,12 @@
if($data['tenant_id'] && !$data['tenant_name'])
{
- $tenant_object =
CreateObject('property.soactor');
- $tenant_object->role = 'tenant';
+ $tenant_object =
CreateObject('property.sogeneric');
+
$tenant_object->get_location_info('tenant',false);
+
$custom =
createObject('property.custom_fields');
$tenant_data['attributes'] =
$custom->find('property','.tenant', 0, '', 'ASC', 'attrib_sort', true, true);
- $tenant_data =
$tenant_object->read_single($data['tenant_id'],$tenant_data);
+ $tenant_data =
$tenant_object->read_single(array('id' => $data['tenant_id']),$tenant_data);
if(is_array($tenant_data['attributes']))
{
//_debug_array($tenant_data);
@@ -709,7 +711,7 @@
$b_account['lang_b_account'] =
isset($data['role']) && $data['role'] == 'group' ? lang('budget account group')
: lang('Budget account');
if($data['b_account_id'] && !$data['b_account_name'])
{
- $b_account_object =
CreateObject('property.socategory');
+ $b_account_object =
CreateObject('property.sogeneric');
if(isset($data['role']) && $data['role'] ==
'group')
{
$b_account_object->get_location_info('b_account',false);
@@ -751,7 +753,7 @@
$project_group['lang_project_group']
= lang('project group');
if($data['project_group'] &&
(!isset($data['project_group_descr']) || !$data['project_group_descr']))
{
- $project_group_object
= CreateObject('property.socategory');
+ $project_group_object
= CreateObject('property.sogeneric');
$project_group_object->get_location_info('project_group',false);
$project_group_data
= $project_group_object->read_single(array('id'=>
$data['project_group']));
$project_group['value_project_group_descr']
= $project_group_data['descr'];
@@ -785,7 +787,7 @@
$ecodimb['lang_ecodimb']
= lang('dimb');
if($data['ecodimb'] && (!isset($data['ecodimb_descr'])
|| !$data['ecodimb_descr']))
{
- $ecodimb_object
= CreateObject('property.socategory');
+ $ecodimb_object
= CreateObject('property.sogeneric');
$ecodimb_object->get_location_info('dimb',false);
$ecodimb_data
= $ecodimb_object->read_single(array('id'=> $data['ecodimb']));
$ecodimb['value_ecodimb_descr'] =
$ecodimb_data['descr'];
@@ -1512,9 +1514,9 @@
break;
}
- $socategory = CreateObject('property.socategory');
+ $sogeneric = CreateObject('property.sogeneric');
- $categories= $socategory->get_list($data);
+ $categories= $sogeneric->get_list($data);
return
$this->select_list($data['selected'],$categories);
}
Modified: branches/Version-1_0-branch/property/inc/class.bodocument.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.bodocument.inc.php
2010-11-22 13:18:11 UTC (rev 6625)
+++ branches/Version-1_0-branch/property/inc/class.bodocument.inc.php
2010-11-22 13:33:58 UTC (rev 6626)
@@ -60,8 +60,8 @@
$this->bocommon =
CreateObject('property.bocommon');
$this->solocation =
CreateObject('property.solocation');
$this->historylog =
CreateObject('property.historylog','document');
- $this->contacts =
CreateObject('property.soactor');
- $this->contacts->role ='vendor';
+ $this->contacts = CreateObject('property.sogeneric');
+ $this->contacts->get_location_info('vendor',false);
$this->cats = &
$this->so->cats;
$this->bofiles =
CreateObject('property.bofiles');
@@ -230,7 +230,7 @@
{
$custom =
createObject('property.custom_fields');
$vendor['attributes'] =
$custom->find('property','.vendor', 0, '', 'ASC', 'attrib_sort', true, true);
- $vendor =
$this->contacts->read_single($document['vendor_id'],$vendor);
+ $vendor =
$this->contacts->read_single(array('id' => $document['vendor_id']),$vendor);
foreach($vendor['attributes'] as $attribute)
{
if($attribute['name']=='org_name')
Modified: branches/Version-1_0-branch/property/inc/class.boevent.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.boevent.inc.php
2010-11-22 13:18:11 UTC (rev 6625)
+++ branches/Version-1_0-branch/property/inc/class.boevent.inc.php
2010-11-22 13:33:58 UTC (rev 6626)
@@ -248,7 +248,7 @@
$receipt = $this->so->add($data);
}
- $action_object =
CreateObject('property.socategory');
+ $action_object =
CreateObject('property.sogeneric');
$action_object->get_location_info('event_action',false);
$action = $action_object->read_single(array('id'=>
$data['action']),$values = array());
@@ -506,7 +506,7 @@
public function get_action($selected = '')
{
-/* $action_object =
CreateObject('property.socategory');
+/* $action_object =
CreateObject('property.sogeneric');
$action_object->get_location_info('event_action',false);
$values =
$action_object->read(array('allrows'=> true));
*/
Copied: branches/Version-1_0-branch/property/inc/class.bogeneric.inc.php (from
rev 6625, trunk/property/inc/class.bogeneric.inc.php)
===================================================================
--- branches/Version-1_0-branch/property/inc/class.bogeneric.inc.php
(rev 0)
+++ branches/Version-1_0-branch/property/inc/class.bogeneric.inc.php
2010-11-22 13:33:58 UTC (rev 6626)
@@ -0,0 +1,231 @@
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003,2004,2005,2006,2007,2008,2009 Free
Software Foundation, Inc. http://www.fsf.org/
+ * This file is part of phpGroupWare.
+ *
+ * phpGroupWare is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * phpGroupWare is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with phpGroupWare; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
+ *
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
+ * @package property
+ * @subpackage admin
+ * @version $Id$
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class property_bogeneric
+ {
+ var $start;
+ var $query;
+ var $filter;
+ var $sort;
+ var $order;
+ var $cat_id;
+ var $location_info = array();
+
+ var $soap_functions = array(
+ 'list' => array(
+ 'in' =>
array('int','int','struct','string','int'),
+ 'out' => array('array')
+ ),
+ 'read' => array(
+ 'in' => array('int','struct'),
+ 'out' => array('array')
+ ),
+ 'save' => array(
+ 'in' => array('int','struct'),
+ 'out' => array()
+ ),
+ 'delete' => array(
+ 'in' => array('int','struct'),
+ 'out' => array()
+ )
+ );
+
+ function __construct($session=false)
+ {
+ $this->so =
CreateObject('property.sogeneric');
+ $this->custom = & $this->so->custom;
+ $this->bocommon =
CreateObject('property.bocommon');
+
+ $start =
phpgw::get_var('start', 'int', 'REQUEST', 0);
+ $query =
phpgw::get_var('query');
+ $sort =
phpgw::get_var('sort');
+ $order =
phpgw::get_var('order');
+ $filter =
phpgw::get_var('filter', 'int');
+ $cat_id =
phpgw::get_var('cat_id', 'int');
+ $allrows =
phpgw::get_var('allrows', 'bool');
+ $type =
phpgw::get_var('type');
+ $type_id =
phpgw::get_var('type_id', 'int', 'REQUEST', 0);
+
+ $this->type = $type;
+ $this->type_id = $type_id;
+
+ if ($session)
+ {
+ $this->read_sessiondata($type);
+ $this->use_session = true;
+ }
+
+ $this->start = $start ? $start : 0;
+ $this->query = isset($_REQUEST['query']) ?
$query : $this->query;
+ $this->sort =
isset($_REQUEST['sort']) ? $sort : $this->sort;
+ $this->order = isset($_REQUEST['order']) &&
$_REQUEST['order'] ? $order : $this->order;
+ $this->filter = isset($_REQUEST['filter']) ?
$filter : $this->filter;
+ $this->cat_id = isset($_REQUEST['cat_id']) ?
$cat_id : $this->cat_id;
+ $this->allrows = isset($allrows) ? $allrows :
false;
+
+ $this->location_info =
$this->so->get_location_info($type, $type_id);
+
+ }
+
+ public function save_sessiondata($data)
+ {
+ if ($this->use_session)
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data',"generic_{$data['type']}",$data);
+ }
+ }
+
+ function read_sessiondata($type)
+ {
+ $data =
$GLOBALS['phpgw']->session->appsession('session_data',"generic_{$type}");
+
+ // _debug_array($data);
+
+ $this->start = $data['start'];
+ $this->query = $data['query'];
+ $this->filter = $data['filter'];
+ $this->sort = $data['sort'];
+ $this->order = $data['order'];
+ $this->cat_id = $data['cat_id'];
+ $this->allrows = $data['allrows'];
+ }
+
+ public function get_location_info($type,$type_id)
+ {
+ return $this->so->get_location_info($type,$type_id);
+ }
+
+ function column_list($selected='',$allrows='')
+ {
+ if(!$selected)
+ {
+ $selected =
$GLOBALS['phpgw_info']['user']['preferences']['property']["generic_columns_{$this->type}_{$this->type_id}"];
+ }
+
+ $filter = array('list' => ''); // translates to "list
IS NULL"
+ $columns =
$this->custom->find('property',$this->location_info['acl_location'], 0,
'','','',true, false, $filter);
+
$column_list=$this->bocommon->select_multi_list($selected,$columns);
+
+ return $column_list;
+ }
+
+ public function read($filter = array())
+ {
+ if (! $filter )
+ {
+ foreach ( $this->location_info['fields'] as
$field )
+ {
+ if (isset($field['filter']) &&
$field['filter'])
+ {
+ $filter[$field['name']] =
phpgw::get_var($field['name']);
+ }
+ }
+ }
+
+ $values = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'allrows'=>$this->allrows),$filter);
+
+ $this->total_records = $this->so->total_records;
+ $this->uicols = $this->so->uicols;
+
+ return $values;
+ }
+
+ public function read_single($data=array())
+ {
+ $custom_fields = false;
+
if($GLOBALS['phpgw']->locations->get_attrib_table('property',
$this->location_info['acl_location']))
+ {
+ $custom_fields = true;
+ $values = array();
+ $values['attributes'] =
$this->custom->find('property', $this->location_info['acl_location'], 0, '',
'ASC', 'attrib_sort', true, true);
+ }
+
+ if(isset($data['id']) && $data['id'])
+ {
+ $values = $this->so->read_single($data,
$values);
+ }
+ if($custom_fields)
+ {
+ $values = $this->custom->prepare($values,
'property',$this->location_info['acl_location'], $data['view']);
+ }
+ return $values;
+ }
+
+ public function save($data,$action='',$values_attribute =
array())
+ {
+ if(is_array($values_attribute))
+ {
+ $values_attribute =
$this->custom->convert_attribute_save($values_attribute);
+ }
+
+ if ($action=='edit')
+ {
+ if ($data['id'] != '')
+ {
+
+ $receipt =
$this->so->edit($data,$values_attribute);
+ }
+ }
+ else
+ {
+ $receipt =
$this->so->add($data,$values_attribute);
+ }
+
+ return $receipt;
+ }
+
+ /**
+ * Get a list from and tag the selected item
+ *
+ * @param array $data
+ *
+ * @return array with information to include in forms
+ */
+
+ public function get_list($data)
+ {
+ $values = $this->so->get_list($data);
+ foreach ($values as &$entry)
+ {
+ $entry['selected'] = isset($data['selected'])
&& trim($data['selected']) == trim($entry['id']) ? 1 : 0;
+ }
+ return $values;
+ }
+
+ public function delete($id)
+ {
+ $this->so->delete($id);
+ }
+ }
Modified: branches/Version-1_0-branch/property/inc/class.boinvoice.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.boinvoice.inc.php
2010-11-22 13:18:11 UTC (rev 6625)
+++ branches/Version-1_0-branch/property/inc/class.boinvoice.inc.php
2010-11-22 13:33:58 UTC (rev 6626)
@@ -493,8 +493,8 @@
function get_vendor_name($vendor_id='')
{
- $contacts = CreateObject('property.soactor');
- $contacts->role='vendor';
+ $contacts = CreateObject('property.sogeneric');
+ $contacts->get_location_info('vendor',false);
$criteria = array
(
@@ -507,7 +507,7 @@
)
);
- $vendor_data = $contacts->read_single($vendor_id,
$criteria);
+ $vendor_data = $contacts->read_single(array('id' =>
$vendor_id), $criteria);
if(is_array($vendor_data))
{
@@ -573,5 +573,42 @@
}
return $values;
}
+
+ public function get_single_line($id)
+ {
+ $line = $this->so->get_single_line($id);
+
+ $soXport = CreateObject('property.soXport');
+ $soworkorder = CreateObject('property.soworkorder');
+ $sos_agreement = CreateObject('property.sos_agreement');
+ if( $line['order_id'] )
+ {
+ if($order_type =
$soXport->check_order($line['order_id']))
+ {
+ if($order_type == 'workorder')
+ {
+ $workorder =
$soworkorder->read_single($line['order_id']);
+ if($workorder['vendor_id'] &&
($workorder['vendor_id'] != $line['vendor_id']))
+ {
+ $line['vendor']
= $this->get_vendor_name($workorder['vendor_id']) . ' => ' .
$this->get_vendor_name($line['vendor_id']);
+ }
+ }
+ if($order_type == 's_agreement')
+ {
+ $s_agreement =
$sos_agreement->read_single(array('s_agreement_id'=>$line['order_id']));
+ if($s_agreement['vendor_id'] &&
($s_agreement['vendor_id'] != $line['vendor_id']))
+ {
+ $line['vendor']
= $this->get_vendor_name($s_agreement['vendor_id']) . ' => ' .
$this->get_vendor_name($line['vendor_id']);
+ }
+ }
+ $line['order_type'] = $order_type;
+ }
+ }
+
+ if(!isset($line['vendor']))
+ {
+ $line['vendor'] =
$this->get_vendor_name($line['vendor_id']);
+ }
+ return $line;
+ }
}
-
Modified: branches/Version-1_0-branch/property/inc/class.bolookup.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.bolookup.inc.php
2010-11-22 13:18:11 UTC (rev 6625)
+++ branches/Version-1_0-branch/property/inc/class.bolookup.inc.php
2010-11-22 13:33:58 UTC (rev 6626)
@@ -314,7 +314,7 @@
function read_project_group()
{
- $project_group = CreateObject('property.socategory');
+ $project_group = CreateObject('property.sogeneric');
$project_group->get_location_info('project_group',false);
$values = $project_group->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
'type' => 'project_group','allrows'=>$this->allrows));
@@ -325,7 +325,7 @@
}
function read_ecodimb()
{
- $ecodimb = CreateObject('property.socategory');
+ $ecodimb = CreateObject('property.sogeneric');
$ecodimb->get_location_info('dimb',false);
$values = $ecodimb->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
'allrows'=>$this->allrows));
Modified: branches/Version-1_0-branch/property/inc/class.boproject.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.boproject.inc.php
2010-11-22 13:18:11 UTC (rev 6625)
+++ branches/Version-1_0-branch/property/inc/class.boproject.inc.php
2010-11-22 13:33:58 UTC (rev 6626)
@@ -366,8 +366,8 @@
function read_single($project_id = 0, $values = array(), $view
= false)
{
- $contacts =
CreateObject('property.soactor');
- $contacts->role='vendor';
+ $contacts = CreateObject('property.sogeneric');
+ $contacts->get_location_info('vendor',false);
$config =
CreateObject('phpgwapi.config','property');
$config->read();
@@ -416,7 +416,7 @@
{
$vendor['attributes'] =
$this->custom->find('property','.vendor', 0, '', 'ASC', 'attrib_sort', true,
true);
- $vendor =
$contacts->read_single($workorder_data[$i]['vendor_id'], $vendor);
+ $vendor =
$contacts->read_single(array('id' => $workorder_data[$i]['vendor_id']),
$vendor);
foreach($vendor['attributes'] as
$attribute)
{
if($attribute['name']=='org_name')
Modified: branches/Version-1_0-branch/property/inc/class.botts.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.botts.inc.php
2010-11-22 13:18:11 UTC (rev 6625)
+++ branches/Version-1_0-branch/property/inc/class.botts.inc.php
2010-11-22 13:33:58 UTC (rev 6626)
@@ -324,8 +324,9 @@
if(!$external)
{
$entity = $this->get_origin_entity_type();
- $contacts =
CreateObject('property.soactor');
- $contacts->role='vendor';
+ $contacts =
CreateObject('property.sogeneric');
+ $contacts->get_location_info('vendor',false);
+
$custom =
createObject('property.custom_fields');
$vendor_data['attributes'] =
$custom->find('property','.vendor', 0, '', 'ASC', 'attrib_sort', true, true);
}
@@ -422,7 +423,7 @@
}
else
{
- $vendor_data =
$contacts->read_single($ticket['vendor_id'],$vendor_data);
+ $vendor_data =
$contacts->read_single(array('id' => $ticket['vendor_id']),$vendor_data);
if($vendor_data)
{
foreach($vendor_data['attributes'] as $attribute)
Modified: branches/Version-1_0-branch/property/inc/class.boworkorder.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.boworkorder.inc.php
2010-11-22 13:18:11 UTC (rev 6625)
+++ branches/Version-1_0-branch/property/inc/class.boworkorder.inc.php
2010-11-22 13:33:58 UTC (rev 6626)
@@ -410,8 +410,8 @@
function read_single($workorder_id)
{
- $contacts =
CreateObject('property.soactor');
- $contacts->role='vendor';
+ $contacts = CreateObject('property.sogeneric');
+ $contacts->get_location_info('vendor',false);
$workorder
= $this->so->read_single($workorder_id);
$dateformat
= $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
$workorder['start_date'] =
$GLOBALS['phpgw']->common->show_date($workorder['start_date'],$dateformat);
@@ -421,7 +421,7 @@
{
$custom =
createObject('property.custom_fields');
$vendor['attributes'] =
$custom->find('property','.vendor', 0, '', 'ASC', 'attrib_sort', true, true);
- $vendor =
$contacts->read_single($workorder['vendor_id'],$vendor);
+ $vendor =
$contacts->read_single(array('id' => $workorder['vendor_id']),$vendor);
foreach($vendor['attributes'] as $attribute)
{
if($attribute['name']=='org_name')
Modified: branches/Version-1_0-branch/property/inc/class.custom_fields.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.custom_fields.inc.php
2010-11-22 13:18:11 UTC (rev 6625)
+++ branches/Version-1_0-branch/property/inc/class.custom_fields.inc.php
2010-11-22 13:33:58 UTC (rev 6626)
@@ -66,8 +66,9 @@
public function prepare($values, $appname, $location,
$view_only='')
{
$contacts =
CreateObject('phpgwapi.contacts');
- $vendor =
CreateObject('property.soactor');
- $vendor->role = 'vendor';
+ $vendor = CreateObject('property.sogeneric');
+ $vendor->get_location_info('vendor',false);
+
$location_id =
$GLOBALS['phpgw']->locations->get_id($appname, $location);
$dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
@@ -168,7 +169,7 @@
{
if($attributes['value'])
{
- $vendor_data =
$vendor->read_single($attributes['value'],array('attributes' => array(0 =>
array('column_name' => 'org_name'))));
+ $vendor_data =
$vendor->read_single(array('id' => $attributes['value']),array('attributes' =>
array(0 => array('column_name' => 'org_name'))));
for
($n=0;$n<count($vendor_data['attributes']);$n++)
{
Modified: branches/Version-1_0-branch/property/inc/class.menu.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.menu.inc.php 2010-11-22
13:18:11 UTC (rev 6625)
+++ branches/Version-1_0-branch/property/inc/class.menu.inc.php 2010-11-22
13:33:58 UTC (rev 6626)
@@ -108,7 +108,7 @@
'tenant_cats' => array
(
'text' => lang('Tenant
Categories'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'tenant_cats') )
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'tenant_cats') )
),
'tenant_global_cats' => array
(
@@ -123,7 +123,7 @@
'claims_cats' => array
(
'text' => lang('Tenant Claim
Categories'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'tenant_claim') )
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'tenant_claim') )
)
);
@@ -132,7 +132,7 @@
'vendor_cats' => array
(
'text' => lang('Vendor
Categories'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'vendor_cats') )
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'vendor_cats') )
),
'vendor_global_cats' => array
(
@@ -150,7 +150,7 @@
'owner_cats' => array
(
'text' => lang('Owner
Categories'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'owner_cats') )
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'owner_cats') )
),
'owner_attribs' => array
(
@@ -164,17 +164,17 @@
'accounting_cats' => array
(
'text' => lang('Accounting
Categories'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'b_account') )
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'b_account') )
),
'budget_account' => array
(
'text' => lang('budget
account'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'budget_account') )
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'budget_account') )
),
'accounting_dimb' => array
(
'text' => lang('Accounting dim
b'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'dimb') )
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'dimb') )
),
'dimb_roles' => array
(
@@ -184,22 +184,22 @@
'accounting_dimd' => array
(
'text' => lang('Accounting dim
d'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'dimd') )
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'dimd') )
),
'accounting_tax' => array
(
'text' => lang('Accounting
tax'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'tax') )
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'tax') )
),
'voucher_cats' => array
(
'text' => lang('Accounting
voucher category'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'voucher_cat') )
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'voucher_cat') )
),
'voucher_type' => array
(
'text' => lang('Accounting
voucher type'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'voucher_type') )
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'voucher_type') )
)
);
@@ -208,7 +208,7 @@
'agreement_status' => array
(
'text' => lang('Agreement
status'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'agreement_status') )
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'agreement_status') )
),
'agreement_attribs' => array
(
@@ -218,7 +218,7 @@
'service_agree_cats' => array
(
'text' => lang('service
agreement categories'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 's_agreement') )
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 's_agreement') )
),
'service_agree_attribs' => array
(
@@ -241,7 +241,7 @@
);
$admin_children_location_children["category_{$location['id']}"] = array
(
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uicategory.index', 'type' => 'location', 'type_id' =>
$location['id']) ),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uigeneric.index', 'type' => 'location', 'type_id' => $location['id'])
),
'text' => $location['name'] .
' ' . lang('categories'),
);
}
@@ -251,22 +251,22 @@
'street' => array
(
'text' => lang('Street'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'street') )
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'street') )
),
'district' => array
(
'text' => lang('District'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'district') )
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'district') )
),
'district' => array
(
'text' => lang('District'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'district') )
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'district') )
),
'town' => array
(
'text' => lang('Part of town'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'part_of_town') )
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'part_of_town') )
),
'location' => array
(
@@ -320,7 +320,7 @@
'workorder_detail' => array
(
'text' => lang('Workorder
Detail Categories'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'wo_hours') )
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'wo_hours') )
),
'ticket_cats' => array
(
@@ -330,25 +330,25 @@
'ticket_status' => array
(
'text' => lang('Ticket
status'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'ticket_status') )
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'ticket_status') )
),
'tenant' => array
(
'text' => lang('Tenant'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uiactor.index', 'role' => 'tenant', 'admin' => true) ),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'tenant', 'admin' => true) ),
'image' => array(
'property', 'location_tenant' ),
'children' =>
$admin_children_tenant
),
'owner' => array
(
'text' => lang('Owner'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uiactor.index', 'role' => 'owner', 'admin' => true) ),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'owner', 'admin' => true) ),
'children' =>
$admin_children_owner
),
'vendor' => array
(
'text' => lang('Vendor'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uiactor.index', 'role' => 'vendor', 'admin' => true) ),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'vendor', 'admin' => true) ),
'children' =>
$admin_children_vendor
),
'doc_cats' => array
@@ -359,12 +359,12 @@
'building_part' => array
(
'text' => lang('Building
Part'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'building_part') )
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'building_part') )
),
'tender' => array
(
'text' => lang('Tender
chapter'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'tender_chapter') )
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'tender_chapter') )
),
'id_control' => array
(
@@ -384,64 +384,64 @@
'request_status' => array
(
'text' => lang('Request
status'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'request_status') )
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'request_status') )
),
'request_condition' => array
(
'text' => lang('Request
condition_type'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'r_condition_type') )
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'r_condition_type') )
),
'order_dim1' => array
(
'text' =>
lang('order_dim1'),//translation have to refeflect the (local) meaning
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'order_dim1') )
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'order_dim1') )
),
'workorder_status' => array
(
'text' => lang('Workorders
status'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'workorder_status') )
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'workorder_status') )
),
'project_status' => array
(
'text' => lang('project
status'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'project_status') )
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'project_status') )
),
'project_group' => array
(
'text' => lang('project
group'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'project_group') )
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'project_group') )
),
'agreement' => array
(
'text' => lang('Agreement'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'agreement_status') ),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'agreement_status') ),
'image' => array(
'property', 'agreement' ),
'children' =>
$admin_children_agreement
),
'document_status' => array
(
'text' => lang('Document
Status'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'document_status') )
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'document_status') )
),
'unit' => array
(
'text' => lang('Unit'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'unit') )
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'unit') )
),
'key_location' => array
(
'text' => lang('Key location'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'key_location') )
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'key_location') )
),
'branch' => array
(
'text' => lang('Branch'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'branch') )
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'branch') )
),
'accounting' => array
(
'text' => lang('Accounting'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'budget_account') ),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'budget_account') ),
'children' =>
$admin_children_accounting
),
'admin_async' => array
@@ -457,7 +457,7 @@
'event_action' => array
(
'text' => lang('event action'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'event_action') )
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'event_action') )
),
'list_functions' => array
(
@@ -472,7 +472,7 @@
'responsibility_role' => array
(
'text' => lang('responsibility
role'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'responsibility_role') )
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'responsibility_role') )
),
'responsible_matrix' => array
(
@@ -482,7 +482,7 @@
'pending_action_type' => array
(
'text' =>
lang('pending action type'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'pending_action_type') )
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'pending_action_type') )
)
);
}
@@ -614,7 +614,7 @@
(
'order_template' => array
(
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'order_template') ),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'order_template') ),
'text' => lang('order
template'),
'image' =>
array('property', 'helpdesk')
)
@@ -722,16 +722,16 @@
'budget_account' => array
(
'text' => lang('budget
account'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uicategory.index', 'type' => 'budget_account') )
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'budget_account') )
),
'vendor' => array
(
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiactor.index', 'role'=> 'vendor')),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uigeneric.index', 'type'=> 'vendor')),
'text' =>
lang('Vendor')
),
'tenant' => array
(
- 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiactor.index', 'role'=> 'tenant')),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uigeneric.index', 'type'=> 'tenant')),
'text' =>
lang('Tenant')
),
'claim' => array
Deleted: branches/Version-1_0-branch/property/inc/class.soactor.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soactor.inc.php
2010-11-22 13:18:11 UTC (rev 6625)
+++ branches/Version-1_0-branch/property/inc/class.soactor.inc.php
2010-11-22 13:33:58 UTC (rev 6626)
@@ -1,492 +0,0 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software
Foundation, Inc. http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
- * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
- * @package property
- * @subpackage admin
- * @version $Id$
- */
-
- /**
- * Description
- * @package property
- */
-
- class property_soactor
- {
- var $role;
-
- function __construct()
- {
- $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
- $this->bocommon =
CreateObject('property.bocommon');
- $this->custom =
createObject('property.custom_fields');
- $this->db = & $GLOBALS['phpgw']->db;
- $this->join = & $this->db->join;
- $this->left_join = & $this->db->left_join;
- $this->like = & $this->db->like;
- }
-
- function read($data)
- {
- if(is_array($data))
- {
- $start =
isset($data['start'])?$data['start']:0;
- $filter = isset($data['filter']) &&
$data['filter'] ?$data['filter']:'none';
- $query =
isset($data['query'])?$data['query']:'';
- $sort = isset($data['sort']) &&
$data['sort'] ? $data['sort']:'DESC';
- $order =
isset($data['order'])?$data['order']:'';
- $cat_id =
isset($data['cat_id'])?$data['cat_id']:'';
- $allrows =
isset($data['allrows'])?$data['allrows']:'';
- $member_id = isset($data['member_id']) &&
$data['member_id'] ? $data['member_id']:0;
- $dry_run = isset($data['dry_run']) ?
$data['dry_run'] : '';
- }
-
- $sql = $this->bocommon->fm_cache('sql_actor_' .
$this->role);
-
- $entity_table = 'fm_' . $this->role;
- $category_table = 'fm_' . $this->role . '_category';
- $choice_table = 'phpgw_cust_choice';
- $attribute_table = 'phpgw_cust_attribute';
- $location_id =
$GLOBALS['phpgw']->locations->get_id('property', ".{$this->role}");
- $attribute_filter = " location_id = {$location_id}";
-
- if(!$sql)
- {
- $cols_return = array();
- $uicols = array();
- $cols = $entity_table .
".*,$category_table.descr as category";
-
- $cols_return[] = 'id';
- $uicols['input_type'][] = 'text';
- $uicols['name'][] = 'id';
- $uicols['descr'][] =
lang('ID');
- $uicols['statustext'][] = lang('ID');
- $uicols['datatype'][] = false;
- $uicols['attib_id'][] = false;
-
- $cols_return[] = 'id';
- $uicols['input_type'][] = 'hidden';
- $uicols['name'][] = 'id';
- $uicols['descr'][] = false;
- $uicols['statustext'][] = false;
- $uicols['datatype'][] = false;
- $uicols['attib_id'][] = false;
-
- $cols_return[] =
'category';
- $uicols['input_type'][] = 'text';
- $uicols['name'][] =
'category';
- $uicols['descr'][] =
lang('category');
- $uicols['statustext'][] =
lang('category');
- $uicols['datatype'][] = false;
- $uicols['attib_id'][] = false;
-
- $cols_return[] =
'entry_date';
- $uicols['input_type'][] = 'text';
- $uicols['name'][] =
'entry_date';
- $uicols['descr'][] =
lang('entry date');
- $uicols['statustext'][] = lang('entry
date');
- $uicols['datatype'][] = false;
- $uicols['attib_id'][] = false;
-
- $paranthesis .='(';
-
- $joinmethod .= " $this->join " . $entity_table
. "_category ON ( $entity_table" . ".category =" .$entity_table .
"_category.id))";
-
- $from .= " FROM $paranthesis $entity_table ";
-
- $sql = "SELECT $cols $from $joinmethod";
-
- $this->bocommon->fm_cache('sql_actor_' .
$this->role,$sql);
- $this->bocommon->fm_cache('uicols_actor_' .
$this->role,$uicols);
- $this->bocommon->fm_cache('cols_return_actor_'
. $this->role,$cols_return);
-
- }
- else
- {
- $uicols
= $this->bocommon->fm_cache('uicols_actor_'. $this->role);
- $cols_return
= $this->bocommon->fm_cache('cols_return_actor_' . $this->role);
- }
-
-
$user_columns=isset($GLOBALS['phpgw_info']['user']['preferences']['property']['actor_columns_'
.
$this->role])?$GLOBALS['phpgw_info']['user']['preferences']['property']['actor_columns_'
. $this->role]:'';
- $user_column_filter = '';
- if (isset($user_columns) AND is_array($user_columns)
AND $user_columns[0])
- {
- $user_column_filter = " OR ($attribute_filter
AND id IN (" . implode(',',$user_columns) .'))';
- }
-
- $this->db->query("SELECT * FROM $attribute_table WHERE
list=1 AND $attribute_filter $user_column_filter ORDER BY attrib_sort ASC");
-
- while ($this->db->next_record())
- {
- $uicols['input_type'][] = 'text';
- $uicols['name'][] =
$this->db->f('column_name');
- $uicols['descr'][] =
$this->db->f('input_text');
- $uicols['statustext'][] =
$this->db->f('statustext');
- $uicols['datatype'][] =
$this->db->f('datatype');
- $uicols['attib_id'][] =
$this->db->f('id');
- }
-
- $this->uicols = $uicols;
-
- if ($order)
- {
- $ordermethod = " order by $entity_table.$order
$sort";
- }
- else
- {
- $ordermethod = " order by $entity_table.id
DESC";
- }
-
- $where= 'WHERE';
-
- $grants =
$GLOBALS['phpgw']->session->appsession('grants_' . $this->role ,'property');
-
- if(!$grants)
- {
- $this->acl = &
$GLOBALS['phpgw']->acl;
- $grants = $this->acl->get_grants('property','.'
. $this->role);
-
$GLOBALS['phpgw']->session->appsession('grants_' .
$this->role,'property',$grants);
- }
-
- $filtermethod = '';
- if (is_array($grants))
- {
- foreach($grants as $user => $right)
- {
- $public_user_list[] = $user;
- }
- reset($public_user_list);
- $filtermethod .= " $where (
$entity_table.owner_id IN(" . implode(',',$public_user_list) . "))";
- $where= 'AND';
- }
-
- if ($cat_id)
- {
- $filtermethod .= " $where
$entity_table.category='$cat_id' ";
- $where= 'AND';
- }
-
- if ($member_id>0)
- {
- $filtermethod .= " $where
$entity_table.member_of $this->like '%,$member_id,%' ";
- $where= 'AND';
- }
-
-/* if ($status)
- {
- $filtermethod .= " $where
$entity_table.status='$status' ";
- $where= 'AND';
- }
-*/
-
- $querymethod = '';
- $_querymethod = array();
- if($query)
- {
- $query = $this->db->db_addslashes($query);
-
- if(ctype_digit($query))
- {
- $_querymethod[]= "$entity_table.id =" .
(int)$query;
- }
-
- $where= 'AND';
-
- $this->db->query("SELECT * FROM
$attribute_table WHERE $attribute_filter AND search='1'");
-
- while ($this->db->next_record())
- {
- if($this->db->f('datatype')=='V' ||
$this->db->f('datatype')=='email' || $this->db->f('datatype')=='CH'):
- {
- $_querymethod[]=
"$entity_table." . $this->db->f('column_name') . " $this->like '%$query%'";
- }
- elseif($this->db->f('datatype')=='I'):
- {
- if(ctype_digit($query))
- {
- $_querymethod[]=
"$entity_table." . $this->db->f('column_name') . '=' . (int)$query;
- }
- }
- else:
- {
- $_querymethod[]=
"$entity_table." . $this->db->f('column_name') . " = '$query'";
- }
- endif;
- }
-
- if (isset($_querymethod) AND
is_array($_querymethod))
- {
- $querymethod = " $where (" . implode ('
OR ',$_querymethod) . ')';
- }
- }
-
- $sql .= " $filtermethod $querymethod";
-//echo $sql;
- $values = array();
-
- if(!$dry_run)
- {
- $this->db->query('SELECT count(*) as cnt ' .
substr($sql,strripos($sql,'from')),__LINE__,__FILE__);
- $this->db->next_record();
- $this->total_records = $this->db->f('cnt');
- if(!$allrows)
- {
- $this->db->limit_query($sql .
$ordermethod,$start,__LINE__,__FILE__);
- }
- else
- {
- $this->db->query($sql .
$ordermethod,__LINE__,__FILE__);
- }
-
- $cols_return = $uicols['name'];
- $j=0;
-
- $dataset = array();
- while ($this->db->next_record())
- {
- foreach($cols_return as $key => $field)
- {
- $dataset[$j][$field] = array
- (
- 'value' =>
$this->db->f($field),
- 'datatype' =>
$uicols['datatype'][$key],
- 'attrib_id' =>
$uicols['attib_id'][$key]
- );
- }
- $j++;
- }
-
- $values =
$this->custom->translate_value($dataset, $location_id);
-
- return $values;
- }
- return $values;
- }
-
- function read_single($actor_id, $values = array())
- {
- if(is_array($actor_id))
- {
- $actor_id = $actor_id['actor_id'];
- $bt = debug_backtrace();
- echo "<b>wrong call to soactor::" .
$bt[0]['function'] . "<br/>Called from file: " . $bt[0]['file'] . "<br/> line:
" . $bt[0]['line'] . '<br/>args: ' . print_r($bt[0]['args'][0],true) . '</b>';
- unset($bt);
- }
- $table = 'fm_' . $this->role;
-
- $this->db->query("SELECT * from $table where
id='$actor_id'");
-
- if($this->db->next_record())
- {
- $values['id'] =
(int)$this->db->f('id');
- $values['entry_date'] =
$this->db->f('entry_date');
- $values['cat_id'] =
$this->db->f('category');
- $values['member_of'] =
explode(',',$this->db->f('member_of'));
-
- if ( isset($values['attributes']) &&
is_array($values['attributes']) )
- {
- foreach ( $values['attributes'] as
&$attr )
- {
- $attr['value'] =
$this->db->f($attr['column_name']);
- }
- }
- }
- return $values;
- }
-
- function add($actor,$values_attribute='')
- {
- $table = 'fm_' . $this->role;
-
- if($actor['member_of'])
- {
- $actor['member_of']=',' .
implode(',',$actor['member_of']) . ',';
- }
-
- if(isset($actor['extra']) && is_array($actor['extra']))
- {
- foreach ($actor['extra'] as $input_name =>
$value)
- {
- if(isset($value) && $value)
- {
- $cols[] = $input_name;
- $vals[] = $value;
- }
- }
- }
-
- if (isset($values_attribute) AND
is_array($values_attribute))
- {
- foreach($values_attribute as $entry)
- {
- if($entry['value'])
- {
- if($entry['datatype']!='AB' &&
$entry['datatype']!='VENDOR' && $entry['datatype']!='user')
- {
- if($entry['datatype']
== 'C' || $entry['datatype'] == 'T' || $entry['datatype'] == 'V' ||
$entry['datatype'] == 'link')
- {
- $entry['value']
= $this->db->db_addslashes($entry['value']);
- }
-
- if($entry['datatype']
== 'pwd' && $entry['value'] && $entry['value2'])
- {
-
if($entry['value'] == $entry['value2'])
- {
- $cols[]
= $entry['name'];
- $vals[]
= md5($entry['value']);
- }
- else
- {
-
$receipt['error'][]=array('msg'=>lang('Passwords do not match!'));
- }
- }
- else
- {
- $cols[] =
$entry['name'];
- $vals[] =
$entry['value'];
- }
-
- if($entry['history'] ==
1)
- {
-
$history_set[$entry['attrib_id']] = $entry['value'];
- }
- }
- }
- }
- }
-
- if($this->role == 'vendor')
- {
- $cols[] = 'member_of';
- $vals[] = $actor['member_of'];
- }
-
- $cols[] = 'owner_id';
- $vals[] = $this->account;
-
- if($cols)
- {
- $cols = "," . implode(",", $cols);
- $vals = "," .
$this->bocommon->validate_db_insert($vals);
- }
-
- $this->db->transaction_begin();
- if($actor['new_actor_id'])
- {
- $id = $actor['new_actor_id'];
- }
- else
- {
- $id = $this->bocommon->next_id($table);
- }
-
- $this->db->query("INSERT INTO $table
(id,entry_date,category $cols) "
- . "VALUES ($id,'" . time() . "','" .
$actor['cat_id'] . "' $vals)");
-
- $receipt['actor_id']=
$id;//$this->db->get_last_insert_id($table,'id');
-
- $receipt['message'][] = array('msg'=>lang('actor %1 has
been saved',$receipt['actor_id']));
-
- $this->db->transaction_commit();
- return $receipt;
- }
-
- function edit($actor,$values_attribute='')
- {
-//_debug_array($actor);
-//_debug_array($values_attribute);
- $table = 'fm_' . $this->role;
-
- if($actor['member_of'])
- {
- $actor['member_of']=',' .
implode(',',$actor['member_of']) . ',';
- }
-
- if(isset($actor['extra']) && is_array($actor['extra']))
- {
- foreach ($actor['extra'] as $column => $value)
- {
- $value_set[$column] = $value;
- }
- }
-
- if (isset($values_attribute) AND
is_array($values_attribute))
- {
- foreach($values_attribute as $entry)
- {
- if($entry['datatype']!='AB' &&
$entry['datatype']!='VENDOR' && $entry['datatype']!='user')
- {
- if($entry['datatype'] == 'C' ||
$entry['datatype'] == 'T' || $entry['datatype'] == 'V' || $entry['datatype'] ==
'link')
- {
- $entry['value'] =
$this->db->db_addslashes($entry['value']);
- }
- if($entry['datatype'] == 'pwd')
- {
- if($entry['value'] ||
$entry['value2'])
- {
-
if($entry['value'] == $entry['value2'])
- {
-
$value_set[$entry['name']] = md5($entry['value']);
- }
- else
- {
-
$receipt['error'][]=array('msg'=>lang('Passwords do not match!'));
- }
- }
- }
- else
- {
-
$value_set[$entry['name']] = $entry['value'];
- }
- }
- }
- }
-
- $value_set['entry_date'] = time();
- $value_set['category'] = $actor['cat_id'];
-
- if($this->role == 'vendor')
- {
- $value_set['member_of'] = $actor['member_of'];
- }
-
- if($value_set)
- {
- $value_set =
$this->bocommon->validate_db_update($value_set);
- }
-
- $this->db->query("UPDATE $table set $value_set WHERE
id=" . intval($actor['actor_id']));
-
- $receipt['actor_id']= $actor['actor_id'];
- $receipt['message'][] = array('msg'=>lang('actor %1 has
been edited',$actor['actor_id']));
- return $receipt;
- }
-
- function delete($actor_id)
- {
- $table = 'fm_' . $this->role;
- $this->db->query("DELETE FROM $table WHERE id=" .
intval($actor_id));
- }
- }
-
Deleted: branches/Version-1_0-branch/property/inc/class.socategory.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.socategory.inc.php
2010-11-22 13:18:11 UTC (rev 6625)
+++ branches/Version-1_0-branch/property/inc/class.socategory.inc.php
2010-11-22 13:33:58 UTC (rev 6626)
@@ -1,1771 +0,0 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003,2004,2005,2006,2007,2008,2009 Free
Software Foundation, Inc. http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
- * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
- * @package property
- * @subpackage admin
- * @version $Id$
- */
-
- /**
- * Description
- * @package property
- */
-
- class property_socategory
- {
- var $type;
- var $type_id;
- var $location_info = array();
-
- function __construct()
- {
- $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
- $this->custom =
createObject('property.custom_fields');
- $this->_db = & $GLOBALS['phpgw']->db;
- $this->_like = & $this->_db->like;
- $this->_join = & $this->_db->join;
- }
-
- function read($data, $filter)
- {
- $start = isset($data['start']) &&
$data['start'] ? $data['start']:0;
- $query =
isset($data['query'])?$data['query']:'';
- $sort = isset($data['sort']) && $data['sort']
? $data['sort']:'DESC';
- $order =
isset($data['order'])?$data['order']:'';
- $allrows =
isset($data['allrows'])?$data['allrows']:'';
-
- $values = array();
- if (!isset($this->location_info['table']) || !$table =
$this->location_info['table'])
- {
- return $values;
- }
-
-/*
- $valid_order = false;
-
- if($order)
- {
- if($this->location_info['id']['name'] != $order)
- {
-
- foreach ($this->location_info['fields']
as $field)
- {
- if($field['name'] == $order)
- {
- $valid_order = true;
- break;
- }
- }
- }
- else
- {
- $valid_order = true;
- }
-
- if(!$valid_order)
- {
-// $order = '';
- }
- }
-*/
- $_filter_array = array();
- $get_single = array();
- foreach ( $this->location_info['fields'] as $field )
- {
- if (isset($field['filter']) && $field['filter'])
- {
- if(isset($filter[$field['name']]) &&
$filter[$field['name']] && $field['type'] == 'multiple_select')
- {
- $_filter_array[] =
"{$field['name']} {$this->_like} '%,{$filter[$field['name']]},%'";
- }
- else if(isset($filter[$field['name']])
&& $filter[$field['name']])
- {
- $_filter_array[] =
"{$field['name']} = '{$filter[$field['name']]}'";
- }
- }
- if (isset($field['get_single']) &&
$field['get_single'])
- {
- $get_single[$field['name']] =
$field['get_single'];
- }
- }
-
- $uicols = array();
- $uicols['input_type'][] = 'text';
- $uicols['name'][] =
$this->location_info['id']['name'];
- $uicols['descr'][] = lang('id');
- $uicols['datatype'][] =
$this->location_info['id']['type'] == 'varchar' ? 'V' : 'I';
- $uicols['sortable'][] = true;
-
- foreach($this->location_info['fields'] as $field)
- {
- $uicols['input_type'][] =
isset($field['hidden']) && $field['hidden'] ? 'hidden' : 'text';
- $uicols['name'][] =
$field['name'];
- $uicols['descr'][] =
$field['descr'];
- $uicols['datatype'][] = 'V';
- $uicols['sortable'][] =
isset($field['sortable']) && $field['sortable'] ? true : false;
- }
-
-
if($GLOBALS['phpgw']->locations->get_attrib_table('property',
$this->location_info['acl_location']))
- {
- $choice_table = 'phpgw_cust_choice';
- $attribute_table = 'phpgw_cust_attribute';
- $location_id =
$GLOBALS['phpgw']->locations->get_id('property',
$this->location_info['acl_location']);
- $attribute_filter = " location_id =
{$location_id}";
-
- $user_columns =
isset($GLOBALS['phpgw_info']['user']['preferences']['property']["generic_columns_{$this->type}_{$this->type_id}"])?$GLOBALS['phpgw_info']['user']['preferences']['property']["generic_columns_{$this->type}_{$this->type_id}"]:'';
-
- $user_column_filter = '';
- if (isset($user_columns) AND
is_array($user_columns) AND $user_columns[0])
- {
- $user_column_filter = " OR
($attribute_filter AND id IN (" . implode(',',$user_columns) .'))';
- }
-
- $this->_db->query("SELECT * FROM
$attribute_table WHERE list=1 AND $attribute_filter $user_column_filter ORDER
BY attrib_sort ASC");
-
- $i = count($uicols['name']);
- while ($this->_db->next_record())
- {
- $uicols['input_type'][] =
'text';
- $uicols['name'][]
= $this->_db->f('column_name');
- $uicols['descr'][]
= $this->_db->f('input_text');
- $uicols['statustext'][] =
$this->_db->f('statustext');
- $uicols['datatype'][$i] =
$this->_db->f('datatype');
- $uicols['attib_id'][$i] =
$this->_db->f('id');
- $cols_return_extra[]= array(
- 'name' =>
$this->_db->f('column_name'),
- 'datatype' =>
$this->_db->f('datatype'),
- 'attrib_id' =>
$this->_db->f('id')
- );
-
- $i++;
- }
- }
-
- $where = 'WHERE';
- $filtermethod = '';
- if(isset($this->location_info['check_grant']) &&
$this->location_info['check_grant'])
- {
- $filtermethod = "{$where} user_id =
{$this->account} OR public = 1";
- $where = 'AND';
- }
-
- if($_filter_array)
- {
- $filtermethod .= " $where " . implode(' AND ',
$_filter_array);
- $where = 'AND';
- }
-
- $this->uicols = $uicols;
-
- if ($order)
- {
- $ordermethod = " ORDER BY {$table}.{$order}
{$sort}";
- }
- else
- {
- $ordermethod = " ORDER BY
{$table}.{$this->location_info['id']['name']} ASC";
- }
-
- if($query)
- {
- if($this->location_info['id']['type']=='auto'
|| $this->location_info['id']['type']=='int')
- {
- $id_query = (int) $query;
- }
- else
- {
- $id_query = "'{$query}'";
- }
- $query = $this->_db->db_addslashes($query);
- $querymethod = " {$where }
({$table}.{$this->location_info['id']['name']} = {$id_query}";
-//_debug_array($filtermethod);
-//_debug_array($where);die();
-
- foreach($this->location_info['fields'] as
$field)
- {
- if($field['type'] == 'varchar')
- {
- $querymethod .= " OR
{$table}.{$field['name']} $this->_like '%$query%'";
- }
- $where = 'OR';
- }
- $querymethod .= ')';
-
- $_querymethod = array();
-
- $this->_db->query("SELECT * FROM
$attribute_table WHERE $attribute_filter AND search='1'",__LINE__,__FILE__);
-
- while ($this->_db->next_record())
- {
- if($this->_db->f('datatype')=='V' ||
$this->_db->f('datatype')=='email' || $this->_db->f('datatype')=='CH'):
- {
- $_querymethod[]= "$table." .
$this->_db->f('column_name') . " {$this->_like} '%{$query}%'";
- }
- elseif($this->_db->f('datatype')=='I'):
- {
- if(ctype_digit($query))
- {
- $_querymethod[]=
"$table." . $this->_db->f('column_name') . '=' . (int)$query;
- }
- }
- else:
- {
- $_querymethod[]= "$table." .
$this->_db->f('column_name') . " = '$query'";
- }
- endif;
- }
-
- if (isset($_querymethod) AND
is_array($_querymethod))
- {
- $querymethod .= " $where (" . implode
(' OR ',$_querymethod) . ')';
- }
-
- }
-
- $sql = "SELECT * FROM $table $filtermethod
$querymethod";
-
- $this->_db->query('SELECT count(*) as cnt ' .
substr($sql,strripos($sql,'from')),__LINE__,__FILE__);
- $this->_db->next_record();
- $this->total_records = $this->_db->f('cnt');
-
- if(!$allrows)
- {
- $this->_db->limit_query($sql .
$ordermethod,$start,__LINE__,__FILE__);
- }
- else
- {
- $this->_db->query($sql .
$ordermethod,__LINE__,__FILE__);
- }
-
- $cols_return = $uicols['name'];
- $j=0;
-
- $dataset = array();
- while ($this->_db->next_record())
- {
- foreach($cols_return as $key => $field)
- {
- $dataset[$j][$field] = array
- (
- 'value' =>
$this->_db->f($field),
- 'datatype' =>
$uicols['datatype'][$key],
- 'attrib_id' =>
$uicols['attib_id'][$key]
- );
- }
- $j++;
- }
-
- $values = $this->custom->translate_value($dataset,
$location_id);
-
- if($get_single)
- {
- foreach($values as $set => &$entry)
- {
- foreach ($entry as $field => &$value)
- {
- foreach ($get_single as $key =>
$method)
- {
- if($field == $key)
- {
- switch ($method)
- {
- case
'get_user':
-
if($value)
-
{
-
$value = $GLOBALS['phpgw']->accounts->get($value)->__toString();
-
}
-
break;
- default:
- //
nothing
- }
- }
- }
- }
- }
- }
- return $values;
- }
-
-
- function get_location_info($type,$type_id)
- {
- $type_id = (int)$type_id;
- $this->type = $type;
- $this->type_id = $type_id;
-
- $info = array();
- switch($type)
- {
-//-------- ID type integer
- case 'part_of_town':
- $info = array
- (
- 'table'
=> 'fm_part_of_town',
- 'id'
=> array('name' => 'part_of_town_id', 'type' => 'int', 'descr' => lang('id')),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'name',
- 'descr' =>
lang('name'),
- 'type' =>
'varchar',
- 'nullable'
=> false,
- 'size'
=> 20
- ),
- array
- (
- 'name'
=> 'district_id',
- 'descr'
=> lang('district'),
- 'type'
=> 'select',
- 'nullable'
=> false,
- 'filter'
=> true,
- 'values_def'
=> array
- (
-
'valueset' => false,
-
'method' => 'property.bocategory.get_list',
-
'method_input' => array('type' => 'district', 'selected' => '##district_id##')
- )
- ),
- ),
- 'edit_msg'
=> lang('edit'),
- 'add_msg'
=> lang('add'),
- 'name'
=> lang('part of town'),
- 'acl_location' =>
'.admin',
- 'menu_selection' =>
'admin::property::location::town',
-/*
- 'default'
=> array
- (
- 'user_id'
=> array('add' => '$this->account'),
- 'entry_date' =>
array('add' => 'time()'),
- 'modified_date' =>
array('edit' => 'time()'),
- ),
-*/
- 'check_grant' => false
- );
-
- break;
-
- case 'project_group':
- $info = array
- (
- 'table' => 'fm_project_group',
- 'id'
=> array('name' => 'id', 'type' => 'int'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg' => lang('edit'),
- 'add_msg' => lang('add'),
- 'name' => '',
- 'acl_location' => '.admin',
- 'menu_selection' =>
'admin::property::project_group'
- );
- break;
- case 'dimb':
- $info = array
- (
- 'table' => 'fm_ecodimb',
- 'id'
=> array('name' => 'id', 'type' => 'int'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg' => lang('edit'),
- 'add_msg' => lang('add'),
- 'name' => lang('dimb'),
- 'acl_location' => '.admin',
- 'menu_selection' =>
'admin::property::accounting::accounting_dimb'
- );
- break;
- case 'dimd':
- $info = array
- (
- 'table' => 'fm_ecodimd',
- 'id'
=> array('name' => 'id', 'type' => 'int'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg' => lang('edit'),
- 'add_msg' => lang('add'),
- 'name' => lang('dimd'),
- 'acl_location' => '.admin',
- 'menu_selection' =>
'admin::property::accounting::accounting_dimd'
- );
- break;
- case 'tax':
- $info = array
- (
- 'table' => 'fm_ecomva',
- 'id'
=> array('name' => 'id', 'type' => 'int'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg' => lang('edit'),
- 'add_msg' => lang('add'),
- 'name' => '',
- 'acl_location' => '.admin',
- 'menu_selection' =>
'admin::property::accounting::accounting_tax'
- );
- break;
- case 'voucher_cat':
- $info = array
- (
- 'table' =>
'fm_ecobilag_category',
- 'id'
=> array('name' => 'id', 'type' => 'int'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg' => lang('edit'),
- 'add_msg' => lang('add'),
- 'name' => '',
- 'acl_location' => '.admin',
- 'menu_selection' =>
'admin::property::accounting::voucher_cats'
- );
- break;
- case 'voucher_type':
- $info = array
- (
- 'table' => 'fm_ecoart',
- 'id'
=> array('name' => 'id', 'type' => 'int'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg' => lang('edit'),
- 'add_msg' => lang('add'),
- 'name' => '',
- 'acl_location' => '.admin',
- 'menu_selection' =>
'admin::property::accounting::voucher_type'
- );
- break;
- case 'tender_chapter':
- $info = array
- (
- 'table' => 'fm_chapter',
- 'id'
=> array('name' => 'id', 'type' => 'int'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg' => lang('edit'),
- 'add_msg' => lang('add'),
- 'name' => '',
- 'acl_location' => '.admin',
- 'menu_selection' =>
'admin::property::tender'
- );
- break;
- case 'location':
-
- $this->_db->query("SELECT id FROM
fm_location_type WHERE id ={$type_id}",__LINE__,__FILE__);
-
- if($this->_db->next_record())
- {
- $info = array
- (
- 'table' =>
"fm_location{$type_id}_category",
- 'id'
=> array('name' => 'id', 'type' => 'varchar'),
- 'fields'
=> array
- (
- array
- (
- 'name'
=> 'descr',
-
'descr' => lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg' =>
lang('edit'),
- 'add_msg' =>
lang('add'),
- 'name' => '',
- 'acl_location' =>
'.admin',
- 'menu_selection' =>
"admin::property::location::location::category_{$type_id}"
- );
- }
- else
- {
- throw new
Exception(lang('ERROR: illegal type %1', $type_id));
- }
- break;
- case 'owner_cats':
- $info = array
- (
- 'table' => 'fm_owner_category',
- 'id'
=> array('name' => 'id', 'type' => 'int'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg' => lang('edit'),
- 'add_msg' => lang('add'),
- 'name' => '',
- 'acl_location' => '.admin',
- 'menu_selection' =>
'admin::property::owner::owner_cats'
- );
- break;
- case 'tenant_cats':
- $info = array
- (
- 'table' => 'fm_tenant_category',
- 'id'
=> array('name' => 'id', 'type' => 'int'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg' => lang('edit'),
- 'add_msg' => lang('add'),
- 'name' => lang('tenant
category'),
- 'acl_location' => '.admin',
- 'menu_selection' =>
'admin::property::tenant::tenant_cats'
- );
- break;
- case 'vendor_cats':
- $info = array
- (
- 'table' => 'fm_vendor_category',
- 'id'
=> array('name' => 'id', 'type' => 'int'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg' => lang('edit'),
- 'add_msg' => lang('add'),
- 'name' => lang('vendor
category'),
- 'acl_location' => '.admin',
- 'menu_selection' =>
'admin::property::vendor::vendor_cats'
- );
- break;
- case 'vendor':
- $info = array
- (
- 'table'
=> 'fm_vendor',
- 'id'
=> array('name' => 'id', 'type' => 'int'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'contact_phone',
- 'descr' =>
lang('contact phone'),
- 'type' =>
'varchar'
- ),
- array
- (
- 'name'
=> 'category',
- 'descr'
=> lang('category'),
- 'type'
=> 'select',
- 'nullable'
=> false,
- 'filter'
=> true,
- 'sortable'
=> true,
- 'values_def'
=> array
- (
-
'valueset' => false,
-
'method' => 'property.bocategory.get_list',
-
'method_input' => array('type' => 'vendor_cats', 'selected' =>
'##category##')
- )
- ),
- array
- (
- //FIXME
- 'name'
=> 'member_of',
- 'descr'
=> lang('member'),
- 'type'
=> 'multiple_select',
- 'nullable'
=> false,
- 'filter'
=> true,
- 'sortable'
=> false,
- 'hidden'
=> true,
- 'values_def'
=> array
- (
-
'valueset' => false,
-
'method' => 'property.bocommon.get_categories',
-
'method_input' => array('app' => 'property', 'acl_location' => '.vendor',
'selected' => '##member_of##')
- )
- ),
- ),
- 'edit_msg' => lang('edit'),
- 'add_msg' => lang('add'),
- 'name' =>
lang('vendor'),
- 'acl_location' => '.vendor',
- 'menu_selection' =>
'property::invoice::vendor',
- 'default'
=> array
- (
- 'owner_id'
=> array('add' => '$this->account'),
- 'entry_date' =>
array('add' => 'time()'),
- // 'modified_date' =>
array('edit' => 'time()'),
- )
-
- );
- break;
- case 'district':
- $info = array
- (
- 'table' => 'fm_district',
- 'id'
=> array('name' => 'id', 'type' => 'int'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg' => lang('edit'),
- 'add_msg' => lang('add'),
- 'name' =>
lang('district'),
- 'acl_location' => '.admin',
- 'menu_selection' =>
'admin::property::location::district'
- );
- break;
- case 'street':
- $info = array
- (
- 'table' => 'fm_streetaddress',
- 'id'
=> array('name' => 'id', 'type' => 'int'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg' => lang('edit'),
- 'add_msg' => lang('add'),
- 'name' =>
lang('streetaddress'),
- 'acl_location' => '.admin',
- 'menu_selection' =>
'admin::property::location::street'
- );
- break;
- case 's_agreement':
- $info = array
- (
- 'table' =>
'fm_s_agreement_category',
- 'id'
=> array('name' => 'id', 'type' => 'int'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg' => lang('edit'),
- 'add_msg' => lang('add'),
- 'name' => '',
- 'acl_location' => '.admin',
- 'menu_selection' =>
'admin::property::agreement::service_agree_cats'
- );
- break;
- case 'tenant_claim':
- $info = array
- (
- 'table' =>
'fm_tenant_claim_category',
- 'id'
=> array('name' => 'id', 'type' => 'int'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg' => lang('edit'),
- 'add_msg' => lang('add'),
- 'name' => '',
- 'acl_location' => '.admin',
- 'menu_selection' =>
'admin::property::tenant::claims_cats'
- );
- break;
- case 'wo_hours':
- $info = array
- (
- 'table' =>
'fm_wo_hours_category',
- 'id'
=> array('name' => 'id', 'type' => 'int'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg' => lang('edit'),
- 'add_msg' => lang('add'),
- 'name' => '',
- 'acl_location' => '.admin',
- 'menu_selection' =>
'admin::property::workorder_detail'
- );
- break;
- case 'r_condition_type':
- $info = array
- (
- 'table' =>
'fm_request_condition_type',
- 'id'
=> array('name' => 'id', 'type' => 'int'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg' => lang('edit'),
- 'add_msg' => lang('add'),
- 'name' => '',
- 'acl_location' => '.admin',
- 'menu_selection' =>
'admin::property::request_condition'
- );
- break;
- case 'b_account':
- $info = array
- (
- 'table' =>
'fm_b_account_category',
- 'id'
=> array('name' => 'id', 'type' => 'int'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg' => lang('edit'),
- 'add_msg' => lang('add'),
- 'name' => lang('budget
account'),
- 'acl_location' => '.admin',
- 'menu_selection' =>
'admin::property::accounting::accounting_cats'
- );
- break;
-//-------- ID type varchar
- case 'project_status':
- $info = array
- (
- 'table'
=> 'fm_project_status',
- 'id'
=> array('name' => 'id', 'type' => 'varchar'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- ),
- array
- (
- 'name' =>
'approved',
- 'descr' =>
lang('approved'),
- 'type' =>
'checkbox'
- ),
- array
- (
- 'name' =>
'closed',
- 'descr' =>
lang('closed'),
- 'type' =>
'checkbox'
- )
- ),
- 'edit_msg'
=> lang('edit status'),
- 'add_msg'
=> lang('add status'),
- 'name'
=> lang('project status'),
- 'acl_location' =>
'.admin',
- 'menu_selection' =>
'admin::property::project_status'
- );
- break;
- case 'workorder_status':
- $info = array
- (
- 'table'
=> 'fm_workorder_status',
- 'id'
=> array('name' => 'id', 'type' => 'varchar'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- ),
- array
- (
- 'name' =>
'approved',
- 'descr' =>
lang('approved'),
- 'type' =>
'checkbox'
- ),
- array
- (
- 'name' =>
'in_progress',
- 'descr' =>
lang('In progress'),
- 'type' =>
'checkbox'
- ),
- array
- (
- 'name' =>
'delivered',
- 'descr' =>
lang('delivered'),
- 'type' =>
'checkbox'
- ),
- array
- (
- 'name' =>
'closed',
- 'descr' =>
lang('closed'),
- 'type' =>
'checkbox'
- )
- ),
- 'edit_msg'
=> lang('edit status'),
- 'add_msg'
=> lang('add status'),
- 'name'
=> lang('workorder status'),
- 'acl_location' =>
'.admin',
- 'menu_selection' =>
'admin::property::workorder_status'
- );
- break;
- case 'request_status':
- $info = array
- (
- 'table'
=> 'fm_request_status',
- 'id'
=> array('name' => 'id', 'type' => 'varchar'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg'
=> lang('edit status'),
- 'add_msg'
=> lang('add status'),
- 'name'
=> lang('request status'),
- 'acl_location' =>
'.admin',
- 'menu_selection' =>
'admin::property::request_status'
- );
- break;
- case 'agreement_status':
- $info = array
- (
- 'table'
=> 'fm_agreement_status',
- 'id'
=> array('name' => 'id', 'type' => 'varchar'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg'
=> lang('edit status'),
- 'add_msg'
=> lang('add status'),
- 'name'
=> lang('agreement status'),
- 'acl_location' =>
'.admin',
- 'menu_selection' =>
'admin::property::agreement::agreement_status'
- );
- break;
- case 'building_part':
- $info = array
- (
- 'table'
=> 'fm_building_part',
- 'id'
=> array('name' => 'id', 'type' => 'varchar'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg'
=> lang('edit'),
- 'add_msg'
=> lang('add'),
- 'name'
=> lang('building part'),
- 'acl_location' =>
'.admin',
- 'menu_selection' =>
'admin::property::building_part'
- );
- break;
- case 'document_status':
- $info = array
- (
- 'table'
=> 'fm_document_status',
- 'id'
=> array('name' => 'id', 'type' => 'varchar'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg'
=> lang('edit status'),
- 'add_msg'
=> lang('add status'),
- 'name'
=> lang('document status'),
- 'acl_location' =>
'.admin',
- 'menu_selection' =>
'admin::property::document_status'
- );
- break;
- case 'unit':
- $info = array
- (
- 'table'
=> 'fm_standard_unit',
- 'id'
=> array('name' => 'id', 'type' => 'varchar'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg'
=> lang('edit unit'),
- 'add_msg'
=> lang('add unit'),
- 'name'
=> lang('unit'),
- 'acl_location' =>
'.admin',
- 'menu_selection' =>
'admin::property::unit'
- );
- break;
- case 'budget_account':
- $info = array
- (
- 'table'
=> 'fm_b_account',
- 'id'
=> array('name' => 'id', 'type' => 'varchar'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar',
- 'nullable'
=> false,
- 'size'
=> 60,
- 'sortable'
=> true
- ),
- array
- (
- 'name'
=> 'category',
- 'descr'
=> lang('category'),
- 'type'
=> 'select',
- 'nullable'
=> false,
- 'filter'
=> true,
- 'sortable'
=> true,
- 'values_def'
=> array
- (
-
'valueset' => false,
-
'method' => 'property.bocategory.get_list',
-
'method_input' => array('type' => 'b_account', 'selected' =>
'##category##')//b_account_category
- )
- ),
- array
- (
- 'name'
=> 'mva',
- 'descr'
=> lang('tax code'),
- 'type'
=> 'int',
- 'nullable'
=> true,
- 'size'
=> 4,
- 'sortable'
=> true
- ),
- array
- (
- 'name'
=> 'responsible',
- 'descr'
=> lang('responsible'),
- 'type'
=> 'select',
- 'filter'
=> true,
- 'get_single'
=> 'get_user',
- 'values_def'
=> array
- (
-
'valueset' => false,
-
'method' => 'property.bocommon.get_user_list_right2',
-
'method_input' => array('selected' => '##responsible##', 'right' => 128,
'acl_location' => '.invoice')
- )
- ),
- array
- (
- 'name' =>
'active',
- 'descr' =>
lang('active'),
- 'type' =>
'checkbox',
- 'default' =>
'checked'
- ),
- ),
- 'edit_msg'
=> lang('edit'),
- 'add_msg'
=> lang('add'),
- 'name'
=> lang('budget account'),
- 'acl_location' =>
'.b_account',
- 'menu_selection' =>
'property::invoice::budget_account',
- 'default'
=> array
- (
- 'user_id'
=> array('add' => '$this->account'),
- 'entry_date' =>
array('add' => 'time()'),
- 'modified_date' =>
array('edit' => 'time()'),
- ),
- 'check_grant' => false
- );
-
- break;
-
-//-------- ID type auto
- case 'order_dim1':
- $info = array
- (
- 'table'
=> 'fm_order_dim1',
- 'id'
=> array('name' => 'id', 'type' => 'auto'),
- 'fields'
=> array
- (
- array
- (
- 'name' => 'num',
- 'descr' =>
lang('name'),
- 'type' =>
'varchar'
- ),
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar',
- 'nullable' =>
false
- ),
- ),
- 'edit_msg'
=> lang('edit'),
- 'add_msg'
=> lang('add'),
- 'name'
=> lang('order_dim1'),
- 'acl_location' =>
'.admin',
- 'menu_selection' =>
'admin::property::order_dim1'
- );
- break;
- case 'branch':
- $info = array
- (
- 'table'
=> 'fm_branch',
- 'id'
=> array('name' => 'id', 'type' => 'auto'),
- 'fields'
=> array
- (
- array
- (
- 'name' => 'num',
- 'descr' =>
lang('name'),
- 'type' =>
'varchar'
- ),
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' =>
'varchar'
- )
- ),
- 'edit_msg'
=> lang('edit'),
- 'add_msg'
=> lang('add'),
- 'name'
=> lang('branch'),
- 'acl_location' =>
'.admin',
- 'menu_selection' =>
'admin::property::branch'
- );
-
- break;
- case 'key_location':
- $info = array
- (
- 'table'
=> 'fm_key_loc',
- 'id'
=> array('name' => 'id', 'type' => 'auto'),
- 'fields'
=> array
- (
- array
- (
- 'name' => 'num',
- 'descr' =>
lang('name'),
- 'type' =>
'varchar'
- ),
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('key location'),
- 'type' => 'text'
- )
- ),
- 'edit_msg'
=> lang('edit'),
- 'add_msg'
=> lang('add'),
- 'name'
=> lang('branch'),
- 'acl_location' =>
'.admin',
- 'menu_selection' =>
'admin::property::key_location'
- );
-
- break;
-
- case 'async':
- $info = array
- (
- 'table'
=> 'fm_async_method',
- 'id'
=> array('name' => 'id', 'type' => 'auto'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'name',
- 'descr' =>
lang('name'),
- 'type' =>
'varchar'
- ),
- array
- (
- 'name' =>
'data',
- 'descr' =>
lang('data'),
- 'type' => 'text'
- ),
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' => 'text'
- )
- ),
- 'edit_msg'
=> lang('edit'),
- 'add_msg'
=> lang('add'),
- 'name'
=> lang('Async services'),
- 'acl_location' =>
'.admin',
- 'menu_selection' =>
'admin::property::async'
- );
- break;
-
- case 'event_action':
-
- $info = array
- (
- 'table'
=> 'fm_event_action',
- 'id'
=> array('name' => 'id', 'type' => 'auto'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'name',
- 'descr' =>
lang('name'),
- 'type' =>
'varchar'
- ),
- array
- (
- 'name' =>
'action',
- 'descr' =>
lang('action'),
- 'type' =>
'varchar'
- ),
- array
- (
- 'name' =>
'data',
- 'descr' =>
lang('data'),
- 'type' => 'text'
- ),
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' => 'text'
- )
- ),
- 'edit_msg'
=> lang('edit'),
- 'add_msg'
=> lang('add'),
- 'name'
=> lang('event action'),
- 'acl_location' =>
'.admin',
- 'menu_selection' =>
'admin::property::event_action',
- 'default'
=> array
- (
- 'user_id'
=> array('add' => '$this->account'),
- 'entry_date' =>
array('add' => 'time()'),
- 'modified_date' =>
array('edit' => 'time()'),
- )
- );
-
- break;
-
- case 'ticket_status':
-
- $info = array
- (
- 'table'
=> 'fm_tts_status',
- 'id'
=> array('name' => 'id', 'type' => 'auto'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'name',
- 'descr' =>
lang('name'),
- 'type' =>
'varchar'
- ),
- array
- (
- 'name' =>
'sorting',
- 'descr' =>
lang('sorting'),
- 'type' =>
'integer',
- 'sortable'=>
true
- ),
- array
- (
- 'name' =>
'color',
- 'descr' =>
lang('color'),
- 'type' =>
'varchar'
- ),
- array
- (
- 'name' =>
'approved',
- 'descr' =>
lang('approved'),
- 'type' =>
'checkbox'
- ),
- array
- (
- 'name' =>
'in_progress',
- 'descr' =>
lang('In progress'),
- 'type' =>
'checkbox'
- ),
- array
- (
- 'name' =>
'delivered',
- 'descr' =>
lang('delivered'),
- 'type' =>
'checkbox'
- ),
- array
- (
- 'name' =>
'closed',
- 'descr' =>
lang('closed'),
- 'type' =>
'checkbox'
- )
- ),
- 'edit_msg'
=> lang('edit'),
- 'add_msg'
=> lang('add'),
- 'name'
=> lang('event action'),
- 'acl_location' =>
'.admin',
- 'menu_selection' =>
'admin::property::ticket_status'
- );
- break;
- case 'pending_action_type':
- $info = array
- (
- 'table'
=> 'fm_action_pending_category',
- 'id'
=> array('name' => 'num', 'type' => 'varchar'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'name',
- 'descr' =>
lang('name'),
- 'type' =>
'varchar'
- ),
- array
- (
- 'name' =>
'descr',
- 'descr' =>
lang('descr'),
- 'type' => 'text'
- )
- ),
- 'edit_msg'
=> lang('edit'),
- 'add_msg'
=> lang('add'),
- 'name'
=> lang('Pending action type'),
- 'acl_location' =>
'.admin',
- 'menu_selection' =>
'admin::property::action_type'
- );
-
- break;
-
- case 'order_template':
-
- $info = array
- (
- 'table'
=> 'fm_order_template',
- 'id'
=> array('name' => 'id', 'type' => 'auto'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'name',
- 'descr' =>
lang('name'),
- 'type' =>
'varchar'
- ),
- array
- (
- 'name' =>
'content',
- 'descr' =>
lang('content'),
- 'type' => 'text'
- ),
- array
- (
- 'name' =>
'public',
- 'descr' =>
lang('public'),
- 'type' =>
'checkbox'
- )
- ),
- 'edit_msg'
=> lang('edit'),
- 'add_msg'
=> lang('add'),
- 'name'
=> lang('order template'),
- 'acl_location' =>
'.ticket.order',
- 'menu_selection' =>
'property::helpdesk::order_template',
- 'default'
=> array
- (
- 'user_id'
=> array('add' => '$this->account'),
- 'entry_date' =>
array('add' => 'time()'),
- 'modified_date' =>
array('edit' => 'time()'),
- ),
- 'check_grant' => true
- );
-
- break;
-
- case 'responsibility_role':
-
- $info = array
- (
- 'table'
=> 'fm_responsibility_role',
- 'id'
=> array('name' => 'id', 'type' => 'auto'),
- 'fields'
=> array
- (
- array
- (
- 'name' =>
'name',
- 'descr' =>
lang('name'),
- 'type' =>
'varchar'
- ),
- array
- (
- 'name' =>
'remark',
- 'descr' =>
lang('remark'),
- 'type' => 'text'
- ),
- array
- (
- 'name'
=> 'location',
- 'descr'
=> lang('location'),
- 'type'
=> 'select',
- 'values_def'
=> array
- (
-
'valueset' => false,
-
'method' => 'preferences.boadmin_acl.get_locations',
-
'method_input' => array('acl_app' => 'property', 'selected' =>
'##location##')
- )
- ),
- array
- (
- 'name'
=> 'responsibility_id',
- 'descr'
=> lang('responsibility'),
- 'type'
=> 'select',
- 'values_def'
=> array
- (
-
'valueset' => false,
-
'method' => 'property.boresponsible.get_responsibilities',
-
'method_input' => array('acl_app' => 'property', 'selected' =>
'##responsibility_id##')
- )
- )
- ),
- 'edit_msg'
=> lang('edit'),
- 'add_msg'
=> lang('add'),
- 'name'
=> lang('responsibility role'),
- 'acl_location' =>
'.admin',
- 'menu_selection' =>
'admin::property::responsibility_role',
- 'default'
=> array
- (
- 'user_id'
=> array('add' => '$this->account'),
- 'entry_date' =>
array('add' => 'time()'),
- 'modified_date' =>
array('edit' => 'time()'),
- ),
- 'check_grant' => false
- );
-
- break;
-
- default:
- $receipt = array();
-
$receipt['error'][]=array('msg'=>lang('ERROR: illegal type %1', $type));
- phpgwapi_cache::session_set('phpgwapi',
'phpgw_messages', $receipt);
- // throw new Exception(lang('ERROR:
illegal type %1', $type));
- }
-
- $this->location_info = $info;
- return $info;
- }
-
- function read_single($data,$values = array())
- {
- if (!isset($this->location_info['table']) || !$table =
$this->location_info['table'])
- {
- return $values;
- }
-
- if($this->location_info['id']['type']=='auto' ||
$this->location_info['id']['type']=='int')
- {
- $id = (int) $data['id'];
- }
- else
- {
- $id = "'{$data['id']}'";
- }
-
- $sql = "SELECT * FROM $table WHERE
{$this->location_info['id']['name']} = {$id}";
-
- $this->_db->query($sql,__LINE__,__FILE__);
-
- if ($this->_db->next_record())
- {
- $values['id'] =
$this->_db->f($this->location_info['id']['name']);
-
- // FIXME - add field to $values['attributes']
- foreach($this->location_info['fields'] as
$field)
- {
- $values[$field['name']] =
$this->_db->f($field['name'], true);
- }
-
- if ( isset($values['attributes']) &&
is_array($values['attributes']) )
- {
- foreach ( $values['attributes'] as
&$attr )
- {
- $attr['value'] =
$this->_db->f($attr['column_name']);
- }
- }
- }
- return $values;
- }
-
-
- //deprecated
- function select_category_list($data)
- {
- return $this->get_entity_list($data);
- }
-
- function get_list($data)
- {
- $values = array();
-
- $this->get_location_info($data['type'],
$data['type_id']);
-
- if (!isset($this->location_info['table']) || !$table =
$this->location_info['table'])
- {
- return $values;
- }
-
- $filtermthod = '';
- if (isset($data['filter']) && is_array($data['filter']))
- {
- $_filter = array();
- foreach ($data['filter'] as $_field => $_value)
- {
- $_filter[] = "{$_field} = '{$_value}'";
- }
- if($_filter)
- {
- $filtermthod = 'WHERE ' . implode(' AND
', $_filter);
- }
- }
- $order = isset($data['order']) &&
$data['order'] ? $data['order'] :'descr';
-
- foreach ($this->location_info['fields'] as $field)
- {
- $fields[] = $field['name'];
- }
-
- // Add extra info to name
- if(isset($data['id_in_name']) && $data['id_in_name'])
- {
- $id_in_name = 'id';
- if (in_array($data['id_in_name'], $fields))
- {
- $id_in_name = $data['id_in_name'];
- }
- }
-
- $fields = implode(',', $fields);
-
- $this->_db->query("SELECT id, {$fields} FROM {$table}
{$filtermthod} ORDER BY {$order}");
-
- while ($this->_db->next_record())
- {
- $_extra = $this->_db->f($id_in_name);
- $id = $this->_db->f('id');
- if(!$name = $this->_db->f('name', true))
- {
- $name = $this->_db->f('descr', true);
- }
-
- if($_extra)
- {
- $name = "{$_extra} - {$name}";
- }
-
- $values[] = array
- (
- 'id' => $id,
- 'name' => $name
- );
- }
- return $values;
- }
-
- function add($data,$values_attribute)
- {
- $receipt = array();
-
- if (!isset($this->location_info['table']) || !$table =
$this->location_info['table'])
- {
- $receipt['error'][] = array('msg' => lang('not
a valid type'));
- return $receipt;
- }
-
- if(isset($data['save']))
- {
- unset($data['save']);
- }
- if(isset($data['apply']))
- {
- unset($data['apply']);
- }
-
- foreach ( $this->location_info['fields'] as $field )
- {
- if (isset($field['filter']) && $field['filter'])
- {
- if(isset($data[$field['name']]) &&
$data[$field['name']] && $field['type'] == 'multiple_select')
- {
- $data[$field['name']] = ',' .
implode(',',$data[$field['name']]) . ',';
- }
- }
- }
-
- $cols = array();
- $vals = array();
-
- $data['descr'] =
$this->_db->db_addslashes($data['descr']);
-
- if(isset($data['extra']))
- {
- foreach ($data['extra'] as $input_name =>
$value)
- {
- if(isset($value) && $value)
- {
- $cols[] = $input_name;
- $vals[] = $value;
- }
- }
- }
- unset($data['extra']);
-
- foreach ($data as $input_name => $value)
- {
- if(isset($value) && $value)
- {
- $cols[] = $input_name;
- $vals[] =
$this->_db->db_addslashes($value);
- }
- }
-
- $data_attribute = $this->custom->prepare_for_db($table,
$values_attribute);
- if(isset($data_attribute['value_set']))
- {
- foreach($data_attribute['value_set'] as
$input_name => $value)
- {
- if(isset($value) && $value)
- {
- $cols[] = $input_name;
- $vals[] = $value;
- }
- }
- }
-
-
- if(isset($this->location_info['default']) &&
is_array($this->location_info['default']))
- {
- foreach ($this->location_info['default'] as
$field => $default)
- {
- if(isset($default['add']))
- {
- $cols[] = $field;
- eval('$vals[] = ' .
$default['add'] .';');
- }
- }
- }
-
- $this->_db->transaction_begin();
-
- if($this->location_info['id']['type']!='auto')
- {
- $this->_db->query("SELECT id FROM {$table}
WHERE {$this->location_info['id']['name']} =
'{$data['id']}'",__LINE__,__FILE__);
- if($this->_db->next_record())
- {
-
$receipt['error'][]=array('msg'=>lang('duplicate key value'));
-
$receipt['error'][]=array('msg'=>lang('record has not been saved'));
- return $receipt;
- }
- $id = $data['id'];
- }
- else
- {
- $id = $this->_db->next_id($table);
- $cols[] = 'id';
- $vals[] = $id;
- }
-
- $cols = implode(",", $cols);
- $vals = $this->_db->validate_insert($vals);
-
- $this->_db->query("INSERT INTO {$table} ({$cols})
VALUES ({$vals})",__LINE__,__FILE__);
-
-/* if($this->location_info['id']['type']=='auto')
- {
- if(!$data['id'] =
$this->_db->get_last_insert_id($table, 'id'))
- {
- $this->_db->transaction_abort();
-
$receipt['error'][]=array('msg'=>lang('record has not been saved'));
- }
- }
-*/
- $this->_db->transaction_commit();
- $receipt['id'] = $id;
- $receipt['message'][]=array('msg'=>lang('record has
been saved'));
- return $receipt;
- }
-
- function edit($data,$values_attribute)
- {
- $receipt = array();
-
- if (!isset($this->location_info['table']) || !$table =
$this->location_info['table'])
- {
- $receipt['error'][] = array('msg' => lang('not
a valid type'));
- return $receipt;
- }
-
- $value_set = array();
-
- if(isset($data['extra']))
- {
- foreach ($data['extra'] as $input_name =>
$value)
- {
- $value_set[$input_name] = $value;
- }
- unset($data['extra']);
- }
-
- $data_attribute = $this->custom->prepare_for_db($table,
$values_attribute, $data['id']);
-
- if(isset($data_attribute['value_set']))
- {
- $value_set = array_merge($value_set,
$data_attribute['value_set']);
- }
- foreach($this->location_info['fields'] as $field)
- {
- if (isset($field['filter']) && $field['filter'])
- {
- if(isset($data[$field['name']]) &&
$data[$field['name']] && $field['type'] == 'multiple_select')
- {
- $data[$field['name']] = ',' .
implode(',',$data[$field['name']]) . ',';
- }
- }
-
- $value_set[$field['name']] =
$this->_db->db_addslashes($data[$field['name']]);
- }
-
- if(isset($this->location_info['default']) &&
is_array($this->location_info['default']))
- {
- foreach ($this->location_info['default'] as
$field => $default)
- {
- if(isset($default['edit']))
- {
- eval('$value_set[$field] = ' .
$default['edit'] .';');
- }
- }
- }
-
- $value_set =
$this->_db->validate_update($value_set);
- $this->_db->transaction_begin();
- $this->_db->query("UPDATE $table SET {$value_set} WHERE
{$this->location_info['id']['name']}='" . $data['id']. "'",__LINE__,__FILE__);
-
-/* //FIXME
- if (isset($data_attribute['history_set']) &&
is_array($data_attribute['history_set']))
- {
- $historylog =
CreateObject('phpgwapi.historylog','property',
$this->location_info['acl_location']);
- foreach ($data_attribute['history_set'] as
$attrib_id => $history)
- {
-
$historylog->add('SO',$data['id'],$history['value'],false,
$attrib_id,$history['date']);
- }
- }
-*/
- $this->_db->transaction_commit();
-
- $receipt['id'] = $data['id'];
-
- $receipt['message'][]=array('msg'=>lang('record has
been edited'));
- return $receipt;
- }
-
- function delete($id)
- {
- if (!isset($this->location_info['table']) || !$table =
$this->location_info['table'])
- {
- return false;
- }
- $this->_db->query("DELETE FROM $table WHERE
{$this->location_info['id']['name']}='{$id}'",__LINE__,__FILE__);
- }
- }
-
Copied: branches/Version-1_0-branch/property/inc/class.sogeneric.inc.php (from
rev 6625, trunk/property/inc/class.sogeneric.inc.php)
===================================================================
--- branches/Version-1_0-branch/property/inc/class.sogeneric.inc.php
(rev 0)
+++ branches/Version-1_0-branch/property/inc/class.sogeneric.inc.php
2010-11-22 13:33:58 UTC (rev 6626)
@@ -0,0 +1,1858 @@
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003,2004,2005,2006,2007,2008,2009 Free
Software Foundation, Inc. http://www.fsf.org/
+ * This file is part of phpGroupWare.
+ *
+ * phpGroupWare is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * phpGroupWare is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with phpGroupWare; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
+ *
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
+ * @package property
+ * @subpackage admin
+ * @version $Id$
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class property_sogeneric
+ {
+ var $type;
+ var $type_id;
+ var $location_info = array();
+
+ function __construct()
+ {
+ $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
+ $this->custom =
createObject('property.custom_fields');
+ $this->_db = & $GLOBALS['phpgw']->db;
+ $this->_like = & $this->_db->like;
+ $this->_join = & $this->_db->join;
+ }
+
+ function read($data, $filter)
+ {
+ $start = isset($data['start']) &&
$data['start'] ? $data['start']:0;
+ $query =
isset($data['query'])?$data['query']:'';
+ $sort = isset($data['sort']) && $data['sort']
? $data['sort']:'DESC';
+ $order =
isset($data['order'])?$data['order']:'';
+ $allrows =
isset($data['allrows'])?$data['allrows']:'';
+
+ $values = array();
+ if (!isset($this->location_info['table']) || !$table =
$this->location_info['table'])
+ {
+ return $values;
+ }
+
+/*
+ $valid_order = false;
+
+ if($order)
+ {
+ if($this->location_info['id']['name'] != $order)
+ {
+
+ foreach ($this->location_info['fields']
as $field)
+ {
+ if($field['name'] == $order)
+ {
+ $valid_order = true;
+ break;
+ }
+ }
+ }
+ else
+ {
+ $valid_order = true;
+ }
+
+ if(!$valid_order)
+ {
+// $order = '';
+ }
+ }
+*/
+ $_filter_array = array();
+ $get_single = array();
+ foreach ( $this->location_info['fields'] as $field )
+ {
+ if (isset($field['filter']) && $field['filter'])
+ {
+ if(isset($filter[$field['name']]) &&
$filter[$field['name']] && $field['type'] == 'multiple_select')
+ {
+ $_filter_array[] =
"{$field['name']} {$this->_like} '%,{$filter[$field['name']]},%'";
+ }
+ else if(isset($filter[$field['name']])
&& $filter[$field['name']])
+ {
+ $_filter_array[] =
"{$field['name']} = '{$filter[$field['name']]}'";
+ }
+ }
+ if (isset($field['get_single']) &&
$field['get_single'])
+ {
+ $get_single[$field['name']] =
$field['get_single'];
+ }
+ }
+
+ $uicols = array();
+ $uicols['input_type'][] = 'text';
+ $uicols['name'][] =
$this->location_info['id']['name'];
+ $uicols['descr'][] = lang('id');
+ $uicols['datatype'][] =
$this->location_info['id']['type'] == 'varchar' ? 'V' : 'I';
+ $uicols['sortable'][] = true;
+
+ foreach($this->location_info['fields'] as $field)
+ {
+ $uicols['input_type'][] =
isset($field['hidden']) && $field['hidden'] ? 'hidden' : 'text';
+ $uicols['name'][] =
$field['name'];
+ $uicols['descr'][] =
$field['descr'];
+ $uicols['datatype'][] = 'V';
+ $uicols['sortable'][] =
isset($field['sortable']) && $field['sortable'] ? true : false;
+ }
+
+
if($GLOBALS['phpgw']->locations->get_attrib_table('property',
$this->location_info['acl_location']))
+ {
+ $choice_table = 'phpgw_cust_choice';
+ $attribute_table = 'phpgw_cust_attribute';
+ $location_id =
$GLOBALS['phpgw']->locations->get_id('property',
$this->location_info['acl_location']);
+ $attribute_filter = " location_id =
{$location_id}";
+
+ $user_columns =
isset($GLOBALS['phpgw_info']['user']['preferences']['property']["generic_columns_{$this->type}_{$this->type_id}"])?$GLOBALS['phpgw_info']['user']['preferences']['property']["generic_columns_{$this->type}_{$this->type_id}"]:'';
+
+ $user_column_filter = '';
+ if (isset($user_columns) AND
is_array($user_columns) AND $user_columns[0])
+ {
+ $user_column_filter = " OR
($attribute_filter AND id IN (" . implode(',',$user_columns) .'))';
+ }
+
+ $this->_db->query("SELECT * FROM
$attribute_table WHERE list=1 AND $attribute_filter $user_column_filter ORDER
BY attrib_sort ASC");
+
+ $i = count($uicols['name']);
+ while ($this->_db->next_record())
+ {
+ $uicols['input_type'][] =
'text';
+ $uicols['name'][]
= $this->_db->f('column_name');
+ $uicols['descr'][]
= $this->_db->f('input_text');
+ $uicols['statustext'][] =
$this->_db->f('statustext');
+ $uicols['datatype'][$i] =
$this->_db->f('datatype');
+ $uicols['attib_id'][$i] =
$this->_db->f('id');
+ $cols_return_extra[]= array(
+ 'name' =>
$this->_db->f('column_name'),
+ 'datatype' =>
$this->_db->f('datatype'),
+ 'attrib_id' =>
$this->_db->f('id')
+ );
+
+ $i++;
+ }
+ }
+
+ $where = 'WHERE';
+ $filtermethod = '';
+ if(isset($this->location_info['check_grant']) &&
$this->location_info['check_grant'])
+ {
+ $filtermethod = "{$where} user_id =
{$this->account} OR public = 1";
+ $where = 'AND';
+ }
+
+ if($_filter_array)
+ {
+ $filtermethod .= " $where " . implode(' AND ',
$_filter_array);
+ $where = 'AND';
+ }
+
+ $this->uicols = $uicols;
+
+ if ($order)
+ {
+ $ordermethod = " ORDER BY {$table}.{$order}
{$sort}";
+ }
+ else
+ {
+ $ordermethod = " ORDER BY
{$table}.{$this->location_info['id']['name']} ASC";
+ }
+
+ if($query)
+ {
+ if($this->location_info['id']['type']=='auto'
|| $this->location_info['id']['type']=='int')
+ {
+ $id_query = (int) $query;
+ }
+ else
+ {
+ $id_query = "'{$query}'";
+ }
+ $query = $this->_db->db_addslashes($query);
+ $querymethod = " {$where }
({$table}.{$this->location_info['id']['name']} = {$id_query}";
+//_debug_array($filtermethod);
+//_debug_array($where);die();
+
+ foreach($this->location_info['fields'] as
$field)
+ {
+ if($field['type'] == 'varchar')
+ {
+ $querymethod .= " OR
{$table}.{$field['name']} $this->_like '%$query%'";
+ }
+ $where = 'OR';
+ }
+ $querymethod .= ')';
+
+ $_querymethod = array();
+
+ $this->_db->query("SELECT * FROM
$attribute_table WHERE $attribute_filter AND search='1'",__LINE__,__FILE__);
+
+ while ($this->_db->next_record())
+ {
+ if($this->_db->f('datatype')=='V' ||
$this->_db->f('datatype')=='email' || $this->_db->f('datatype')=='CH'):
+ {
+ $_querymethod[]= "$table." .
$this->_db->f('column_name') . " {$this->_like} '%{$query}%'";
+ }
+ elseif($this->_db->f('datatype')=='I'):
+ {
+ if(ctype_digit($query))
+ {
+ $_querymethod[]=
"$table." . $this->_db->f('column_name') . '=' . (int)$query;
+ }
+ }
+ else:
+ {
+ $_querymethod[]= "$table." .
$this->_db->f('column_name') . " = '$query'";
+ }
+ endif;
+ }
+
+ if (isset($_querymethod) AND
is_array($_querymethod))
+ {
+ $querymethod .= " $where (" . implode
(' OR ',$_querymethod) . ')';
+ }
+
+ }
+
+ $sql = "SELECT * FROM $table $filtermethod
$querymethod";
+
+ $this->_db->query('SELECT count(*) as cnt ' .
substr($sql,strripos($sql,'from')),__LINE__,__FILE__);
+ $this->_db->next_record();
+ $this->total_records = $this->_db->f('cnt');
+
+ if(!$allrows)
+ {
+ $this->_db->limit_query($sql .
$ordermethod,$start,__LINE__,__FILE__);
+ }
+ else
+ {
+ $this->_db->query($sql .
$ordermethod,__LINE__,__FILE__);
+ }
+
+ $cols_return = $uicols['name'];
+ $j=0;
+
+ $dataset = array();
+ while ($this->_db->next_record())
+ {
+ foreach($cols_return as $key => $field)
+ {
+ $dataset[$j][$field] = array
+ (
+ 'value' =>
$this->_db->f($field),
+ 'datatype' =>
$uicols['datatype'][$key],
+ 'attrib_id' =>
$uicols['attib_id'][$key]
+ );
+ }
+ $j++;
+ }
+
+ $values = $this->custom->translate_value($dataset,
$location_id);
+
+ if($get_single)
+ {
+ foreach($values as $set => &$entry)
+ {
+ foreach ($entry as $field => &$value)
+ {
+ foreach ($get_single as $key =>
$method)
+ {
+ if($field == $key)
+ {
+ switch ($method)
+ {
+ case
'get_user':
+
if($value)
+
{
+
$value = $GLOBALS['phpgw']->accounts->get($value)->__toString();
+
}
+
break;
+ default:
+ //
nothing
+ }
+ }
+ }
+ }
+ }
+ }
+ return $values;
+ }
+
+
+ function get_location_info($type,$type_id)
+ {
+ $type_id = (int)$type_id;
+ $this->type = $type;
+ $this->type_id = $type_id;
+
+ $info = array();
+ switch($type)
+ {
+//-------- ID type integer
+ case 'part_of_town':
+ $info = array
+ (
+ 'table'
=> 'fm_part_of_town',
+ 'id'
=> array('name' => 'part_of_town_id', 'type' => 'int', 'descr' => lang('id')),
+ 'fields'
=> array
+ (
+ array
+ (
+ 'name' =>
'name',
+ 'descr' =>
lang('name'),
+ 'type' =>
'varchar',
+ 'nullable'
=> false,
+ 'size'
=> 20
+ ),
+ array
+ (
+ 'name'
=> 'district_id',
+ 'descr'
=> lang('district'),
+ 'type'
=> 'select',
+ 'nullable'
=> false,
+ 'filter'
=> true,
+ 'values_def'
=> array
+ (
+
'valueset' => false,
+
'method' => 'property.bogeneric.get_list',
+
'method_input' => array('type' => 'district', 'selected' => '##district_id##')
+ )
+ ),
+ ),
+ 'edit_msg'
=> lang('edit'),
+ 'add_msg'
=> lang('add'),
+ 'name'
=> lang('part of town'),
+ 'acl_location' =>
'.admin',
+ 'menu_selection' =>
'admin::property::location::town',
+/*
+ 'default'
=> array
+ (
+ 'user_id'
=> array('add' => '$this->account'),
+ 'entry_date' =>
array('add' => 'time()'),
+ 'modified_date' =>
array('edit' => 'time()'),
+ ),
+*/
+ 'check_grant' => false
+ );
+
+ break;
+
+ case 'project_group':
+ $info = array
+ (
+ 'table' => 'fm_project_group',
+ 'id'
=> array('name' => 'id', 'type' => 'int'),
+ 'fields'
=> array
+ (
+ array
+ (
+ 'name' =>
'descr',
+ 'descr' =>
lang('descr'),
+ 'type' =>
'varchar'
+ )
+ ),
+ 'edit_msg' => lang('edit'),
+ 'add_msg' => lang('add'),
+ 'name' => '',
+ 'acl_location' => '.admin',
+ 'menu_selection' =>
'admin::property::project_group'
+ );
+ break;
+ case 'dimb':
+ $info = array
+ (
+ 'table' => 'fm_ecodimb',
+ 'id'
=> array('name' => 'id', 'type' => 'int'),
+ 'fields'
=> array
+ (
+ array
+ (
+ 'name' =>
'descr',
+ 'descr' =>
lang('descr'),
+ 'type' =>
'varchar'
+ )
+ ),
+ 'edit_msg' => lang('edit'),
+ 'add_msg' => lang('add'),
+ 'name' => lang('dimb'),
+ 'acl_location' => '.admin',
+ 'menu_selection' =>
'admin::property::accounting::accounting_dimb'
+ );
+ break;
+ case 'dimd':
+ $info = array
+ (
+ 'table' => 'fm_ecodimd',
+ 'id'
=> array('name' => 'id', 'type' => 'int'),
+ 'fields'
=> array
+ (
+ array
+ (
+ 'name' =>
'descr',
+ 'descr' =>
lang('descr'),
+ 'type' =>
'varchar'
+ )
+ ),
+ 'edit_msg' => lang('edit'),
+ 'add_msg' => lang('add'),
+ 'name' => lang('dimd'),
+ 'acl_location' => '.admin',
+ 'menu_selection' =>
'admin::property::accounting::accounting_dimd'
+ );
+ break;
+ case 'tax':
+ $info = array
+ (
+ 'table' => 'fm_ecomva',
+ 'id'
=> array('name' => 'id', 'type' => 'int'),
+ 'fields'
=> array
+ (
+ array
+ (
+ 'name' =>
'descr',
+ 'descr' =>
lang('descr'),
+ 'type' =>
'varchar'
+ )
+ ),
+ 'edit_msg' => lang('edit'),
+ 'add_msg' => lang('add'),
+ 'name' => '',
+ 'acl_location' => '.admin',
+ 'menu_selection' =>
'admin::property::accounting::accounting_tax'
+ );
+ break;
+ case 'voucher_cat':
+ $info = array
+ (
+ 'table' =>
'fm_ecobilag_category',
+ 'id'
=> array('name' => 'id', 'type' => 'int'),
+ 'fields'
=> array
+ (
+ array
+ (
+ 'name' =>
'descr',
+ 'descr' =>
lang('descr'),
+ 'type' =>
'varchar'
+ )
+ ),
+ 'edit_msg' => lang('edit'),
+ 'add_msg' => lang('add'),
+ 'name' => '',
+ 'acl_location' => '.admin',
+ 'menu_selection' =>
'admin::property::accounting::voucher_cats'
+ );
+ break;
+ case 'voucher_type':
+ $info = array
+ (
+ 'table' => 'fm_ecoart',
+ 'id'
=> array('name' => 'id', 'type' => 'int'),
+ 'fields'
=> array
+ (
+ array
+ (
+ 'name' =>
'descr',
+ 'descr' =>
lang('descr'),
+ 'type' =>
'varchar'
+ )
+ ),
+ 'edit_msg' => lang('edit'),
+ 'add_msg' => lang('add'),
+ 'name' => '',
+ 'acl_location' => '.admin',
+ 'menu_selection' =>
'admin::property::accounting::voucher_type'
+ );
+ break;
+ case 'tender_chapter':
+ $info = array
+ (
+ 'table' => 'fm_chapter',
+ 'id'
=> array('name' => 'id', 'type' => 'int'),
+ 'fields'
=> array
+ (
+ array
+ (
+ 'name' =>
'descr',
+ 'descr' =>
lang('descr'),
+ 'type' =>
'varchar'
+ )
+ ),
+ 'edit_msg' => lang('edit'),
+ 'add_msg' => lang('add'),
+ 'name' => '',
+ 'acl_location' => '.admin',
+ 'menu_selection' =>
'admin::property::tender'
+ );
+ break;
+ case 'location':
+
+ $this->_db->query("SELECT id FROM
fm_location_type WHERE id ={$type_id}",__LINE__,__FILE__);
+
+ if($this->_db->next_record())
+ {
+ $info = array
+ (
+ 'table' =>
"fm_location{$type_id}_category",
+ 'id'
=> array('name' => 'id', 'type' => 'varchar'),
+ 'fields'
=> array
+ (
+ array
+ (
+ 'name'
=> 'descr',
+ 'descr'
=> lang('descr'),
+ 'type'
=> 'varchar'
+ )
+ ),
+ 'edit_msg' =>
lang('edit'),
+ 'add_msg' =>
lang('add'),
+ 'name' => '',
+ 'acl_location' =>
'.admin',
+ 'menu_selection' =>
"admin::property::location::location::category_{$type_id}"
+ );
+ }
+ else
+ {
+ throw new
Exception(lang('ERROR: illegal type %1', $type_id));
+ }
+ break;
+ case 'owner_cats':
+ $info = array
+ (
+ 'table' => 'fm_owner_category',
+ 'id'
=> array('name' => 'id', 'type' => 'int'),
+ 'fields'
=> array
+ (
+ array
+ (
+ 'name' =>
'descr',
+ 'descr' =>
lang('descr'),
+ 'type' =>
'varchar'
+ )
+ ),
+ 'edit_msg' => lang('edit'),
+ 'add_msg' => lang('add'),
+ 'name' => '',
+ 'acl_location' => '.admin',
+ 'menu_selection' =>
'admin::property::owner::owner_cats'
+ );
+ break;
+ case 'tenant_cats':
+ $info = array
+ (
+ 'table' => 'fm_tenant_category',
+ 'id'
=> array('name' => 'id', 'type' => 'int'),
+ 'fields'
=> array
+ (
+ array
+ (
+ 'name' =>
'descr',
+ 'descr' =>
lang('descr'),
+ 'type' =>
'varchar'
+ )
+ ),
+ 'edit_msg' => lang('edit'),
+ 'add_msg' => lang('add'),
+ 'name' => lang('tenant
category'),
+ 'acl_location' => '.admin',
+ 'menu_selection' =>
'admin::property::tenant::tenant_cats'
+ );
+ break;
+ case 'vendor_cats':
+ $info = array
+ (
+ 'table' => 'fm_vendor_category',
+ 'id'
=> array('name' => 'id', 'type' => 'int'),
+ 'fields'
=> array
+ (
+ array
+ (
+ 'name' =>
'descr',
+ 'descr' =>
lang('descr'),
+ 'type' =>
'varchar'
+ )
+ ),
+ 'edit_msg' => lang('edit'),
+ 'add_msg' => lang('add'),
+ 'name' => lang('vendor
category'),
+ 'acl_location' => '.admin',
+ 'menu_selection' =>
'admin::property::vendor::vendor_cats'
+ );
+ break;
+ case 'vendor':
+ $info = array
+ (
+ 'table'
=> 'fm_vendor',
+ 'id'
=> array('name' => 'id', 'type' => 'int'),
+ 'fields'
=> array
+ (
+ array
+ (
+ 'name' =>
'contact_phone',
+ 'descr' =>
lang('contact phone'),
+ 'type' =>
'varchar'
+ ),
+ array
+ (
+ 'name'
=> 'category',
+ 'descr'
=> lang('category'),
+ 'type'
=> 'select',
+ 'nullable'
=> false,
+ 'filter'
=> true,
+ 'sortable'
=> true,
+ 'values_def'
=> array
+ (
+
'valueset' => false,
+
'method' => 'property.bogeneric.get_list',
+
'method_input' => array('type' => 'vendor_cats', 'selected' =>
'##category##')
+ )
+ ),
+ array
+ (
+ //FIXME
+ 'name'
=> 'member_of',
+ 'descr'
=> lang('member'),
+ 'type'
=> 'multiple_select',
+ 'nullable'
=> false,
+ 'filter'
=> true,
+ 'sortable'
=> false,
+ 'hidden'
=> true,
+ 'values_def'
=> array
+ (
+
'valueset' => false,
+
'method' => 'property.bocommon.get_categories',
+
'method_input' => array('app' => 'property', 'acl_location' => '.vendor',
'selected' => '##member_of##')
+ )
+ ),
+ ),
+ 'edit_msg' => lang('edit'),
+ 'add_msg' => lang('add'),
+ 'name' =>
lang('vendor'),
+ 'acl_location' => '.vendor',
+ 'menu_selection' =>
'property::invoice::vendor',
+ 'default'
=> array
+ (
+ 'owner_id'
=> array('add' => '$this->account'),
+ 'entry_date' =>
array('add' => 'time()'),
+ // 'modified_date' =>
array('edit' => 'time()'),
+ )
+
+ );
+ break;
+ case 'owner':
+ $info = array
+ (
+ 'table'
=> 'fm_owner',
+ 'id'
=> array('name' => 'id', 'type' => 'int'),
+ 'fields'
=> array
+ (
+ array
+ (
+ 'name' =>
'remark',
+ 'descr' =>
lang('remark'),
+ 'type' => 'text'
+ ),
+ array
+ (
+ 'name'
=> 'category',
+ 'descr'
=> lang('category'),
+ 'type'
=> 'select',
+ 'nullable'
=> false,
+ 'filter'
=> true,
+ 'sortable'
=> true,
+ 'values_def'
=> array
+ (
+
'valueset' => false,
+
'method' => 'property.bogeneric.get_list',
+
'method_input' => array('type' => 'owner_cats', 'selected' =>
'##category##')
+ )
+ ),
+ ),
+ 'edit_msg' => lang('edit'),
+ 'add_msg' => lang('add'),
+ 'name' =>
lang('owner'),
+ 'acl_location' => '.owner',
+ 'menu_selection' =>
'admin::property::owner',
+ 'default'
=> array
+ (
+ 'owner_id'
=> array('add' => '$this->account'),
+ 'entry_date' =>
array('add' => 'time()'),
+ // 'modified_date' =>
array('edit' => 'time()'),
+ )
+
+ );
+ break;
+ case 'tenant':
+ $info = array
+ (
+ 'table'
=> 'fm_tenant',
+ 'id'
=> array('name' => 'id', 'type' => 'int'),
+ 'fields'
=> array
+ (
+ array
+ (
+ 'name' =>
'contact_email',
+ 'descr' =>
lang('contact_email'),
+ 'type' =>
'varchar',
+ 'sortable'
=> true,
+ ),
+ array
+ (
+ 'name'
=> 'category',
+ 'descr'
=> lang('category'),
+ 'type'
=> 'select',
+ 'nullable'
=> false,
+ 'filter'
=> true,
+ 'sortable'
=> true,
+ 'values_def'
=> array
+ (
+
'valueset' => false,
+
'method' => 'property.bogeneric.get_list',
+
'method_input' => array('type' => 'tenant_cats', 'selected' =>
'##category##')
+ )
+ )
+ ),
+ 'edit_msg' => lang('edit'),
+ 'add_msg' => lang('add'),
+ 'name' =>
lang('tenant'),
+ 'acl_location' => '.tenant',
+ 'menu_selection' =>
'admin::property::tenant',
+ 'default'
=> array
+ (
+ 'owner_id'
=> array('add' => '$this->account'),
+ 'entry_date' =>
array('add' => 'time()'),
+ // 'modified_date' =>
array('edit' => 'time()'),
+ )
+
+ );
+ break;
+ case 'district':
+ $info = array
+ (
+ 'table' => 'fm_district',
+ 'id'
=> array('name' => 'id', 'type' => 'int'),
+ 'fields'
=> array
+ (
+ array
+ (
+ 'name' =>
'descr',
+ 'descr' =>
lang('descr'),
+ 'type' =>
'varchar'
+ )
+ ),
+ 'edit_msg' => lang('edit'),
+ 'add_msg' => lang('add'),
+ 'name' =>
lang('district'),
+ 'acl_location' => '.admin',
+ 'menu_selection' =>
'admin::property::location::district'
+ );
+ break;
+ case 'street':
+ $info = array
+ (
+ 'table' => 'fm_streetaddress',
+ 'id'
=> array('name' => 'id', 'type' => 'int'),
+ 'fields'
=> array
+ (
+ array
+ (
+ 'name' =>
'descr',
+ 'descr' =>
lang('descr'),
+ 'type' =>
'varchar'
+ )
+ ),
+ 'edit_msg' => lang('edit'),
+ 'add_msg' => lang('add'),
+ 'name' =>
lang('streetaddress'),
+ 'acl_location' => '.admin',
+ 'menu_selection' =>
'admin::property::location::street'
+ );
+ break;
+ case 's_agreement':
+ $info = array
+ (
+ 'table' =>
'fm_s_agreement_category',
+ 'id'
=> array('name' => 'id', 'type' => 'int'),
+ 'fields'
=> array
+ (
+ array
+ (
+ 'name' =>
'descr',
+ 'descr' =>
lang('descr'),
+ 'type' =>
'varchar'
+ )
+ ),
+ 'edit_msg' => lang('edit'),
+ 'add_msg' => lang('add'),
+ 'name' => '',
+ 'acl_location' => '.admin',
+ 'menu_selection' =>
'admin::property::agreement::service_agree_cats'
+ );
+ break;
+ case 'tenant_claim':
+ $info = array
+ (
+ 'table' =>
'fm_tenant_claim_category',
+ 'id'
=> array('name' => 'id', 'type' => 'int'),
+ 'fields'
=> array
+ (
+ array
+ (
+ 'name' =>
'descr',
+ 'descr' =>
lang('descr'),
+ 'type' =>
'varchar'
+ )
+ ),
+ 'edit_msg' => lang('edit'),
+ 'add_msg' => lang('add'),
+ 'name' => '',
+ 'acl_location' => '.admin',
+ 'menu_selection' =>
'admin::property::tenant::claims_cats'
+ );
+ break;
+ case 'wo_hours':
+ $info = array
+ (
+ 'table' =>
'fm_wo_hours_category',
+ 'id'
=> array('name' => 'id', 'type' => 'int'),
+ 'fields'
=> array
+ (
+ array
+ (
+ 'name' =>
'descr',
+ 'descr' =>
lang('descr'),
+ 'type' =>
'varchar'
+ )
+ ),
+ 'edit_msg' => lang('edit'),
+ 'add_msg' => lang('add'),
+ 'name' => '',
+ 'acl_location' => '.admin',
+ 'menu_selection' =>
'admin::property::workorder_detail'
+ );
+ break;
+ case 'r_condition_type':
+ $info = array
+ (
+ 'table' =>
'fm_request_condition_type',
+ 'id'
=> array('name' => 'id', 'type' => 'int'),
+ 'fields'
=> array
+ (
+ array
+ (
+ 'name' =>
'descr',
+ 'descr' =>
lang('descr'),
+ 'type' =>
'varchar'
+ )
+ ),
+ 'edit_msg' => lang('edit'),
+ 'add_msg' => lang('add'),
+ 'name' => '',
+ 'acl_location' => '.admin',
+ 'menu_selection' =>
'admin::property::request_condition'
+ );
+ break;
+ case 'b_account':
+ $info = array
+ (
+ 'table' =>
'fm_b_account_category',
+ 'id'
=> array('name' => 'id', 'type' => 'int'),
+ 'fields'
=> array
+ (
+ array
+ (
+ 'name' =>
'descr',
+ 'descr' =>
lang('descr'),
+ 'type' =>
'varchar'
+ )
+ ),
+ 'edit_msg' => lang('edit'),
+ 'add_msg' => lang('add'),
+ 'name' => lang('budget
account'),
+ 'acl_location' => '.admin',
+ 'menu_selection' =>
'admin::property::accounting::accounting_cats'
+ );
+ break;
+//-------- ID type varchar
+ case 'project_status':
+ $info = array
+ (
+ 'table'
=> 'fm_project_status',
+ 'id'
=> array('name' => 'id', 'type' => 'varchar'),
+ 'fields'
=> array
+ (
+ array
+ (
+ 'name' =>
'descr',
+ 'descr' =>
lang('descr'),
+ 'type' =>
'varchar'
+ ),
+ array
+ (
+ 'name' =>
'approved',
+ 'descr' =>
lang('approved'),
+ 'type' =>
'checkbox'
+ ),
+ array
+ (
+ 'name' =>
'closed',
+ 'descr' =>
lang('closed'),
+ 'type' =>
'checkbox'
+ )
+ ),
+ 'edit_msg'
=> lang('edit status'),
+ 'add_msg'
=> lang('add status'),
+ 'name'
=> lang('project status'),
+ 'acl_location' =>
'.admin',
+ 'menu_selection' =>
'admin::property::project_status'
+ );
+ break;
+ case 'workorder_status':
+ $info = array
+ (
+ 'table'
=> 'fm_workorder_status',
+ 'id'
=> array('name' => 'id', 'type' => 'varchar'),
+ 'fields'
=> array
+ (
+ array
+ (
+ 'name' =>
'descr',
+ 'descr' =>
lang('descr'),
+ 'type' =>
'varchar'
+ ),
+ array
+ (
+ 'name' =>
'approved',
+ 'descr' =>
lang('approved'),
+ 'type' =>
'checkbox'
+ ),
+ array
+ (
+ 'name' =>
'in_progress',
+ 'descr' =>
lang('In progress'),
+ 'type' =>
'checkbox'
+ ),
+ array
+ (
+ 'name' =>
'delivered',
+ 'descr' =>
lang('delivered'),
+ 'type' =>
'checkbox'
+ ),
+ array
+ (
+ 'name' =>
'closed',
+ 'descr' =>
lang('closed'),
+ 'type' =>
'checkbox'
+ )
+ ),
+ 'edit_msg'
=> lang('edit status'),
+ 'add_msg'
=> lang('add status'),
+ 'name'
=> lang('workorder status'),
+ 'acl_location' =>
'.admin',
+ 'menu_selection' =>
'admin::property::workorder_status'
+ );
+ break;
+ case 'request_status':
+ $info = array
+ (
+ 'table'
=> 'fm_request_status',
+ 'id'
=> array('name' => 'id', 'type' => 'varchar'),
+ 'fields'
=> array
+ (
+ array
+ (
+ 'name' =>
'descr',
+ 'descr' =>
lang('descr'),
+ 'type' =>
'varchar'
+ )
+ ),
+ 'edit_msg'
=> lang('edit status'),
+ 'add_msg'
=> lang('add status'),
+ 'name'
=> lang('request status'),
+ 'acl_location' =>
'.admin',
+ 'menu_selection' =>
'admin::property::request_status'
+ );
+ break;
+ case 'agreement_status':
+ $info = array
+ (
+ 'table'
=> 'fm_agreement_status',
+ 'id'
=> array('name' => 'id', 'type' => 'varchar'),
+ 'fields'
=> array
+ (
+ array
+ (
+ 'name' =>
'descr',
+ 'descr' =>
lang('descr'),
+ 'type' =>
'varchar'
+ )
+ ),
+ 'edit_msg'
=> lang('edit status'),
+ 'add_msg'
=> lang('add status'),
+ 'name'
=> lang('agreement status'),
+ 'acl_location' =>
'.admin',
+ 'menu_selection' =>
'admin::property::agreement::agreement_status'
+ );
+ break;
+ case 'building_part':
+ $info = array
+ (
+ 'table'
=> 'fm_building_part',
+ 'id'
=> array('name' => 'id', 'type' => 'varchar'),
+ 'fields'
=> array
+ (
+ array
+ (
+ 'name' =>
'descr',
+ 'descr' =>
lang('descr'),
+ 'type' =>
'varchar'
+ )
+ ),
+ 'edit_msg'
=> lang('edit'),
+ 'add_msg'
=> lang('add'),
+ 'name'
=> lang('building part'),
+ 'acl_location' =>
'.admin',
+ 'menu_selection' =>
'admin::property::building_part'
+ );
+ break;
+ case 'document_status':
+ $info = array
+ (
+ 'table'
=> 'fm_document_status',
@@ Diff output truncated at 153600 characters. @@
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [6626] merge 6612:6625 from trunk,
Sigurd Nes <=